check if downtime is scheduled for a host via CGI

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
vivekm
Posts: 4
Joined: Tue May 17, 2016 4:19 am

check if downtime is scheduled for a host via CGI

Post 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...
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: check if downtime is scheduled for a host via CGI

Post 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
Former Nagios employee
https://www.mcapra.com/
vivekm
Posts: 4
Joined: Tue May 17, 2016 4:19 am

Re: check if downtime is scheduled for a host via CGI

Post by vivekm »

Hi

It solved the use-case i was implementing. Thanks a lot for your response. Cheers

Vivek
Locked