>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. The NSClient++ data collector's primary mechanism for actions (getting it to do stuff) is via NRPE. It will respond to the old nsclient command as well but the majority of it's functions are utilized through NRPE. This is the case with your situation as well. On the Nagios side you would define a check like you have above and in the NSC.ini file you define a handler for the command. Below is an example of one we use to check the CPU utilization of any process on the server. On the Nagios server define your service as above and use something like this for the command_line line. Command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 60 -c wmi_process_perf -a $ARG1$ On the Windows server in the NSC.ini file under the NRPE Handlers section put something like this: wmi_process_perf=c:\windows\system32\cscript.exe //nologo "c:\program files\nsclient++\scripts\wmi_cpu_perf.vbs" /process:$ARG1$ In this example the $ARG1$ value is the name of a running process on the server. The check returns the CPU and memory utilization of the process. HTH, -greg ------------------------------------------------------------------------- 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@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