Now restart the nrpe server and nagios3 service as below. Service nagios3 restart ( on the nagios-core) service nagios-nrpe-server restart ( on the client server) That’s it! Your Nagios UI will be able to check the results now. Hope this blog was helpful and you will yourself be able to create Plugin in Nagios using Bash Script. How to Restart A Windows Service With NRPE. This document describes how to restart services in Windows using Nagios XI with NSClient/NRPE. This allows you to automate the process of starting, stopping and restarting Window Services.
![Nagios restart service by scripts Nagios restart service by scripts](/uploads/1/2/5/3/125390471/753334142.png)
I'm getting started with Nagios and I want to learn some specific and interesting things to expose them on class such as how event handlers works and implementing one or a few examples about it. More specifically, I thought about try to automatically restart services when they're not working fine/change to HARD state on my monitorized Windows 7 host or even after on my Debian 7.8 host if everything goes fine.The official Nagios Documentation has a PDF about it but they just only show you to do it with the Nagios XI Web Interface and I just have installed Nagios Core and I can't follow most of the steps.
General approach for doing what you want with event handlers and notification:. Let's assume Nagios checks every five minutes to see if you get a 500 error. Every check fires the event handler, so you teach it to exit without doing anything if the result is 'OK'. When there is a 500 error, the event handler knows that this is the 1st SOFT CRITICAL. Meanwhile, Nagios starts checking every minute (let's assume) and will check for five total attempts before notifyingThis gives your event handler four minutes until Nagios goes into a HARD CRITICAL state.