<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Arial; font-size: 10pt; color: #000000'>Hello Anirudh!<br><br>If you change the check_nrpe to check_nt it will not work.<br><br>This plugin uses nsclient++, that supports to run commands remotely over the nrpe.<br><br>To add the event handlers you must change the the agent installed at  hosts.<br><br>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.<br><br>http://www.opservices.com.br/agentes<br><a href="http://www.opservices.com.br/files/agentes/Windows/opmonagent-2.8.2.0_autoinstall.exe">opmonagent-2.8.2.0_autoinstall.exe</a><br><br>So, just uninstall the current agent, install the OpMon Agent and use the check_nrpe to run the event handler.<br><br><span class="Apple-style-span" style="color: rgb(51, 51, 46); font-size: 15px; font-weight: bold; line-height: 16px;"><span class="Apple-style-span" style="font-size: 12px; font-weight: normal;"><span class="Apple-style-span" style="color: rgb(255, 0, 0);">> define command{ <br>> command_name win_service_restart <br>> command_line $USER1$/<span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="text-decoration: underline;"><span class="Apple-style-span" style="color: rgb(0, 51, 51);">check_nrpe</span></span></span> -H $HOSTADDRESS$ -p 5666 -c service_control -n -a <win_service_name> <restart> <br>> 
} </span></span></span><br><br>You have also get installed the nrpe on your nagios host, that provides the check_nrpe.<br><br>--<br>Fernando Rocha <fernando.rocha@opservices.com.br><br>OpServices - Porto Alegre - RS - Brasil<br>+55 51 3275.3588<br>www.opservices.com.br<br>www.opmon.org<br><br>----- "Anirudh Srinivasan" <srianirudh@gmail.com> wrote:
<br>> Hey Folks<div><br>> </div><div>I am currently working on event handlers to restart services on Windows machines</div><div><br>> </div><div>I have NC_Net installed on all client windows machines. I was looking at this plugin "<span class="Apple-style-span" style="color: rgb(51, 51, 46); font-size: 15px; font-weight: bold; line-height: 16px;">Windows Failed Service restart batch file" at Nagios Exchange.</span></div>
<div><span class="Apple-style-span" style="color: rgb(51, 51, 46); font-size: 15px; font-weight: bold; line-height: 16px;"><br>> </span></div><div><span class="Apple-style-span" style="color: rgb(51, 51, 46); font-size: 15px; font-weight: bold; line-height: 16px;"><span class="Apple-style-span" style="font-size: 12px; font-weight: normal;"><span class="Apple-style-span" style="color: rgb(255, 0, 0);">File: win_service_restart.cmd <br>> 
Author: Vadims Zenins <a href="http://vadimszenins.blogspot.com" target="_blank">http://vadimszenins.blogspot.com</a> <br>> Version: 1.03 <br>> Date:    16/12/2008 17:19 <br>> Windows Failed Service restart batch file for Nagios Event Handler <br>> 
<br>> Copy win_service_restart.cmd to \NSClient++\scripts\ folder. <br>> <br>> Nagios commands.cfg: <br>> define command{ <br>> command_name win_service_restart <br>> command_line $USER1$/<span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="text-decoration: underline;"><span class="Apple-style-span" style="color: rgb(0, 51, 51);">check_nrpe</span></span></span> -H $HOSTADDRESS$ -p 5666 -c win_service_restart -a "$SERVICEDESC$" $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ <br>> 
} <br>> <br>> Nagios template-services_common-win.cfg.cfg <br>> define service{ <br>> name generic-service-win-wuauserv <br>> service_description wuauserv <br>> display_name Automatic Updates <br>> event_handler win_service_restart <br>> 
event_handler_enabled 1 <br>> check_command check_nt!SERVICESTATE!-d SHOWALL -l $SERVICEDESC$ <br>> } <br>> <br>> NSCLIENT++ NSC.ini: <br>> [NRPE] <br>> allowed_hosts=<a href="http://192.168.1.1/32" target="_blank">192.168.1.1/32</a> ; your Nagios server IP <br>> 
allow_arguments=1 <br>> [External Script] <br>> allow_arguments=1 <br>> allow_nasty_meta_chars=1 <br>> [NRPE Handlers] <br>> command[win_service_restart]=scripts\win_service_restart.cmd "$ARG1$" $ARG2$ $ARG3$ $ARG4$</span> </span><br>> 
</span></div><div><span class="Apple-style-span" style="color: rgb(51, 51, 46); font-size: 12px; line-height: 16px;"><br>> </span></div><div><span class="Apple-style-span" style="color: rgb(51, 51, 46); font-size: 15px; line-height: 16px;">It uses check_nrpe at the commands.cfg file, but here we use check_nt . </span></div>
<div><span class="Apple-style-span" style="color: rgb(51, 51, 46); font-size: 15px; line-height: 16px;"><br>> </span></div><div><span class="Apple-style-span" style="color: rgb(51, 51, 46); font-size: 15px; line-height: 16px;">My question is,  will this work if i change it to check_nt .  Or is there any changes that has to be made. </span></div>
<div><span class="Apple-style-span" style="color: rgb(51, 51, 46); font-size: 15px; line-height: 16px;"><br>> </span></div><div><span class="Apple-style-span" style="color: rgb(51, 51, 46); font-size: 15px; line-height: 16px;">Can anyone please shed light on this .</span></div>
<div><br>> </div><div>- <br>> Anirudh Srinivasan<br>> <br>> 
</div>
<br>> ------------------------------------------------------------------------------
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<br>> _______________________________________________
Nagios-users mailing list
Nagios-users@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</div></body></html>