TECHZEN Zenoss User Community ARCHIVE  

Zenoss REST API (curl) not retuning more than 1000 rows

Subject: Zenoss REST API (curl) not retuning more than 1000 rows
Author: Anjan Kumar Tripathy
Posted: 2021-06-04 11:56

Hello Team,

We are trying to pull list of events for all the alerts from a particular class from the Zenoss DB using the CURL json but we are not getting only 1000 rows as the Json output where the actual count is more than 2000, Please advice what changes we need to make as we already tried increasing the limit to extreme but of no use
Json as below:

curl -k -u "xxx" -X POST -H "Content-Type:application/json" -d "{\"action\":\"EventsRouter\",\"method\":\"queryArchive\",\"data\":[{\"params\":{\"eventState\":[0,1,2,3,4,6],\"severity\":[5,4,3,2,1],\"prodState\":[1000],\"tags\":[],\"excludeNonActionables\":false,\"eventClass\":\"*ping\"},\"keys\":[\"eventState\",\"severity\",\"device\",\"eventClass\",\"firstTime\",\"lastTime\",\"count\",\"component\",\"prodState\",\"evid\",\"eventClassKey\",\"message\",\"zenoss.IncidentManagement.url\",\"zenoss.IncidentManagement.IncidentError\",\"zenoss.IncidentManagement.IncidentErrorDetail\"],\"uid\":\"/zport/dmd\",\"page\":1,\"start\":0,\"limit\":200000,\"sort\":\"firstTime\",\"dir\":\"ASC\"}],\"type\":\"rpc\",\"tid\":180}

------------------------------
Anjan Kumar Tripathy Team Lead (Senior Associate)
Seniour associate
Cognizant
KS
------------------------------


Subject: RE: Zenoss REST API (curl) not retuning more than 1000 rows
Author: Michael Rogers
Posted: 2021-06-04 18:44

Anjan,

I don't currently have a test instance with more than 1000 events to confirm, but I have some suspicions.

I don't believe the events router will allow you to request more than 1000, so your "limit":200000 will likely give back the max of 1000.  However, once you have the first 1000 events, you should be able to increment your "start" by 1000 to get the next batch along with "page" in single digit increments.  To see what I mean, here are a few sample payloads:

{"action":"EventsRouter","method":"query","data":[{"params":{"eventState":[0,1],"severity":[5,4,3,2],"tags":[],"excludeNonActionables":false},"keys":["eventState","severity","device","component","eventClass","summary","firstTime","lastTime","count","evid","eventClassKey","message"],"page":1,"start":0,"limit":200,"sort":"severity","dir":"DESC"}],"type":"rpc","tid":5}

{"action":"EventsRouter","method":"query","data":[{"params":{"eventState":[0,1],"severity":[5,4,3,2],"tags":[],"excludeNonActionables":false},"keys":["eventState","severity","device","component","eventClass","summary","firstTime","lastTime","count","evid","eventClassKey","message"],"uid":"/cz0/zport/dmd","page":2,"start":200,"limit":200,"sort":"severity","dir":"DESC"}],"type":"rpc","tid":6}

{"action":"EventsRouter","method":"query","data":[{"params":{"eventState":[0,1],"severity":[5,4,3,2],"tags":[],"excludeNonActionables":false},"keys":["eventState","severity","device","component","eventClass","summary","firstTime","lastTime","count","evid","eventClassKey","message"],"uid":"/cz0/zport/dmd","page":3,"start":400,"limit":200,"sort":"severity","dir":"DESC"}],"type":"rpc","tid":9}

Let me know your results?



------------------------------
Michael J. Rogers
Senior Instructor - Zenoss
Austin TX
------------------------------



< Previous
SolarWinds-style "live diagrams" functionality
  Next
Modelling a list of devices
>