External command error: Command failed
Posted: Mon Oct 29, 2018 10:58 am
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.
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
My permissions appear correct in /usr/local/nagios/var/rw
I am running Nagios 5.5.4 on Red Hat 7 64bit VM's. Any help with this issue would be appreciated.
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
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
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