Page 1 of 1
client-side NRPE plugins for Linux
Posted: Fri Mar 11, 2016 3:38 pm
by dlukinski
Hello XI Support
Is there any manual available for existing NRPE client-side plugins for Linux?
Why needed: say I got this web-site
http://sites.box293.com/nagios/guides/c ... mory-usage
describing Check_Memory plugin I would like to use, where the current NRPE agent for linux plugin is "custom_check_mem" (without documentation).
How to work client-side plugins of interest and is there a manual and a repository of pluigins?
Example: do I require check_jmx to be client-side as well as server side if it uses NRPE?
How would I specify one in commands.cfg?
Thank you
Re: client-side NRPE plugins for Linux
Posted: Fri Mar 11, 2016 7:02 pm
by gormank
From the first check_nrpe line in the link:
check_nrpe -H 192.168.142.137 -t 30 -c CheckMEM...
That means its going to connect to the remote host (.137) on port 5666 by default and run the CheckMEM command defined in the remote hosts's nrpe.cfg. The command defines the script or binary executed on the remote host to get the data. The script or binary has to be on the remote host. This (transferring the script/binary to a bunch of remote hosts) can be a pain after a while, as can keeping that nrpe.cfg current.
When possible, pull data from the hosts rather than use NRPE--its less trouble to update. There are articles written on using puppet, etc. for keeping things up to date, so if you have a bunch of hosts look for that.
Look for Monitoring_Hosts_Using_NRPE.pdf
Regarding your example, I'd say no. NRPE is for running commands remotely.
commands.cfg is modified by adding/modifying commands in CCM.
There are lots of plugins defined by default that do most of what you want, but you may want to get some that aren't installed, or create some yourself. Google nagios plugins.
For the memory check you describe, try this:
# locate nrpe.cfg
/usr/local/nagios/etc/nrpe.cfg
# grep custom_check_mem /usr/local/nagios/etc/nrpe.cfg
# grep custom_check_mem /usr/local/nagios/etc/nrpe/common.cfg
command[check_mem]=/usr/local/nagios/libexec/custom_check_mem -n $ARG1$
common.cfg contains more commands, and is sourced by nrpe.cfg and check_mem is the command, while /usr/local/nagios/libexec/custom_check_mem is a script.
# file /usr/local/nagios/libexec/custom_check_mem
/usr/local/nagios/libexec/custom_check_mem: Bourne-Again shell script text executable
Your nagios service would use check_nrpe locally to ask the remote NRPE to run check_mem on the remote host, which then executes custom_check_mem and returns the exit status, and text output.
You can use CCM to define a service something like this:
check_nrpe -H <host> -t 30 -c check_mem <args>...
Just go to CCM, services, click add new, and select check_nrpe. Look at the args it wants. $ARG1$ will be check_mem, $ARG2$ other needed args.
Give it a name and a host to run on, and test.
I'd suggest using templates and hostgroups as you go, since trying to switch to a maintainable system after building one the other way is a hassle. I had to copy all my config files, create a few scripts to remove junk, delete things, then import them to get things right. Why?
Last night I needed to change the host check to work w/ IPv6, since the existing check didn't work w/ hosts added last night. I was able to change it in one template and update the host check on ~200 hosts...
Re: client-side NRPE plugins for Linux
Posted: Mon Mar 14, 2016 11:58 am
by rkennedy
Thanks @gormank!
@dlukinski - let us know if you have any further questions.
Re: client-side NRPE plugins for Linux
Posted: Fri Mar 18, 2016 7:13 pm
by dlukinski
rkennedy wrote:Thanks @gormank!
@dlukinski - let us know if you have any further questions.
I do have:
Looking at libexec content at client side and wondering if all the scripts could be used with NRPE (really?)
Also, (after reading XI manual), still wondering if there are "Nagios approved scripts" VS "3rd party who knows-must test scripts from exchange"
Linux Memory specific question did not get answered: current Memory check (same for SNMP) seem to show reserved RAM, we are looking at usage w/o reservations?
Re: client-side NRPE plugins for Linux
Posted: Mon Mar 21, 2016 1:03 pm
by lmiltchev
Looking at libexec content at client side and wondering if all the scripts could be used with NRPE (really?)
Also, (after reading XI manual), still wondering if there are "Nagios approved scripts" VS "3rd party who knows-must test scripts from exchange"
I don't see why you shouldn't be able to use these scripts with NRPE. What you have in the libexec directory is the official Nagios plugins. Many "non-official" (3rd party) plugins from the Nagios Exchange could be used as well with NRPE .
In any case, you will need to define a command, define a service, etc. To see how you can manage plugins in Nagios XI, please review the two documents listed here:
https://support.nagios.com/kb/article.php?id=235
Linux Memory specific question did not get answered: current Memory check (same for SNMP) seem to show reserved RAM, we are looking at usage w/o reservations?
Can you show us an example of what is your check's actual output, and what you expect it to be?
Re: client-side NRPE plugins for Linux
Posted: Sun Mar 27, 2016 6:49 pm
by dlukinski
lmiltchev wrote:Looking at libexec content at client side and wondering if all the scripts could be used with NRPE (really?)
Also, (after reading XI manual), still wondering if there are "Nagios approved scripts" VS "3rd party who knows-must test scripts from exchange"
I don't see why you shouldn't be able to use these scripts with NRPE. What you have in the libexec directory is the official Nagios plugins. Many "non-official" (3rd party) plugins from the Nagios Exchange could be used as well with NRPE .
In any case, you will need to define a command, define a service, etc. To see how you can manage plugins in Nagios XI, please review the two documents listed here:
https://support.nagios.com/kb/article.php?id=235
Linux Memory specific question did not get answered: current Memory check (same for SNMP) seem to show reserved RAM, we are looking at usage w/o reservations?
Can you show us an example of what is your check's actual output, and what you expect it to be?
---------------------------------------------------------------------------------------------------------------------------
Just wanted to confirm that NRPE Memory check interprets cached memory as not used. Because it is actually "to be released" memory.
Re: client-side NRPE plugins for Linux
Posted: Mon Mar 28, 2016 9:41 am
by lmiltchev
Just wanted to confirm that NRPE Memory check interprets cached memory as not used. Because it is actually "to be released" memory.
If you passed "-n" flag, it won't be used.
Here's the usage of the "custom_check_mem":
On the remote box:
Usage:
Code: Select all
[root@192 libexec]# ./custom_check_mem -h
Wrong Syntax: custom_check_mem -h
Usage: custom_check_mem [-w|--warning]<percent free> [-c|--critical]<percent free> [-n|--nocache]
Without passing "-n".
Code: Select all
[root@192 libexec]# ./custom_check_mem -w 20 -c 10
CRITICAL - 270 / 3962 MB (6%) Free Memory, Used: 3692 MB, Shared: 0 MB, Buffers: 169 MB, Cached: 728 MB | total=3962MB free=270MB used=3692MB shared=0 buffers=169MB cached=728MB
With "-n":
Code: Select all
[root@192 libexec]# ./custom_check_mem -w 20 -c 10 -n
OK - 1003 / 3962 MB (25%) Free Memory, Used: 3687 MB, Shared: 0 MB, Buffers: 169 MB, Cached: 728 MB | total=3962MB free=1003MB used=3687MB shared=0 buffers=169MB cached=728MB
Command definition (in "/usr/local/nagios/etc/nrpe/common.cfg"):
Code: Select all
command[check_mem]=/usr/local/nagios/libexec/custom_check_mem -n $ARG1$
In Nagios XI (from the CLI):
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -t 59 -c check_mem -a '-w 20 -c 10 -n'
OK - 1006 / 3962 MB (25%) Free Memory, Used: 3684 MB, Shared: 0 MB, Buffers: 169 MB, Cached: 728 MB | total=3962MB free=1006MB used=3684MB shared=0 buffers=169MB cached=728MB
More info:
https://support.nagios.com/wiki/index.p ... ree_Memory
Re: client-side NRPE plugins for Linux
Posted: Wed Apr 06, 2016 3:45 pm
by dlukinski
lmiltchev wrote:Just wanted to confirm that NRPE Memory check interprets cached memory as not used. Because it is actually "to be released" memory.
If you passed "-n" flag, it won't be used.
Here's the usage of the "custom_check_mem":
On the remote box:
Usage:
Code: Select all
[root@192 libexec]# ./custom_check_mem -h
Wrong Syntax: custom_check_mem -h
Usage: custom_check_mem [-w|--warning]<percent free> [-c|--critical]<percent free> [-n|--nocache]
Without passing "-n".
Code: Select all
[root@192 libexec]# ./custom_check_mem -w 20 -c 10
CRITICAL - 270 / 3962 MB (6%) Free Memory, Used: 3692 MB, Shared: 0 MB, Buffers: 169 MB, Cached: 728 MB | total=3962MB free=270MB used=3692MB shared=0 buffers=169MB cached=728MB
With "-n":
Code: Select all
[root@192 libexec]# ./custom_check_mem -w 20 -c 10 -n
OK - 1003 / 3962 MB (25%) Free Memory, Used: 3687 MB, Shared: 0 MB, Buffers: 169 MB, Cached: 728 MB | total=3962MB free=1003MB used=3687MB shared=0 buffers=169MB cached=728MB
Command definition (in "/usr/local/nagios/etc/nrpe/common.cfg"):
Code: Select all
command[check_mem]=/usr/local/nagios/libexec/custom_check_mem -n $ARG1$
In Nagios XI (from the CLI):
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -t 59 -c check_mem -a '-w 20 -c 10 -n'
OK - 1006 / 3962 MB (25%) Free Memory, Used: 3684 MB, Shared: 0 MB, Buffers: 169 MB, Cached: 728 MB | total=3962MB free=1006MB used=3684MB shared=0 buffers=169MB cached=728MB
More info:
https://support.nagios.com/wiki/index.p ... ree_Memory
Thank you
Please close this thread
Re: client-side NRPE plugins for Linux
Posted: Wed Apr 06, 2016 4:02 pm
by bwallace
Glad we were able to help. We'll lock this thread now and feel free to open another should you require assistance with anything else.