TECHZEN Zenoss User Community ARCHIVE  

Zenoss 4.2.5 API 'limit' parameter not working above 999

Subject: Zenoss 4.2.5 API 'limit' parameter not working above 999
Author: [Not Specified]
Posted: 2016-08-17 09:48

Hello Community,

I've lately been working on a script that is meant to automate the extraction of Zenossevent history over a specific time range. I originally used this example (https://gist.github.com/jcurry/ebb20c6665ba249bce55) and the JSON API documentation guide to whip up a Python script that simply uses the QueryArchive method. I've been able to grab events with this but I seem limited to the amount of events that are returned. Every time I specify above 999, the total returned results are 999. If I specify anything below 999, it will return the exact amount of events that I specified.

Here's the formulated JSON API query where I'm attempting to search for events (with a limit of 2000) over a range of the entire day of July 9th, 2016:

APIQuery = {"action" : "EventsRouter", 
"method" : "queryArchive", # queryArchive=Zenoss4,queryHistory=Zenoss3
"data" : [{ "start" : 0, "limit" : 2000, "sort" : "firstTime", "dir" : "DESC", 
"params" : { "eventState" : [0,1,2,3,4,5,6], "severity" : [5,4,3,2,1], "lastTime" : "2016-07-09 00:00:00/2016-07-09 23:59:59" },
"keys":["summary", "count", "firstTime", "lastTime", "device", "severity", "eventClass"] }], 
"tid" : 1,
"uid" : "/zport/dmd",
"history" : 1
}

headers = {"Content-Type" : "application/json",
}

I'm sort of at a loss and have tried some work arounds that didn't lead me anywhere. Any insight would be most appreciated!

Cheers,

zenossuser999



Subject: Yeh - I'm afraid I ran into
Author: Jane Curry
Posted: 2016-08-31 09:37

Yeh - I'm afraid I ran into that one - and didn't find any way around it. Anyone else

Cheers

Jane

Email: jane.curry@skills-1st.co.uk    Web: https://www.skills-1st.co.uk



Subject: Looks to be an issue within
Author: Jay Stanley
Posted: 2016-09-01 13:31

Looks to be an issue within zeneventserver.

You could get around it by making multiple calls.. since the totalCount is correct, just create a loop



< Previous
Graph HS
  Next
Event flapping problem
>