Page 1 of 1
check if downtime is scheduled for a host via CGI
Posted: Tue May 17, 2016 12:43 pm
by vivekm
How do we check if we have a downtime scheduled for a host via CGI in Nagios Core 4.x??
probably even get the downtime id for it as well...
Re: check if downtime is scheduled for a host via CGI
Posted: Tue May 17, 2016 1:13 pm
by mcapra
The JSON Query Generator is super handy for this sort of thing (where x.x.x.x is your Core install):
http://x.x.x.x/nagios/jsonquery.html
A brief intro to the JSON Query Generator:
https://labs.nagios.com/2014/06/19/expl ... -7-part-1/
If you wanted to check if host y.y.y.y has scheduled downtime, you could try the following query (where x.x.x.x is your Core install):
http://x.x.x.x/nagios/cgi-bin/statusjso ... =starttime
downtimelist will be empty if there is no downtime scheduled, otherwise it will contain the downtime id for each scheduled downtime for host y.y.y.y.
Also if you wanted a graphical response, drop the json from the script you are running:
http://x.x.x.x/nagios/cgi-bin/status.cg ... =starttime
Re: check if downtime is scheduled for a host via CGI
Posted: Wed May 18, 2016 5:41 am
by vivekm
Hi
It solved the use-case i was implementing. Thanks a lot for your response. Cheers
Vivek