Restarting a service with Nagios

nagios

OK, guys, sorry for my probably stupid questions but I'm very new at this. I was assigned to research how to use Nagios to monitor different services and if a service falls down, to attempt to restart it and send out notification. Nagios seems to be huge software and I don't find the docs to be very friendly for a newcommer like me…

I've successfully installed Nagios on a Debian box, I've configured the web interface and now I'm frustrated.

So, I want to be able to monitor a service. I can write all the logic as a python plugin probably – I can write a command_line program in python that will read in the parameters supplied by Nagios, return the status code, message, etc but I do not know where to put that plugin, how to configure it so that Nagios is aware if it.

I also do not know how to attach event handlers if service' status changes – to implement some logic like restarting the service, etc.

Any help will be very appreciated – a link to tutorial might be all I need, just point me the direction.

Best Answer

You want to look at Nagios Event Handlers. Here's the official documentation:

http://nagios.sourceforge.net/docs/3_0/eventhandlers.html

There's an example of restarting a process on that page.