nagios reboot XP

Hari Sekhon hpsekhon at googlemail.com
Thu May 8 13:37:49 CEST 2008


Palle L Jensen wrote:
>
> I guess I should have been more specific, sorry about that.
>
> I am running Nagios 3.0.1 on openSUSE 10.3, and I am only monitoring 
> windows hosts. On the windows hosts I am running NSClient++. That 
> seems to work good and I would prefer not to change to any other client.
>
> I have read about the event handlers in the Nagios documentation, but 
> the samples there only refers to nrpe and scripts on the server. I 
> understand how to define the service in Nagios, but I am not sure how 
> to create the script that executes the batch file on the windows host? 
> Maybe I am not getting the point and understanding on the documentation.
>
> Lets say I created a batch file that will start or restart a service, 
> this batch file is located in c:\NSclient++\scripts folder. And then 
> defined the service and command in Nagios:
>
> define service{
>         host_name              somehost
>         service_description    sql-service
>         max_check_attempts     4
>         event_handler          restart-sqlagent
>         }
>
> define command{
>         command_name   restart-sqlagent
>         command_line   what do I add here?? It has to be something that can be sent to the Nsclient++/windows host and execute the batch script in c:\NSclient++\scripts folder
>         }
>
> The command line on the eventhandler documentation shows a path to a 
> local script and local command “/etc/rc.d/init.d/httpd restart”
>
> So creating and event handler for services or others on the box where 
> Nagios is running, I understand. But not how to do it remotely to a 
> windows host.
>
> If you could shed some more light over this I would very much 
> appreciate it.
>
> Thanks,
>
> PJ
>
You need a Unix-side script to execute and handle the condition 
appropriately, for example to only call the restart when the service is 
in hard failure. A sample Bash script is given in the docs to get you 
started.

If using Bash (which I recommend) the Bash script should check the state 
and perform the logic control, calling the batch or script on the 
windows side though an NRPE call to nsclient++ to execute the script on 
the windows host.

-h

-- 
Hari Sekhon


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
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