@skypete, Good. So aside from not being able to automatically restart a service on the windows server, does the service check work as expected in the web interface? By that I mean it correctly turns green if the windows service is up and it turns red when the windows service is down? If the answer is yes, give your event handler /usr/local/nagios/libexec/restart_service.sh permissions:
Code: Select all
chmod +x /usr/local/nagios/libexec/restart_service.sh
Then open the script and make it do something basic, like create a text file:
Code: Select all
#!/bin/sh
echo "Event handler works!" > testing.txt
case "$1" in
OK)
;;
WARNING)
;;
UNKNOWN)
;;
CRITICAL)
/usr/local/nagios/libexec/check_nrpe -H "$2" -p 5666 -c restart_service -a "$3"
;;
esac
exit 0
So when nagios calls the event handler this line of code:
Code: Select all
echo "Event handler works!" > testing.txt
Will create a text file in /usr/local/nagios/libexec/ folder.
So let me know if the event handler creates this file for you.
Also, keep in mind that when we defined the service, we added this options:
Code: Select all
max_check_attempts 5
check_interval 5
This means once the service is down, Nagios will try checking it 5 more times with 5 min interval before calling the event handler. So either change this and restart nagios service, or keep the service down for 30 minutes before checking in on the result.
Please send me the screenshot from the Nagios Core web interface of this service in a critical state.