Page 1 of 1

What is the date format in the Nagios API?

Posted: Tue Jan 31, 2017 6:38 am
by dev.mellano
I am using Nagios API to get the critical servicelist, but I need to start date and end date for the the lastupdate field. what is the date format that I need to use it there? I tried the long one, but it seems it is not working.

Re: What is the date format in the Nagios API?

Posted: Tue Jan 31, 2017 11:47 am
by rkennedy
I believe you're referring to the unix timestamp - http://www.epochconverter.com/

If not, can you show us a screenshot where you're referring to?

Re: What is the date format in the Nagios API?

Posted: Sun Feb 05, 2017 1:59 am
by dev.mellano
Suppose I need to get all the service list in critical status starting from 1/1/2017, I call the following API, am I right?
/nagios/cgi-bin/statusjson.cgi?query=servicelist&details=true&dateformat=l&servicestatus=critical&servicetimefield=lasttimecritical&starttime=1483228800

Re: What is the date format in the Nagios API?

Posted: Mon Feb 06, 2017 2:03 pm
by tmcdonald
This does not seem to give historical data, as the returned starttime parameter is always 1 on my machine, and no matter how far back I set the parameter it returns the same data. Going to check with our Core dev on this behavior.

To be clear, are you looking to limit the results to anything that was last updated between January 1 and now?

Update: If you are in fact looking for historical data, you will want to use something like:

nagios/cgi-bin/archivejson.cgi?query=alertlist&servicestates=critical&starttime=1473228800&endtime=1486411693