nrpe to a Windows box through event_handlers ...

Martin Mielke martin.mielke at thales-is.com
Fri Jul 9 12:03:00 CEST 2004


Hi list,

here's another email from Ludo, who's having problems to post but still 
being so nice to reply.
I have to read it through again but I just post it for you to have it 
and, maybe, think about it...

Regards,
Martin


-------- Original Message --------
Subject: 	RE: [Nagios-users] nrpe to a Windows box through 
event_handlers ...
Date: 	Fri, 9 Jul 2004 10:25:51 +0200
From: 	Ludo Bosmans <Ludo.Bosmans at ictbutler.be>
To: 	Martin Mielke <martin.mielke at thales-is.com>



Martin,

I'm still unable to reply with my normal e-mail address, so i thank you to forward this to the mailinglist.
Some additional info:


--------------------
# services.cfg
--------------------
# Service definition                                                            
define service{                                                                 
        use                             generic-service         ; Name of service template to use                                                               
        use                             generic-windows-services                
                                                                                
        host_name                       rataplan                                
        service_description             Windows Services                        
        is_volatile                     0                                       
        check_period                    24x7                                    
        max_check_attempts              3                                       
        normal_check_interval           5                                       
        retry_check_interval            1                                       
        contact_groups                  nt-admins                               
        notification_interval           0                                       
        notification_period             24x7                                    
        notification_options            w,u,c,r                                 
        check_command                   check_nt_services_parse                 
        event_handler                   event_nrpe_nt_parse                     
        }                                                                       

---------------------
#checkcommands.cfg
---------------------
# 'check_nt_services_parse' command definition                                  
define command{                                                                 
        command_name    check_nt_services_parse                                 
        command_line    $USER1$/check_nt_services_parse.sh $HOSTNAME$ $HOSTADDRESS$ "$SERVICEDESC$" $USER1$                                                     
        }                                                                       


# 'event_nrpe_nt_parse' command definition                                      
define command{                                                                 
        command_name    event_nrpe_nt_parse                                     
        command_line    $USER1$/event_nrpe_nt_parse.sh $HOSTNAME$ $HOSTADDRESS$ "$SERVICEDESC$" "$OUTPUT$" "$SERVICESTATE$"                                     
        }                                                                       

In my case, i check several "windows services" in one sequence on host rataplan. This check is is based on check_nt. I pass some arguments from the nagios environment to a shell script "check_nt_services_parse.sh" that finally is using check_nt to get info and status of the "windows" service.
In fact it doen't matter how you obtain status info, it could also something else.

In case a certain "window service" is stopped, the check returns "CRITICAL" ($SERVICESTATE$ ). So following the specs the eventhandler is executed.  
Again this is a shell script that obtain the necessary variables from the nagios environment and finally execute check_nrpe_nt with a request to execute a command on host rataplan. f.e. to try to restart SPOOLER or something else.
So the max_check_attempts is put to 3, and retry_check_interval to 1 ( min ). This means the eventhandler is runned only when there is a state change ( ok to bad, warning to critical or critical to warning, on recovery ). That's why i pass the $SERVICESTATE$ and check inside the event_nrpe_nt_parse.sh script to see if i need to try to restart ( CRITICAL ) or not ( OK or RECOVERY ).
Finally if after a restart attempt the servicestate is still critical ( in my case i have only ok or critical ), the evethandler is not executed anymore and the service status becomes a hard critical state.
Again i mentioned that the eventhandler is not executed anymore on the next regulary check in case next check return the same bad state.

I hope this info will give you a better view how i have handled this.

kind regards,

ludo


-----Original Message-----
From: nagios-users-admin at lists.sourceforge.net
[mailto:nagios-users-admin at lists.sourceforge.net]On Behalf Of Martin
Mielke
Sent: vrijdag 9 juli 2004 09:22
To: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] nrpe to a Windows box through event_handlers
...


Hi Ludo,

I'll post to the list, so everybody can get your answer as well...


Ludo Bosmans wrote:

>Martin,
>
>Sorry to answer not via the Nagios-users list. Currently i'm unable to reply with my registered e-mail address. So my message will be refused.
>  
>

OK. Thanks for the reply.

>Use the check_nt plugin to see if a service is running or stopped.
>( this requires nsclient service running on the windows server )
>
>  
>

Well, the service is just an ASP server. To check for its availability
we use check_http with the -e switch...

>Create an eventhandler that restart the specific service on the windows. 
>You need nrpe_nt on the windows server. 
>  
>

Yep, that was already know. My problem is that I don't know how to
combine the event_handlers to launch a .bat file through the nrpe_nt to
restart the service on the Windoze side...

>So the idea is to check regulary if a certain service is up or down, with lets say max 3 retries. In case the service is down, you start an event-handler that request via check_nrpr to execute a command on the windows. This could be a .bat file with f.e. net start SPOOLER
>  
>

Yes, that's my initial thought...

Thanks in advance!


Best regards,
Martin




-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.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




-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.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