External command error: Command failed

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

External command error: Command failed

Post by hbouma »

I am attempting to remove some acknowledgements from the command line. The host and service both exist, but the command fails each time. I wrote a script that takes in a variable of the HOST and Service. The script is running as root, so permissions should not be an issue.

Code: Select all

#!/bin/sh
# This is a sample shell script showing how you can submit the REMOVE_SVC_ACKNOWLEDGEMENT 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] REMOVE_SVC_ACKNOWLEDGEMENT;$1;$2\n" $now > $commandfile
I then call /usr/local/nagiosxi/scripts/removeAck.sh "SOMEHOST" "Disk Usage on D:/"

The acknowledgement is not removed and I see the following in /usr/local/nagios/var/nagios.log

Code: Select all

[1540828100] Error: External command failed -> REMOVE_SVC_ACKNOWLEDGEMENT;SOMEHOST;Disk Usage on D:/\n 1540828100
[1540828100] External command error: Command failed
My permissions appear correct in /usr/local/nagios/var/rw

Code: Select all

ll /usr/local/nagios/var/rw
total 8.0K
drwxrws---. 2 nagios nagcmd 4.0K Oct 29 11:48 .
drwxr-xr-x. 6 nagios nagios 4.0K Oct 29 11:53 ..
prw-rw----  1 nagios nagcmd    0 Oct 29 11:49 nagios.cmd
srw-rw----  1 nagios nagcmd    0 Oct 29 11:48 nagios.qh
I am running Nagios 5.5.4 on Red Hat 7 64bit VM's. Any help with this issue would be appreciated.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: External command error: Command failed

Post by npolovenko »

Hello, @hbouma. What version of XI are you using? Have you always had problems with external commands on this server or just recently?

Please open the /usr/local/nagios/etc/nagios.cfg file and make sure that:
check_external_commands=1
Then restart the nagios service:
service nagios restart
I ran your script and it worked just fine for me. Can you try removing acknowledgment for some service on the localhost? And let me know if it works.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

Re: External command error: Command failed

Post by hbouma »

check_external_commands=1 was already in the file.

I restarted the nagios service and now it works. Thanks!
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: External command error: Command failed

Post by npolovenko »

@hbouma, You're welcome. I will be closing this ticket as resolved.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked