Page 1 of 1

External command DEL_HOST_DOWNTIME not working

Posted: Fri Aug 26, 2016 3:36 am
by mido2010
Hi there,

we would like use an external Interface for setting up and deleting downtimes.

With setting up downtimes everything works brilliant, but I'm not able to get the external command DEL_HOST_DOWNTIME working.

Assuming that we have a host dowtime set with scheduleddowntime_id = 221, I'm firing the following command from apache via php:

echo "[%lu] DEL_HOST_DOWNTIME;221\n" $now > $commandfile

I find instantly the following log entry:

EXTERNAL COMMAND: DEL_HOST_DOWNTIME;221

but in fact the downtime is still there...

We are using the Nagios Appliance running under CentOS, Nagios XI Version 5.2.9.

Any ideas?

Best regards,

Michael

Re: External command DEL_HOST_DOWNTIME not working

Posted: Fri Aug 26, 2016 9:22 am
by lmiltchev
H-m-m, I am not able to recreate the issue. I had a scheduled downtime on localhost with downtime ID = 911.
example01.PNG
I was able to cancel it by running my "test.sh" script from the CLI.

Code: Select all

[root@localhost ~]# cat /tmp/test.sh
#!/bin/sh
# This is a sample shell script showing how you can submit the DEL_HOST_DOWNTIME command
# to Nagios.  Adjust variables to fit your environment as necessary.

now=`date +%s`
commandfile='/usr/local/nagios/var/rw/nagios.cmd'

/bin/printf "[%lu] DEL_HOST_DOWNTIME;911\n" $now > $commandfile

Code: Select all

[root@localhost ~]# /tmp/test.sh
[root@localhost ~]# tail /usr/local/nagios/var/nagios.log | grep -i downtime
[1472220945] HOST DOWNTIME ALERT: localhost;CANCELLED; Scheduled downtime for host has been cancelled.
I no longer see the downtime in the GUI.
example02.PNG
Are you sure you used the correct downtime ID?

Re: External command DEL_HOST_DOWNTIME not working

Posted: Mon Aug 29, 2016 12:45 am
by mido2010
S H A M E on ME!

To get the downtime ID, I read value scheduleddowntime_id from table nagios_scheduleddowntime, what was obviously wrong...

The correct value is in field internal_downtime_id, so now my script works as expected.

Many thanks for your help and input!!!

Best regards,

Michael

Re: External command DEL_HOST_DOWNTIME not working

Posted: Mon Aug 29, 2016 9:19 am
by lmiltchev
I am glad I could help! :)