Hi,
I am having problem getting EXTERNAL COMMAND to work when send the command directly to the nagios.cmd file.
When I run from a script all I get in the log file is...
From Script
[1423495647] EXTERNAL COMMAND: SCHEDULE_HOST_DOWNTIME;Laserjet-3015;1423495646;1423496246;1;0;7200,martin.stevens;test-from-script
When I work through the Web GUI, it also triggers the HOST DOWNTIME ALERT
From WebUI
[1423495661] EXTERNAL COMMAND: SCHEDULE_HOST_DOWNTIME;Laserjet-3015;1423495618;1423502818;1;0;7200;Martin Stevens(Systems Administrator);Testing
[1423495661] HOST DOWNTIME ALERT: Laserjet-3015;STARTED; Host has entered a period of scheduled downtime
Permissions wouldn't seem to be the issue, as I can insert the command.
Any ideas ?
Martin
EXTERNAL COMMANDS from Script
Re: EXTERNAL COMMANDS from Script
In the external script, is "martin.stevens" a valid contact in Nagios?
Try changing it to the following and see if that works for you.
Try changing it to the following and see if that works for you.
Code: Select all
Martin Stevens(Systems Administrator)Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: EXTERNAL COMMANDS from Script
I've tested with both contact_name and the alias, and it doesn't seem to make any difference.
The contact name also matches the name in the passwd file.
Using this shell script
The contact name also matches the name in the passwd file.
Code: Select all
define contact{
contact_name martin.stevens
use generic-contact
alias Martin Stevens(Systems Administrator)
email [email protected]
}
Code: Select all
#!/bin/sh
now=`date +%s`
time=`date +%H:%M:%S`
commandfile='/var/spool/nagios/cmd/nagios.cmd'
MINUTES=10
STARTTIME=$(date +"%s")
ENDTIME=$(date +"%s" -d "$MINUTES min")
/usr/bin/printf "[%lu] SCHEDULE_HOST_DOWNTIME;Laserjet-3015;$STARTTIME;$ENDTIME;1;0;7200,Martin Stevens(Systems Administrator);Host Down at $time\n" $now > $commandfile
Re: EXTERNAL COMMANDS from Script
Right spotted my error can you see the , rather than the ; in the script... D'oh
Re: EXTERNAL COMMANDS from Script
Hey, it could have been worse :)
Let's close this up.
Let's close this up.
Former Nagios employee