Help - I am unable to get the NSClient++ to restart services

Thomas Guyot-Sionnest dermoth at aei.ca
Sat Jul 12 23:25:03 CEST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/07/08 02:39 PM, Jonathan Williams wrote:
> Hello everyone,  I am new to Nagios and am looking for some help.  I
> already posted this in the forum as well.  I can successful get Nagios
> to monitor any service I need, but I can’t get it to restart.  Here is
> my situation up to date: (from the forums)
> 
>  
> 
> I did make sure event handler was enabled, but the documentation refers
> to scripting the start up of linux services, not Windows. I figured I
> can create a .bat file to do a simple net start, but how does Nagios run
> it? Is it something like this? (example of the server service)
> 
> define service{
> host_name somehost
> service_description Server Service
> max_check_attempts 4
> event_handler restart_server
> }
> 
> Than for the handler command:
> define command{
> command_name restart-httpd
> (This is where I am unsure. Do I give it a path to the .bat file?)

That command is run from the Nagios server. First make sure to use the
full path to it, and make sure it can successfully restart the service
on the remote server even when run as the Nagios server. You should
probably pass a few macros as well do determine when to restart the server.

The event handler command should be a script that looks for the passed
macros and determine when to restart the server. Event handlers are run
EVERY TIME a state change (including all SOFT attempts). You probably
don't want to run it every time, especially not when the service recovers!.

AFAIK the Nagios documentation has a few examples of event handlers
including some scripts.

Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIeSEu6dZ+Kt5BchYRAslEAKC3AzG4Di2fbxF1j4+PlVqDeUtI5wCcDgDZ
efuNyvdTBoIgGyYgQiesNb0=
=J+IW
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
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