What is the date format in the Nagios API?
-
- Posts: 4
- Joined: Wed Jan 18, 2017 6:52 am
What is the date format in the Nagios API?
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?
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?
If not, can you show us a screenshot where you're referring to?
Former Nagios Employee
-
- Posts: 4
- Joined: Wed Jan 18, 2017 6:52 am
Re: What is the date format in the Nagios API?
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
/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?
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
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
Former Nagios employee