event handler!!!

Demetri Mouratis dmourati at cm.math.uiuc.edu
Mon May 19 18:00:43 CEST 2003


On Mon, 19 May 2003, Soeun Vanny wrote:

> Dear Sir;
>
> I'm wondering whether we can use "event handler" to restart a service on a
> remote machine.For example:
>
> _A http service on a remote machine(it is not running nagios) is stopped.And
> when a moniterd machine(it is running nagios) probed that the http service
> on the remote is being stopped,can the event handler be applied to restart
> that service?
>

Sure.  Take a look at the example (for restarting apache on a local
machine):

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

Now, configure a nagios account on the remote machine that has privileges
to run apachectl.  Create an ssh keypair and publish the public key in the
/home/nagios/.ssh/authorized_keys file.

Modify the stock event handler to do something like:

ssh -l nagios remote_box /usr/sbin/apachectl restart

Hope that helps.
---------------------------------------------------------------------
Demetri Mouratis
dmourati at linfactory.com



-------------------------------------------------------
This SF.net email is sponsored by: If flattening out C++ or Java
code to make your application fit in a relational database is painful, 
don't do it! Check out ObjectStore. Now part of Progress Software.
http://www.objectstore.net/sourceforge
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list