You are here

event handler question

1 post / 0 new
sreveliotty
sreveliotty's picture
event handler question

Hi,

 

I'm having an issue getting event handlers working properly.  Following the doc below, a couple things are unclear:

http://www.opsview.com/technology/guides-help/opsview-configuration/even...

The doc mentions an example script (in bold red text) to restart apache if the service state is critical and has failed 3 times (hard failure state type), but I'm not following where that content actually goes? It seems like the actual "script" that would be in /usr/local/nagios/libexec/eventhandlers would simply contain something like /etc/init.d/apache2 start, so where does this snippet go?:

It seems like the ".... -c eh_apache_restart " line calls the actual event handler (/etc/init.d/apache2 start).    

if [ [ "$NAGIOS_SERVICESTATE" = "CRITICAL" && "$NAGIOS_SERVICESTATETYPE" = "HARD" ] ] then echo "restarting apache" # insert event handler action here... /usr/local/nagios/libexec/check_nrpe -H $NAGIOS_HOSTADDRESS -c eh_apache_restart >/dev/null 2>&1 # record event to syslog logger "Apache 2 restarted by Opsview $NAGIOS_HOSTADDRESS"