Error when setting up nrpe custom_check_mem

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
MechanicalPopsicle
Posts: 2
Joined: Wed Aug 14, 2019 9:35 am

Error when setting up nrpe custom_check_mem

Post by MechanicalPopsicle »

I'm adding a service to existing host with currently working nrpe services. I can run the command locally on the host. When I try it remotely I get a couple different errors.
I tried running this manually from nagios server with multiple arguments including those on the KB article here https://support.nagios.com/kb/article/m ... s-774.html:

./check_nrpe -H x.x.x.x -t 30 -c custom_check_mem -a 'warn=free<20%' 'crit=free<10%'

Now I've tried this with multiple arguments and the "check_memory" command doesn't exist on the host nrpe client (but custom_check_mem does)

I get either "NRPE: Command 'custom_check_mem' not defined" or as with the exact command above "CHECK_NRPE: Receive header underflow - only 0 bytes received (4 expected)."

New to nagios - any help appreciated.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Error when setting up nrpe custom_check_mem

Post by scottwilkerson »

Can you show the custom_check_mem configuration line in the nrpe.cfg file on the remote system?

this error makes it look like it doesn't exist
MechanicalPopsicle wrote:I get either "NRPE: Command 'custom_check_mem' not defined"
Per the page you references
Nagios Plugins does not include a memory plugin however the linux-nrpe-agent does provide custom_check_mem. The thresholds for the plugin are triggered if the free memory is less than the supplied value.
Also, the command you are running is an example for checking memory on a Windows server with NSClient++
MechanicalPopsicle wrote: ./check_nrpe -H x.x.x.x -t 30 -c custom_check_mem -a 'warn=free<20%' 'crit=free<10%'
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error when setting up nrpe custom_check_mem

Post by tgriep »

Even though the plugin is installed on the remote server, there has to be a command defined in the nrpe.cfg file so it knows what to run when a command come in to the agent.

Typically, this is the command that is defined in the NRPE agents config file.

Code: Select all

command[check_mem]=/usr/local/nagios/libexec/custom_check_mem -n $ARG1$
To test to see if the command is defined in the NRPE agents config files, try running the following example command from the Nagios server.

Code: Select all

./check_nrpe -H x.x.x.x -t 30 -c custom_check_mem -a '-w 20 -c 10'
If it passes, then there is noting that has to be done on the remote agent.
Just create a service check in nagios.

FYI, the above example is different from yours as the one you were trying is for a Windows system running NSClient++.


If the test fails, you will have to add the command to the NRPE agents config file.
Typically the config file for NRPE is /usr/local/nagios/etc/nrpe.cfg and you can edit it and add the following command to it.

Code: Select all

command[check_mem]=/usr/local/nagios/libexec/custom_check_mem -n $ARG1$
Save the change and restart NRPE and test it again from the Nagios server.
Be sure to check out our Knowledgebase for helpful articles and solutions!
MechanicalPopsicle
Posts: 2
Joined: Wed Aug 14, 2019 9:35 am

Re: Error when setting up nrpe custom_check_mem

Post by MechanicalPopsicle »

That was it! - I definied it on the remote server in the nrpe.cfg file and not it is working. I told you I'm new:) lesson learned - thanks
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Error when setting up nrpe custom_check_mem

Post by scottwilkerson »

MechanicalPopsicle wrote:That was it! - I definied it on the remote server in the nrpe.cfg file and not it is working. I told you I'm new:) lesson learned - thanks
Great!

Locking
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked