Hi Paul,

I think you need to split your issues into seperate posts,

I have not worked a lot with event Handlers in Nagios yet, so I willo not be
able to help with that,

BUt I can help on the NC_NEt side of the issue.
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.
your script should print to standard output, and should have an exit code.
make sure the script is in the Script folder of NC_NET.
IF you want to pass arguments to the script you must modify the
Startup.cfgof NC_NET in order for the Arguments to be accepted.
on a simplest case, you can try to hardcode the script as a BAT file simply
running a command like
net start xyzservice
to test the script call it using Check_nt/check_nc_net
if the script runs from the command line, then you need to start worrying
about getting the Event Handler running,
For that, make sure to read the Nagios Documentation I thought the example
was oK in it.
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.

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.

good Luck,
Tony (author of NC_NEt)


On 7/20/07, Paul Broadwith <[EMAIL PROTECTED]> wrote:

Hi,

I've moved from NSCLient++ to NC_NET and trying to get the external
scripts working.

I've created an event_handler in the nagios config, I've created the
script and the script is run when the service goes up or down. However
teh script stops and restarts all of the relevant services. I only want
this to happen when the service is down, however Nagios runs it when it
changes state (which I believe is correct behaviour).

>From reading the Nagios docs, external scripts must be able to take the
following parameters $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$,
and I was going to use one of them to check the state (ie. If it is
critical, stop and start the services, if it's not, then don't). however
I'm unsure how to pass this to the external script through NC_NET. In
the Nagios log, the following is shown

===
SERVICE EVENT HANDLER: BLUDCSHIG001;Exchange
Services;OK;HARD;3;run_remote_script!"restartexchange.cmd $SERVICESTATE$
$SERVICESTATETYPE$ $SERVICEATTEMPT$"
===

I've redirected the args in the .cmd file running on the Windows machine
to a text file so I can see them and nothing is being passed.

Any ideas? Any other ways to do this?

Kind regards,

Paul Broadwith MBCS
Blue Ivy Ltd - Microsoft Small Business Specialist, UK Partner Qualified
for 2007

Tel.: 0800 612 0601
Windows Messenger: [EMAIL PROTECTED]
Web: http://www.blueivy.co.uk




----------------------------------------------------------------------------------------------------------------------------------------------

Blue Ivy Limited is a limited company registered in Scotland.
Registered company number: SC 221649.  Registered VAT number: GB 774 8460
88.
Registered Office: 67 Kelburn Street, Barrhead, Glasgow, G78 1LD

This message and any associated files is intended only for the use of
nagios-users@lists.sourceforge.net and may contain information that is
confidential, subject to copyright or constitutes a trade secret. If you are
not nagios-users@lists.sourceforge.net 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 [EMAIL PROTECTED] immediately by
replying to the message and then deleting it from your computer.

Any views or opinions presented are solely those of the author
[EMAIL PROTECTED] and do not necessarily represent those of the
company.


----------------------------------------------------------------------------------------------------------------------------------------------


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
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

Reply via email to