Page 1 of 2
how to install NRPE check plugin for Windows
Posted: Thu Aug 25, 2016 10:56 am
by caterpillartce
Hello,
I followed this doc to upload a plugin (a .pl script):
https://assets.nagios.com/downloads/nag ... ios-XI.pdf, but it is not working:
1. I got "command not found" error on every line of the script. It looked like Nagios didn't know this is a perl script if I just put the script name in the command definition without specifically calling perl.
2. I can't manually run it in command line even if I use "perl script.pl" to explicitly tell Linux this is a perl script as it errors out on the line of "Use Win32"....
Maybe I am doing this completely wrong and I should put the script (there is also an exe version, which I couldn't upload via Nagios web interface) on the windows server side that is being monitored?
I read the doc about NRPE (
http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf ) but got confused as it is talking about Linux and all my servers being monitored (except for the Nagios XI server itself) are Windows servers...
Please advise.
Thank you!
Re: how to install NRPE check plugin for Windows
Posted: Thu Aug 25, 2016 11:23 am
by lmiltchev
You can use NSClient++ with check_nrpe to call a "custom" script on the Windows machine. Place the script in the NSClient++ scripts directory, define a command in the nsclient.ini file, and test it from the command line on the Nagios XI server.
Example:
Command defined in the nsclient.ini:
Code: Select all
check_winprocess=scripts\check_winprocess.exe $ARG1$
Testing from Nagios XI server:
Code: Select all
[root@localhost tmp]# /usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_winprocess -a '--warn 100 --critical 300'
PROCESS OK - 99 process(es)|'processes'=99;100;300
Re: how to install NRPE check plugin for Windows
Posted: Thu Aug 25, 2016 11:37 am
by caterpillartce
Correct me if I am wrong... but I thought plugins uploaded to Nagios server would allow me to be able to execute it to the servers being monitored from a central location on the Nagios server? We have many servers and "central location" is very attractive in terms of easier deployment...
If I have to use scripts on the servers being monitored, I will... but do I still need to upload plugin (check_winprocess in below example), create command on the Nagios side? Or do I just need to define service with check_nrpe as the command?
Thanks!!
Re: how to install NRPE check plugin for Windows
Posted: Thu Aug 25, 2016 12:01 pm
by lmiltchev
You can monitor many Windows systems from a "central" location (your Nagios XI server). In order to monitor metrics, you will need to install an agent on the clients (Windows machines). NSClient++ is one of these agents that you can use. It can be used with
check_nt and/or
check_nrpe checks. It includes many checks by default - cpu, memory, disk, etc. If you want to only monitor "basic" stuff, you don't need to copy over any other scripts. I gave you an example about using a "custom" script with NSClient++ as it seemed to me that this is what you were trying to accomplish.
You can download the NSClient++ for Windows here:
https://nsclient.org/download/
Install it on your clients, then simply run the "Windows Server" wizard in Nagios XI against each of the clients. This will get you started. Let us know if you have any more questions.
Here's a few links that can help:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
https://assets.nagios.com/downloads/nag ... -0.3.x.pdf
Re: how to install NRPE check plugin for Windows
Posted: Thu Aug 25, 2016 1:42 pm
by caterpillartce
Yes I already have the agent installed, hosts and many services created. I don't have problem with those. I just don't understand why I couldn't upload this plugin and make it work for all my servers, instead I need to configure on each server being monitored...
Oh well,
Following your advice, I put the script on the windows server, modified nsclient.ini, restarted nsclient.
I am then trying to create a service to run the script but I just can't figure out how to pass on the parameters...
This is what I have in the nsclient.ini (I tried with $ARG1$ here too):
[/settings/external scripts/scripts]
check_winprocess = scripts\check_winprocess\check_winprocess.exe
This is what I have in the service:
Check Command: check_nrpe
$ARG1$: check_winprocess --filter "services eq Teamcenter DispatcherClient V10000.1.0.41_20150609.00" --filter "memusage gt 500000" --warning 0
On the Windows server, I can execute below command and get the desired result:
check_winprocess --filter "services eq Teamcenter DispatcherClient V10000.1.0.41_20150609.00" --filter "memusage gt 500000" --warning 0
BUT Nagios doesn't seem to recognize the format of the command with parameters.
I tried different combinations - putting single quotes in $ARG1$; dividing it to 2 arguments with $ARG1$ as check_winprocess and $ARG2$ as the parameters (arguments) to check_winprocess; adding single quotes here and there hoping Nagios can simply pass the parameters on to the check_winprocess script... all failed.
So how should I do this? I need the 3 parameters (arguments) for check_winprocess.
Thanks again for your continued support!
Re: how to install NRPE check plugin for Windows
Posted: Thu Aug 25, 2016 4:02 pm
by tgriep
Did you set the command like the example below in your nsclient.ini file for the arguments?
Code: Select all
check_winprocess = scripts\check_winprocess\check_winprocess.exe //T:30 //NoLogo $ARG1$
Can you post the service config from the XI server and the error you are receiving?
Re: how to install NRPE check plugin for Windows
Posted: Thu Aug 25, 2016 9:12 pm
by caterpillartce
ok, I changed nsclient.ini to be exactly like yours and here is the service cfg file (attached). The error is like Nagios is showing me the correct usage of check_nrpe:
COMMAND: /usr/local/nagios/libexec/check_nrpe -H a2wvtstt01.mw.na.cat.com -t 300 -c check_winprocess '--filter \"services eq Teamcenter DispatcherClient V10000.1.0.41_20150609.00\" --filter \"memusage gt 500000\" --warning 0'
OUTPUT:
NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad (
[email protected])
Version: 2.15
Last Modified: 09-06-2013
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required
Usage: check_nrpe -H <host> [ -b <bindaddr> ] [-4] [-6] [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]
Re: how to install NRPE check plugin for Windows
Posted: Thu Aug 25, 2016 10:14 pm
by Box293
NPRE requires you to use
-a to send the arguments.
Try:
$ARG1$:
Code: Select all
check_winprocess -a --filter "services eq Teamcenter DispatcherClient V10000.1.0.41_20150609.00" --filter "memusage gt 500000" --warning 0
Re: how to install NRPE check plugin for Windows
Posted: Fri Aug 26, 2016 9:56 am
by caterpillartce
I got the same error with -a:
Testing check from command line...
COMMAND: /usr/local/nagios/libexec/check_nrpe -H a2wvtstt01.mw.na.cat.com -t 300 -c check_winprocess -a --filter "services eq Teamcenter DispatcherClient V10000.1.0.41_20150609.00" --filter "memusage gt 500000" --warning 0
OUTPUT:
NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad (
[email protected])
Version: 2.15
Last Modified: 09-06-2013
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required
Usage: check_nrpe -H <host> [ -b <bindaddr> ] [-4] [-6] [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]
Re: how to install NRPE check plugin for Windows
Posted: Fri Aug 26, 2016 10:01 am
by caterpillartce
And adding single quotes around the parameters didn't help either:
Testing check from command line...
COMMAND: /usr/local/nagios/libexec/check_nrpe -H a2wvtstt01.mw.na.cat.com -t 300 -c check_winprocess -a '--filter \"services eq Teamcenter DispatcherClient V10000.1.0.41_20150609.00\"' '--filter \"memusage gt 500000\"' '--warning 0'
OUTPUT:
NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad (
[email protected])
Version: 2.15
Last Modified: 09-06-2013
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required
Usage: check_nrpe -H <host> [ -b <bindaddr> ] [-4] [-6] [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]