eventhandler - remote script execution - SUMMARY

Richard Shaw useofweapons at gmail.com
Fri Dec 10 10:45:34 CET 2004


Thanks very much to :

Nathan Oyler
Steve Shipway
sushildeshmukh

I ended up using nrpe_nt from http://www.miwi-dv.com/nrpent.  Wrote a
small batch script on my problematic server to restart the service,
which i then added to the nrpe\bin\nrpe.cfg. Configured up the port,
server address and allowed_hosts.

command[check_cfcycle]=c:\nrpe\bin\cfcycle.bat

Then defined the command in checkcommands.cfg on the nagios server:

define command{
    command_name check_cfcycle
    command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_cfcycle
}


and added the event_handler to the services.cfg:

define service{
       use                             generic-service 
       host_name                       box.example.com
       service_description             HTTP
       is_volatile                     0
       check_period                    24x7
       max_check_attempts              3
       normal_check_interval           2
       retry_check_interval            1
       contact_groups                  Admins
       notification_interval           240
       notification_period             24x7
       notification_options            w,u,c,r
       check_command                   check_http
       event_handler                   check_cfcycle
      }


Et voila, all worked.  

http://nagios.sourceforge.net/docs/1_0/eventhandlers.html

Thanks again

Richard

On Fri, 10 Dec 2004 09:33:53 +1300, Steve Shipway
<s.shipway at auckland.ac.nz> wrote:
> > I would like to - on an alert, to have nagios execute a script on a
> > remote win32 machine to restart a problematic service.
> 
> Here, we do this by using:
> 1) pNSclient 2.0.1 agent on the server monitors the windows service
> 2) Nagios has event handler calling a short shellscript that calls
> check_nrpe
> 3) NRPE_nt agent on server catches nrpe request and runs restart script
> 4) service restarts!
> 
> The restart script is something very simple -- just 'net start %1%' -- and
> the shellscript at (2) parses the Service Description to obtain the
> servicename which is passed to check_nrpe as a parameter.
> 
> It means having 2 agents on the server (pnsclient, nrpe_nt) though --
> actually 3, since we also have the eventlog-nsca daemon running.  They're
> fairly small footprints, though.
> 
> We're using it here in pre-production, working fine.
> 
> Steve
> 
> ---
> Steve Shipway: ITSS, University of Auckland
> Email: s.shipway at auckland.ac.nz  Web: http://www.steveshipway.org/
> ** We can only discover new oceans when we have the **
> ** courage to lose sight of the shore.              **
> 
> 
>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
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