event handler

Fernando Rocha fernando.rocha at opservices.com.br
Wed Apr 22 15:49:17 CEST 2009


Hello Anirudh! 

If you change the check_nrpe to check_nt it will not work. 

This plugin uses nsclient++, that supports to run commands remotely over the nrpe. 

To add the event handlers you must change the the agent installed at hosts. 

To be easily, you can use the OpMon Agent, that is nsclient++ based, has built-in a similar plugin to control windows services and supports also yours check_nt commands. 

http://www.opservices.com.br/agentes 
opmonagent-2.8.2.0_autoinstall.exe 

So, just uninstall the current agent, install the OpMon Agent and use the check_nrpe to run the event handler. 

> define command{ 
> command_name win_service_restart 
> command_line $USER1$/ check_nrpe -H $HOSTADDRESS$ -p 5666 -c service_control -n -a <win_service_name> <restart> 
> } 

You have also get installed the nrpe on your nagios host, that provides the check_nrpe. 

-- 
Fernando Rocha <fernando.rocha at opservices.com.br> 
OpServices - Porto Alegre - RS - Brasil 
+55 51 3275.3588 
www.opservices.com.br 
www.opmon.org 

----- "Anirudh Srinivasan" <srianirudh at gmail.com> wrote: 
> Hey Folks 

> 
I am currently working on event handlers to restart services on Windows machines 

> 
I have NC_Net installed on all client windows machines. I was looking at this plugin " Windows Failed Service restart batch file" at Nagios Exchange. 

> 
File: win_service_restart.cmd 
> Author: Vadims Zenins http://vadimszenins.blogspot.com 
> Version: 1.03 
> Date: 16/12/2008 17:19 
> Windows Failed Service restart batch file for Nagios Event Handler 
> 
> Copy win_service_restart.cmd to \NSClient++\scripts\ folder. 
> 
> Nagios commands.cfg: 
> define command{ 
> command_name win_service_restart 
> command_line $USER1$/ check_nrpe -H $HOSTADDRESS$ -p 5666 -c win_service_restart -a "$SERVICEDESC$" $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ 
> } 
> 
> Nagios template-services_common-win.cfg.cfg 
> define service{ 
> name generic-service-win-wuauserv 
> service_description wuauserv 
> display_name Automatic Updates 
> event_handler win_service_restart 
> event_handler_enabled 1 
> check_command check_nt!SERVICESTATE!-d SHOWALL -l $SERVICEDESC$ 
> } 
> 
> NSCLIENT++ NSC.ini: 
> [NRPE] 
> allowed_hosts= 192.168.1.1/32 ; your Nagios server IP 
> allow_arguments=1 
> [External Script] 
> allow_arguments=1 
> allow_nasty_meta_chars=1 
> [NRPE Handlers] 
> command[win_service_restart]=scripts\win_service_restart.cmd "$ARG1$" $ARG2$ $ARG3$ $ARG4$ 
> 

> 
It uses check_nrpe at the commands.cfg file, but here we use check_nt . 

> 
My question is, will this work if i change it to check_nt . Or is there any changes that has to be made. 

> 
Can anyone please shed light on this . 

> 
- 
> Anirudh Srinivasan 
> 
> 
> ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p 
> _______________________________________________ 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 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20090422/73fc7846/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
-------------- next part --------------
_______________________________________________
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