Discussion:
Using the JSON API to query for events within a time range
Hector Akamine
2013-02-27 00:20:11 UTC
Permalink
Hector Akamine [http://community.zenoss.org/people/haa] created the discussion

"Using the JSON API to query for events within a time range"

To view the discussion, visit: http://community.zenoss.org/message/72175#72175

--------------------------------------------------------------
Hi,
Using the JSON API, I would like to extract a list of events within a defined time interval (e.g., lastTime between 2013-01-01 00:00:00 and 2013-01-31 23:59:59). Is it possible to define a query to do that?

The JSON API python sample code shows a query to match some values, using a dictionary:

    def get_events(self, device=None, component=None, eventClass=None):
        data = dict(start=0, limit=100, dir='DESC', sort='severity')
        data['params'] = dict(severity=[5,4,3,2], eventState=[0,1])

Is there a way to specify a range of values instead (so I can query for time intervals)?
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/72175#72175]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
jcurry
2013-02-27 23:00:38 UTC
Permalink
jcurry [http://community.zenoss.org/people/jcurry] created the discussion

"Re: Using the JSON API to query for events within a time range"

To view the discussion, visit: http://community.zenoss.org/message/72210#72210

--------------------------------------------------------------
Try getting my Zenoss 4 Event Managementm paper.  The last chapter is on the JSON API with an example close to what you want. http://www.skills-1st.co.uk/papers/jane/zenoss4-events/ http://www.skills-1st.co.uk/papers/jane/zenoss4-events/.

Better still - sign up for the event management class - http://www.skills-1st.co.uk/products/courses/zenoss-events.html http://www.skills-1st.co.uk/products/courses/zenoss-events.html


Cheers,
Jane
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/72210#72210]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Hector Akamine
2013-03-06 17:12:32 UTC
Permalink
Hector Akamine [http://community.zenoss.org/people/haa] created the discussion

"Re: Using the JSON API to query for events within a time range"

To view the discussion, visit: http://community.zenoss.org/message/72279#72279

--------------------------------------------------------------
For lastTime, a slash (/) can be used to specify a range in a query: '2013-01-01 00:00:00/2013-01-31 23:59:59'. (there is a function _timeRange() defined in Products/Zuul/routers/zep.py that parses this).
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/72279#72279]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...