<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Verdana; font-size: 10pt; color: #000000'>if you need to restart a service in the windows, you can install the OpMon Agent downloaded from the following URL https://www.opservices.com.br/agentes . After installing the agent, create the
command: <br> check_nrpe -H $HOSTADDRESS$ 5666 -n -c service_control -a "NAME_OF_SERVICE" stop or start.<br><br><br><div>[]'s<br>--<br>Paulo Ribas<br>www.opservices.com.br<br></div><br><br>----- "Jonathan Williams" <jonathan.williams@us.g4s.com> wrote:
<br>> 




<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Courier New";
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>



<div class="Section1">

<p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">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)</span></font></p>

<p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";"> </span></font></p>

<p class="MsoNormal"><font face="Times New Roman" size="2" color="blue"><span style="font-size: 10pt; color: blue;">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)<br>> 
<br>> 
define service{<br>> 
host_name somehost<br>> 
service_description Server Service<br>> 
max_check_attempts 4<br>> 
event_handler restart_server<br>> 
}<br>> 
<br>> 
Than for the handler command:<br>> 
define command{<br>> 
command_name restart-httpd<br>> 
(This is where I am unsure. Do I give it a path to the .bat file?)<br>> 
<br>> 
Is nagios able to run this file from the host PC. In these linux script examples
I am unsure if the script is on the Nagios server of the host server. Any help
would be awesome. Hopefully I'm close to accurate here.</span></font></p>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> </span></font></p>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">I got a reply:</span></font></p>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> </span></font></p>

<p class="MsoNormal"><font face="Times New Roman" size="2" color="blue"><span style="font-size: 10pt; color: blue;">You can use NRPE/NSClient++ and instead of
using it to run remote scripts to check something, use it to restart your
services. See</span></font><br>> 
<br>> 
<a href="http://nagios.sourceforge.net/docs/3_0/monitoring-windows.html" target="_blank">http://nagios.sourceforge.net/docs/3_0/monitoring-windows.html</a><br>> 
<a href="http://trac.nakednuns.org/nscp/" target="_blank">http://trac.nakednuns.org/nscp/</a></p>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> </span></font></p>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">However still cant get NSClient to start the service.  The links
provided detail how to set up monitor host services. This works great. However
I cannot get the NSCLient++ to actually restart the service. I edited the
NSC.INI file to comment out the "check_all_services" section and have
the values set to "started" however it still shows the service as
stopped and it will not restart it. I am assuming there is a step I am missing
in this in some config file somewhere. Any help would be greatly appreciated as
I am under a deadline to have this up by this weekend. Management thought this
would be easier than it is and gave me two days.</span></font></p>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> </span></font></p>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">Any help on what I am missing would be greatly appreciated.</span></font></p>

<p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";"> </span></font></p>

<p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";"> </span></font></p>

<p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">Jonathan Williams</span></font></p>

<p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">Sr. Systems Administrator</span></font></p>

<p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">G4S Justice Services, Inc.</span></font></p>

<p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";">Tel: 800.589.6003 ext 1308</span></font></p>

<p class="MsoNormal"><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: "Courier New";"><a href="mailto:jonathan.williams@us.g4s.com" target="_blank">jonathan.williams@us.g4s.com</a></span></font></p>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> </span></font></p>

</div>

<br>> -------------------------------------------------------------------------
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<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</jonathan.williams@us.g4s.com></div></body></html>