Page 1 of 1
Help on installing NRPE add-on / plugin
Posted: Fri Jul 01, 2016 4:19 am
by mhunt
I'm running Nagios Core 4.4.4, and can't figure out how to add in an NRPE plugin. Specifically, I'm trying to install the "Check Windows Processes - TK". I've read over the documentation on it, but I can't find any documentation on where to actually put the files such as "check_winprocess.exe", "check_winprocess.pl". I'm assuming check_winprocess.exe MIGHT go into the NSClient++ directory (since this is were check_nrpe.exe is), but I'm not sure where the pl file goes. I'm thinking it might go into the /usr/local/nagios/libexec/ directory on the Nagios server...that's the location of all the other check_whatever files are, but none of them are .pl files. I've read over how to update the commands.cfg to add in new commands, but none of the files in libexec have a .pl extension.
I can't seem to find any clear-cut tutorials on installing these add-ins / plug-ins...since I just installed the Nagios Core and it doesn't have the plug-in installer front-end like described in
https://assets.nagios.com/downloads/nag ... ios-XI.pdf. Is there a way to update from the core to XI to get the web front-end?
Re: Help on installing NRPE add-on / plugin
Posted: Mon Jul 04, 2016 1:11 am
by Box293
Any scripts you want to run need to go into the
C:\Program Files\NSClient++\scripts folder on the Windows server.
This guide, while it is for Nagios XI, explains how to add a script to NSClient config file:
https://support.nagios.com/kb/article.php?id=268
mhunt wrote: I'm thinking it might go into the /usr/local/nagios/libexec/ directory on the Nagios server...that's the location of all the other check_whatever files are, but none of them are .pl files. I've read over how to update the commands.cfg to add in new commands, but none of the files in libexec have a .pl extension.
Yes, plugins that run directly from the Nagios server go into the /usr/local/nagios/libexec/ directory. All the plugins that currently exist are complied ones whereas the one you are referencing is a perl script. A pythin script might end with .py and a bash script might end with .sh. All of this is normal. Adding a command to your commands.cfg is the same regadless what extension it has, if the file has an extension, reference it in the command definition.
Generally though you probably won't use the .pl file on the nagios server. The .exe file will be on the windows server and you'll define the command to be used in the nsclient.ini file and from Nagios you will check it via check_npre.
mhunt wrote:I can't seem to find any clear-cut tutorials on installing these add-ins / plug-ins...since I just installed the Nagios Core and it doesn't have the plug-in installer front-end like described in
https://assets.nagios.com/downloads/nag ... ios-XI.pdf. Is there a way to update from the core to XI to get the web front-end?
Nagios XI is the paid version, hence it has all the bells and whistles which makes getting started with Nagios so much easier. You can download the XI appliance and try it free for 60 days.
Otherwise try looking on the Nagios Exchange for other front end programs to Nagios Core that add this functionality.
https://exchange.nagios.org/directory/A ... Interfaces
What exactly are you trying to achieve, what are you wanting to monitor on the windows server? We might have an easier solution, or perhaps NSClient++ has it built into the modules. Sometimes when starting with Nagios it can be easy to get distracted down a rabbit hole when there is an easy way, you just didn't find that easy way through google

(especially when using just core)
Here's some guides on NSClient++ and what it is capable of:
http://sites.box293.com/nagios/guides/n ... dows/0-4-x
http://sites.box293.com/nagios/guides/n ... t-ini-file
http://sites.box293.com/nagios/guides/n ... core-4-0-x
http://sites.box293.com/nagios/guides/common-checks
Re: Help on installing NRPE add-on / plugin
Posted: Sun Jul 10, 2016 12:44 pm
by mhunt
I'm looking to replace the report of "Explorer.exe is not running" on a W2012 box. My research on it says it's getting that error because if no one is logged in, then explorer.exe won't be running. I'm going to have to comment this check out, which should be easy. But I want to replace it with something more useful; like a check for System (ntoskrnl.exe) is running instead. That's why I was looking into the check_winprocess from
https://www.itefix.net/check_winprocess. The site says its a "NRPE check plugin for Windows processes", and I found
https://www.itefix.net/content/checkwinprocessexe that has some examples. I found the filter aurgments come from tasklist (
https://technet.microsoft.com/en-us/lib ... 91010.aspx), so something like command = check_winprocess.exe --filter "imagename eq system" should work.
The link you gave goes to "Nagios XI - How to Restart A Windows Service With NRPE". I found
https://docs.nsclient.org/0.4.4/howto/e ... ripts.html that seems to have all the info I need, I'm trying to grok it right now. The .exe needs to go into C:\Program Files\NSClient++\scripts? And the .py goes on the server in /usr/local/nagios/libexec/? Do I even need the .py on the Nagios server at all, since I'm going to configure the client to call the client-side exe? I think I need to add into the nsclient.ini:
[/settings/external scripts/scripts]
check_winprocess=scripts\check_winprocess.exe
I found
http://www.howdididothat.info/2013/12/0 ... -commands/ with some examples, but I'm still pretty confused on how/what to add into commands.cfg to get check_nrpe to call check_winprocess...
If there is another, built-in command I can use to check the System process, please let me know!
Re: Help on installing NRPE add-on / plugin
Posted: Mon Jul 11, 2016 10:41 am
by lmiltchev
Change your command in the nsclient.ini from this:
Code: Select all
check_winprocess=scripts\check_winprocess.exe
to this:
Code: Select all
check_winprocess=scripts\check_winprocess.exe $ARG1$
and restart NSClient++ service on the Windows server.
Test it from the command line on the Nagios box by running something like this:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H <client ip> -c check_winprocess -a '--filter "imagename eq explorer.exe"'
or
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H <client ip> -c check_winprocess -a '--filter "imagename eq ntoskrnl.exe"'
or
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H 192.168.5.18 -c check_winprocess -a '--filter "services eq <service name>"'
Let us know if you have any more questions.
Re: Help on installing NRPE add-on / plugin
Posted: Mon Jul 11, 2016 1:18 pm
by mhunt
Thank you for the quick response! I've got it working! In the .cfg, I had to put:
check_command check_nrpe!check_winprocess!--filter "imagename eq wininit.exe"'
and it's now showing as green on my monitoring web page!
In case anyone else is reading this, there are several other nsclient.ini changes that must be made:
around line 40:
[/settings/NRPE/server]
allow arguments = 1
around line 37:
[/settings/NRPE/server]
allow nasty characters = 1
around line 251:
[/settings/external scripts]
allow nasty characters = 1
around line 254:
[/settings/external scripts]
allowed arguments = 1
Since you asked earlier, I've installed this to learn how to configure Nagios. A job I applied for (and just received an offer for, I have accepted!) mentioned they might be switching over to Nagios for their monitoring...so I've been working on this as a precursor to the position. Hopefully, since their a decently large multi-national corp, they will just purchase the Nagios XI and not go with only the bare-bones Core! Still, knowing how it all works under the hood will help immensely when we do decide to implement. I can also tell my boss just how quickly you guys answer questions for even the "free" Core support!
Re: Help on installing NRPE add-on / plugin
Posted: Mon Jul 11, 2016 1:24 pm
by mcapra
Thanks for sharing your solution!
Core is certainly a powerful application, but if you're not an absolute wizard with it Nagios XI can save an awful lot of work hours.
Is it alright if I lock this thread and mark the issue as resolved?
Re: Help on installing NRPE add-on / plugin
Posted: Tue Jul 12, 2016 7:37 am
by mhunt
Yes, lock and mark! Issue resolved!