configuring eventhandlers

Capacci Thomas mrcapacci at free.fr
Thu Sep 9 19:42:16 CEST 2004


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 at 192.2.2.X "sudo /etc/init.d/httpd restart"
			esac
		;;
				
	
	HARD)
		echo -n "Restarting HTTP service..."
		
		/usr/bin/ssh nagios at 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.


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list