Page 1 of 1

How to delete Scheduled downtime?

Posted: Mon Sep 08, 2014 3:41 pm
by gsrinivas
Hi,

I could schedule a downtime through http call but could not delete the scheduled downtime using http call. Upon http call, I received a response of 200, which is OK but I don't see the scheduled downtime deleted from UI, Please advise.

http://<hostname>/nagios/cgi-bin/cmd.cgi?cmd_typ=78&down_id=282&btnSubmit=Commit

Thanks

Re: How to delete Scheduled downtime?

Posted: Mon Sep 08, 2014 4:41 pm
by abrist
The url looks correct. I assume the down_id was verified to be correct?
Enable log_external commands in nagios.cfg with the following change and restart nagios:

Code: Select all

log_external_commands=1
Now use a running tail to watch for the downtime delete:

Code: Select all

tail -f /usr/local/nagios/var/nagios.log | grep EXTERNAL
You should see something down the lines of the following creation of downtime:

Code: Select all

[1410212421] EXTERNAL COMMAND: SCHEDULE_HOST_DOWNTIME;gent;1410212415;1410219615;1;0;7200;Nagios Administrator;test
And then the deletion:

Code: Select all

[1410212437] EXTERNAL COMMAND: DEL_HOST_DOWNTIME;141

Re: How to delete Scheduled downtime?

Posted: Mon Sep 08, 2014 8:17 pm
by gsrinivas
Thanks for your reply. I verified the down_id from UI.

Here is the request and responses for both schedule downtime and cancel downtime:

Code: Select all

Schedule Downtime HttpRequest:

http://test:testpwd@<hostname>/nagios/cgi-bin/cmd.cgi?cmd_typ=55&cmd_mod=2&host=testserver&com_data=TestingDowntime&trigger=0&fixed=1&hours=2&minutes=0&btnSubmit=Commit&start_time=09-08-2014 18:00:00&end_time=09-08-2014 19:00:00
<br>

HttpResponse:
<P><DIV CLASS='infoMessage'>Your command request was successfully submitted to Nagios for processing.<BR><BR>
Note: It may take a while before the command is actually processed.<BR><BR>

Data in UI
testserver	09-08-2014 18:06:12	TestAccount	TestingDowntime	09-08-2014 18:00:00	09-08-2014 19:00:00	Fixed	0d 1h 0m 0s	284	N/A
Here is the request and response from can downtime:

Code: Select all

Cancel Downtime HttpRequest:

http://test:testpwd@<hostname>/nagios/cgi-bin/cmd.cgi?cmd_typ=78&down_id=284&btnSubmit=Commit

HttpResponse:
<P><DIV CLASS='infoMessage'>Please enter all required information before committing the command.<br>Required fields are marked in red.<br>Failure to supply all required values will result in an error.</DIV></P>

Looks like btnSubmit is not working.

Re: How to delete Scheduled downtime?

Posted: Tue Sep 09, 2014 9:49 am
by abrist
What version of Nagiso XI are you running?

Re: How to delete Scheduled downtime?

Posted: Tue Sep 09, 2014 9:57 am
by gsrinivas
abrist wrote:What version of Nagiso XI are you running?
Home Page I see - Nagios XI 2012R2.2

and on cmg.cgi page (http://<hostname>/nagios/cgi-bin/cmd.cgi), I see the below:

External Command Interface
Last Updated: Tue Sep 9 08:08:21 PDT 2014
NagiosĀ® Coreā„¢ 3.5.0 - http://www.nagios.org
Logged in as nolio

Also, Is there a way to cancel the downtime using hostname or service name instead of downtime id?

Re: How to delete Scheduled downtime?

Posted: Tue Sep 09, 2014 5:10 pm
by abrist
ok, I will have to test with 2.2 and get back to you.
gsrinivas wrote:Also, Is there a way to cancel the downtime using hostname or service name instead of downtime id?
No, as you may have multiple downtimes set on the object. The id is the only way.