Nagios and eventhandlers

hi,

i am hardly tring to make an eventhandler about restarting http.
I followed nagios documentation, defining a service like this
define service{
host_name somehost
service_description HTTP
max_check_attempts 4
event_handler restart-httpd
...other service variables...
}

defining command like that
define command{
command_name restart-httpd
command_line usr/local/nagios/restart-httpd $SERVICESTATE$ $STATETYPE$ $SERVICEATTEMPT$
}
scripting restart-httpd like that
#!/bin/sh
case "$1" in
OK)
;;
WARNING)
;;
UNKNOWN)
;;
CRITICAL)
case "$2" in
SOFT)

case "$3" in
3)
echo -n "Restarting HTTP service (3rd soft critical state)..."
# Call the init script to restart the HTTPD server
/usr/bin/ssh nagios@192.2.2.X "sudo /etc/init.d/httpd restart"
esac
;;


HARD)
echo -n "Restarting HTTP service..."

/usr/bin/ssh nagios@192.2.2.X "sudo /etc/init.d/httpd restart"
;;
esac
;;
esac
exit 0
The script works in command line, nagios gives a ok status but with (No output ! output..) and the service don't restart. I've enabled event_handler in nagios.cfg. What am i missing?
Thanks In Advance.

 

 

 

 

Top