External Command
Posted: Fri Jul 18, 2014 4:55 pm
Hola,
I'm trying to write a simple script that, tied to a cron job, will net me recurring scheduled downtime. I pulled the following:
From http://old.nagios.org/developerinfo/ext ... and_id=118
But I only see this in nagiosinstallation/var/nagios.log
nagios.debug doesn't say much else...
My actual downtime.sh script is:
It outputs "Works..." when it definitely does not. :\
Any idea why this would be failing?
Thanks!
Best,
G
I'm trying to write a simple script that, tied to a cron job, will net me recurring scheduled downtime. I pulled the following:
Code: Select all
#!/bin/sh
# This is a sample shell script showing how you can submit the SCHEDULE_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] SCHEDULE_HOST_DOWNTIME;host1;1110741500;1110748700;0;0;7200;Some One;Some Downtime Comment\n" $now > $commandfileBut I only see this in nagiosinstallation/var/nagios.log
Code: Select all
[1405720261] EXTERNAL COMMAND: SCHEDULE_HOST_DOWNTIME;nagios.domain.com;1406678400;1406764800;0;0;0;Test User;Test Downtime Comment
[1405720261] Error: External command failed -> SCHEDULE_HOST_DOWNTIME;nagios.domain.com;1406678400;1406764800;0;0;0;Test User;Test Downtime Comment
[1405720261] External command error: Command failedMy actual downtime.sh script is:
Code: Select all
#!/bin/sh
# This is a sample shell script showing how you can submit the SCHEDULE_HOST_DOWNTIME command
# to Nagios. Adjust variables to fit your environment as necessary.
now=`date +%s`
commandfile='/usr/local/nagios/var/rw/nagios.cmd'
/usr/bin/printf "[%lu] SCHEDULE_HOST_DOWNTIME;nagios.domain.com;1406678400;1406764800;0;0;0;Test User;Test Downtime Comment\n" $now > $commandfile
if [ $? -ne 1 ]; then
echo "Works....";
fi
Any idea why this would be failing?
Thanks!
Best,
G