X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=dsa-nagios-checks%2Fevent_handlers%2Fdsa-eventhandler-restart-service;h=5551dd123d4cf304a5009f920c63451bde50c858;hb=ba85142ce642eba8866385c97bf50030c130b2c0;hp=278ddeee20c33388f500979dc4f293999d1dd2e0;hpb=8cf0eb595cc722da0dc9b88235138806b88d937c;p=mirror%2Fdsa-nagios.git diff --git a/dsa-nagios-checks/event_handlers/dsa-eventhandler-restart-service b/dsa-nagios-checks/event_handlers/dsa-eventhandler-restart-service index 278ddee..5551dd1 100755 --- a/dsa-nagios-checks/event_handlers/dsa-eventhandler-restart-service +++ b/dsa-nagios-checks/event_handlers/dsa-eventhandler-restart-service @@ -10,25 +10,19 @@ # $1 $SERVICESTATE$ # $2 $SERVICESTATETYPE$ # $3 $SERVICEATTEMPT$ +# $4 $HOSTADDRESS$ # $4 init script name state="$1" type="$2" attempt="$3" -service="$4" +host="$4" +starton="$5" +service="$6" # What state is the service in? case "${state}" in - OK) - # The service just came back up, so don't do anything... - ;; - WARNING) - # We don't really care about warning states, since the service is probably still running... - ;; - UNKNOWN) - # We don't know what might be causing an unknown error, so don't do anything... - ;; - CRITICAL) + "${starton}") # Aha! The service appears to have a problem - perhaps we should restart it # Is this a "soft" or a "hard" state? case "${type}" in @@ -46,7 +40,7 @@ case "${state}" in # fixed the problem! 3) # Call the init script to restart the HTTPD server - sudo /etc/init.d/${service} restart + /usr/lib/nagios/plugins/check_nrpe -n -H "${host}" -c "${service}" ;; esac ;; @@ -56,7 +50,7 @@ case "${state}" in # Note: Contacts have already been notified of a problem with the service at this # point (unless you disabled notifications for this service) HARD) - sudo /etc/init.d/${service} restart + /usr/lib/nagios/plugins/check_nrpe -n -H "${host}" -c "${service}" ;; esac ;;