<div>Hi Paul,</div>
<div> </div>
<div>I think you need to split your issues into seperate posts,</div>
<div> </div>
<div>I have not worked a lot with event Handlers in Nagios yet, so I willo not be able to help with that,</div>
<div> </div>
<div>BUt I can help on the NC_NEt side of the issue.</div>
<div>first, create the script, (make sure you are using the most recent version of NC_NEt and check_nc_Net due to a few bug fixes and other options enabled in the most recent version.</div>
<div>your script should print to standard output, and should have an exit code.</div>
<div>make sure the script is in the Script folder of NC_NET. </div>
<div>IF you want to pass arguments to the script you must modify the Startup.cfg of NC_NET in order for the Arguments to be accepted.</div>
<div>on a simplest case, you can try to hardcode the script as a BAT file simply running a command like </div>
<div>net start xyzservice</div>
<div>to test the script call it using Check_nt/check_nc_net</div>
<div>if the script runs from the command line, then you need to start worrying about getting the Event Handler running,</div>
<div>For that, make sure to read the Nagios Documentation I thought the example was oK in it. </div>
<div>WHen running the event handler make sure only to run it on the proper state, also make sure you do not have your retry interval to close together, sometimes it takes 20 sec or longer to restart a service. thus int he check_nt command make sure to have long enough timeouts for your command.
</div>
<div> </div>
<div>If you get the problem down to just the event handler aspect of it, then you may want to repost with a new subject and description for just the event handler. </div>
<div> </div>
<div>good Luck,</div>
<div>Tony (author of NC_NEt) <br><br> </div>
<div><span class="gmail_quote">On 7/20/07, <b class="gmail_sendername">Paul Broadwith</b> <<a href="mailto:paul.broadwith@blueivy.co.uk">paul.broadwith@blueivy.co.uk</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi,<br><br>I've moved from NSCLient++ to NC_NET and trying to get the external<br>scripts working.<br>
<br>I've created an event_handler in the nagios config, I've created the<br>script and the script is run when the service goes up or down. However<br>teh script stops and restarts all of the relevant services. I only want
<br>this to happen when the service is down, however Nagios runs it when it<br>changes state (which I believe is correct behaviour).<br><br>>From reading the Nagios docs, external scripts must be able to take the<br>following parameters $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$,
<br>and I was going to use one of them to check the state (ie. If it is<br>critical, stop and start the services, if it's not, then don't). however<br>I'm unsure how to pass this to the external script through NC_NET. In
<br>the Nagios log, the following is shown<br><br>===<br>SERVICE EVENT HANDLER: BLUDCSHIG001;Exchange<br>Services;OK;HARD;3;run_remote_script!"restartexchange.cmd $SERVICESTATE$<br>$SERVICESTATETYPE$ $SERVICEATTEMPT$"
<br>===<br><br>I've redirected the args in the .cmd file running on the Windows machine<br>to a text file so I can see them and nothing is being passed.<br><br>Any ideas? Any other ways to do this?<br><br>Kind regards,
<br><br>Paul Broadwith MBCS<br>Blue Ivy Ltd - Microsoft Small Business Specialist, UK Partner Qualified<br>for 2007<br><br>Tel.: 0800 612 0601<br>Windows Messenger: <a href="mailto:paul.broadwith@blueivy.co.uk">paul.broadwith@blueivy.co.uk
</a><br>Web: <a href="http://www.blueivy.co.uk">http://www.blueivy.co.uk</a><br><br><br><br>----------------------------------------------------------------------------------------------------------------------------------------------
<br><br>Blue Ivy Limited is a limited company registered in Scotland.<br>Registered company number: SC 221649. Registered VAT number: GB 774 8460 88.<br>Registered Office: 67 Kelburn Street, Barrhead, Glasgow, G78 1LD<br>
<br>This message and any associated files is intended only for the use of <a href="mailto:nagios-users@lists.sourceforge.net">nagios-users@lists.sourceforge.net</a> and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not
<a href="mailto:nagios-users@lists.sourceforge.net">nagios-users@lists.sourceforge.net</a> you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify
<a href="mailto:paul.broadwith@blueivy.co.uk">paul.broadwith@blueivy.co.uk</a> immediately by replying to the message and then deleting it from your computer.<br><br>Any views or opinions presented are solely those of the author
<a href="mailto:paul.broadwith@blueivy.co.uk">paul.broadwith@blueivy.co.uk</a> and do not necessarily represent those of the company.<br><br>----------------------------------------------------------------------------------------------------------------------------------------------
<br><br><br>-------------------------------------------------------------------------<br>This SF.net email is sponsored by: Microsoft<br>Defy all challenges. Microsoft(R) Visual Studio 2005.<br><a href="http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/">
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/</a><br>_______________________________________________<br>Nagios-users mailing list<br><a href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net
</a><br><a href="https://lists.sourceforge.net/lists/listinfo/nagios-users">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
<br>::: Messages without supporting info will risk being sent to /dev/null<br></blockquote></div><br>