Hi,
I have a problem using the event_handler feature.
Basically, I’d like to start a script whenever a host is down.
For a start, my script would be :
Location of the echo and mail commands
echocmd="/bin/echo"
Only take action on hard host states…
case "$1" in
DOWN)
$echocmd $1 $2 > /tmp/testDOWN.txt
;;
UP)
$echocmd $1 $2 > /tmp/testUP.txt
;;
*)
$echocmd $1 $2 > /tmp/testELSE.txt
;;
esac
exit 0
Very basic, just only to test the script execution (that does not happen ).
I checked the script is OK by typing the command
./testscript DOWN TESTSERVER
=> the /tmp/testDOWN.txt is created.
In the checkcommands.cfg :
In the hosts.cfg :
define host{
use host-template
host_name MYSERVER
alias MYSERVER
address 192.168.10.1
check_command check-host-alive
}
Moreover, in the Web GUI, I have “Enable event handler for this host” checked.
That’s all for the config…
When I test, the nagios.log file says :
[1136361525] HOST ALERT: MYSERVER;DOWN;SOFT;1;CRITICAL - Plugin timed out after 10 seconds
[1136361535] HOST ALERT: MYSERVER;DOWN;SOFT;2;CRITICAL - Plugin timed out after 10 seconds
[1136361545] HOST ALERT: MYSERVER;DOWN;SOFT;3;CRITICAL - Plugin timed out after 10 seconds
[1136361555] HOST ALERT: MYSERVER;DOWN;SOFT;4;CRITICAL - Plugin timed out after 10 seconds
[1136361565] HOST ALERT: spare330;DOWN;HARD;5;CRITICAL - Plugin timed out after 10 seconds
[1136361565] SERVICE ALERT: MYSERVER;Ping;CRITICAL;HARD;1;CRITICAL - Plugin timed out after 30 seconds
But nothing happens regarding the event_handler
I’m completely lost ! Why doesn’t it work ??
I’ve also tried to setup the event_handler in the services.cfg file but with the same bad luck…
Could anybody help me ? Please ? ;-/
Thanx for you time reading this anyway… and a bigger one for answering if any idea
Edited ]