TECHZEN Zenoss User Community ARCHIVE  

JSON event query less then or greater than

Subject: JSON event query less then or greater than
Author: Brian Schimmoller
Posted: 2017-05-18 15:00

I am trying to use zenoss_api to query for specific events. I have the query working, but I need to check if the count is greater than 3. Here's my working query without the count parameter:

zenoss_api evconsole_router EventsRouter query '{"limit":5000,"params":{"eventState":[0],"prodState":"1000","severity":4,"eventClass":"/Win/EventLog","summary":"The log shipping primary database"}}'

I've tried adding in the "count" parameter and it does work if I specifiy the count:

zenoss_api evconsole_router EventsRouter query '{"limit":5000,"params":{"eventState":[0],"prodState":"1000","severity":4,"eventClass":"/Win/EventLog","summary":"The log shipping primary database","count":[3,4,5]}}'

Any thoughts?

Edit: Removed my last example.


Subject: RE: JSON event query less then or greater than
Author: Tim Caiazza
Posted: 2017-05-18 15:26

What is the error that is returned?

------------------------------
Tim Caiazza
------------------------------


Subject: RE: JSON event query less then or greater than
Author: Brian Schimmoller
Posted: 2017-05-18 15:38

No error, but I want to create an event if the count is greater than 2. I'm not sure how to do greater than or less than instead of specifying the count.


Subject: RE: JSON event query less then or greater than
Author: Jane Curry
Posted: 2017-05-22 15:02

The createEventFilter method is defined in  $ZENHOME/Products/Zuul/facades/zepfacade.py - see the count_range attribute. count can either be a number or a range (in either list or tuple format) - but those are your only options on the filter itself' eg. --count 3,20000 would pull all events with counts between 3 and 20000.
Cheers,
Jane

------------------------------
Jane Curry
Skills 1st United Kingdom
jane.curry@skills-1st.co.uk
------------------------------


Subject: RE: JSON event query less then or greater than
Author: Brian Schimmoller
Posted: 2017-05-22 15:45

I was afraid that would be the only option. Thanks for the reply!


< Previous
OpenTSDb API Query
  Next
API call to addThreshold in Zenoss 5
>