External command DEL_HOST_DOWNTIME not working

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mido2010
Posts: 16
Joined: Wed Jun 25, 2014 9:10 am

External command DEL_HOST_DOWNTIME not working

Post 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
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: External command DEL_HOST_DOWNTIME not working

Post 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?
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
mido2010
Posts: 16
Joined: Wed Jun 25, 2014 9:10 am

Re: External command DEL_HOST_DOWNTIME not working

Post 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
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: External command DEL_HOST_DOWNTIME not working

Post by lmiltchev »

I am glad I could help! :)
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked