NRPE Chcek_Memory on Linix

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

NRPE Chcek_Memory on Linix

Post by kwhogster »

Nagios Core 4.1.1
NRPE Plugin

I have 4 Linux Guests including the one for Nagios Would like to check memory usage on them Found a page by Box293 which gave me the commands to use with NRPE

My cfg file extract

Code: Select all

define service {
        host_name                       localhost
        service_description             Check Memory Used Physical
        check_command                   check_nrpe!Check_Memory! -a show-all type=physical 'warning=used>80%' 'critical=used>90%'
        check_interval                  1
        use                             generic-service
}
define service {
        host_name                       RaspberryPi
        service_description             Check Memory Used Physical
        check_command                   check_nrpe!Check_Memory! -a show-all type=physical 'warning=used>80%' 'critical=used>90%'
        check_interval                  1
        use                             generic-service
}
define service {
        host_name                       TGCS018
        service_description             Check Memory Used Physical
        check_command                   check_nrpe!Check_Memory! -a show-all type=physical 'warning=used>80%' 'critical=used>90%'
        check_interval                  1
        use                             generic-service
}
define service {
        host_name                       vMA
        service_description             Check Memory Used Physical
        check_command                   check_nrpe!Check_Memory! -a show-all type=physical 'warning=used>80%' 'critical=used>90%'
        check_interval                  1
        use                             generic-service
}

The errors on Nagios

RaspBerryPi CHECK_NRPE: No output returned from daemon. This is Raspbian
TGCS018 (Return code of 255 is out of bounds) This is CentOS 7
LocalHost CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages. This is the Nagios Server Ubuntu 16.04.01
vMA (Return code of 255 is out of bounds) This is vSphere Management Assistant 6.0.0.1



Ran the command line

Raspberrypi
nagios@tgcs017:/usr/local/nagios/etc/objects$ /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.70 -t 30 CheckMEM -a ShowAll=long type=physical
I (0,4,1,73 2012-12-17) seem to be doing fine...
nagios@tgcs017:/usr/local/nagios/etc/objects$

TGCS018
nagios@tgcs017:/usr/local/nagios/etc/objects$ /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.74 -t 30 CheckMEM -a ShowAll=long type=physical
connect to address 10.2.8.74 port 5666: Connection refused
connect to host 10.2.8.74 port 5666: Connection refusednagios@tgcs017:/usr/local/nagios/etc/objects$

vMA
nagios@tgcs017:/usr/local -H 10.2.8.7 -t 30 CheckMEM -a ShowAll=long type=physical
connect to address 10.2.8.7 port 5666: Connection refused
connect to host 10.2.8.7 port 5666: Connection refusednagios@tgcs017:/usr/local/nagios/etc/objects$

Localhost
nagios@tgcs017:/usr/local/nagios/etc/objects$ /usr/lib/nagios/plugins/check_nrpe -H localhost -t 30 CheckMEM -a ShowAll=long type=physical
CHECK_NRPE: Error - Could not complete SSL handshake.
nagios@tgcs017:/usr/local/nagios/etc/objects$



What am I doing wrong here?

Thanks
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: NRPE Chcek_Memory on Linix

Post by kwhogster »

Update

I installed the Linux NRPE Agent on my CEntOS 7 server.
it was TGCS018 (Return code of 255 is out of bounds) This is CentOS 7 now CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

Which is the same warning I get on the localhost

the command line does this now
nagios@tgcs017:/usr/local/nagios/etc/objects$ /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.74 -t 30 CheckMEM -a ShowAll=long type=physical
NRPE v2.15
nagios@tgcs017:/usr/local/nagios/etc/objects$ /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.74 -t 30 Check_Memory -a ShowAll=long type=physical 'warning=free<20%' 'critical=free<10%'
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.



On my vMA Guest the one with this error (Return code of 255 is out of bounds)

I tried to install the Linux NRPE Agent but I get this error
vi-admin@tgkw002:~/tmp/linux-nrpe-agent> ./fullinstall
ERROR: Could not determine OS. Please make sure lsb_release is installed or your OS info is in /etc/os-release.
vi-admin@tgkw002:~/tmp/linux-nrpe-agent> uname -s
Linux



Any thoughts?

Thanks
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: NRPE Chcek_Memory on Linix

Post by tgriep »

When using the Linux NRPE agent, the commands are defined differently then what you are using. The ones you are using are for checking the memory for Windows hosts.

The command you need to use is check_mem to test the memory usage on a Linux system. Try running the following command. It will check the memory and give a warning at 80% and a critical at 90%

Code: Select all

/usr/lib/nagios/plugins/check_nrpe -H 10.2.8.74 -t 30 -c check_mem -a 80 90
The NRPE agent doesn't look like it is compatible with VWware's vMA server OS.
Be sure to check out our Knowledgebase for helpful articles and solutions!
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: NRPE Chcek_Memory on Linix

Post by kwhogster »

Thanks

nagios@tgcs017:/$ /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.74 -t 30 -c check_mem -a 80 90

Wrong Syntax: custom_check_mem -n 80

Usage: custom_check_mem [-w|--warning]<percent free> [-c|--critical]<percent free> [-n|--nocache]


The VMA machine is this
Welcome to SUSE Linux Enterprise Server 11 SP3 for VMware (x86_64)

Thoughts on both?

Also just tried this so this command gives same error I see on Nagios page
nagios@tgcs017:/usr/local/nagios/etc/objects$ /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.74 -t 30 -c check_mem -n
CHECK_NRPE: Error receiving data from daemon.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: NRPE Chcek_Memory on Linix

Post by tgriep »

Your check_mem command must be mapped to the custom_check_mem plugin but to be sure, I would have to see the nrpe.cfg file from your remote system.
The custom_check_mem options are different so try the following example and see if it works for you.

Code: Select all

/usr/lib/nagios/plugins/check_nrpe -H 10.2.8.74 -t 30 -c check_mem -a ' -w 80% -c 90%'
Take a look at this KB article to see if you can compile the latest NRPE agent on your vMA server.
https://support.nagios.com/kb/article.php?id=515
Be sure to check out our Knowledgebase for helpful articles and solutions!
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: NRPE Chcek_Memory on Linix

Post by kwhogster »

I ran that from the console and it worked but when I add it to the cfg file it does not

define service {
host_name localhost
service_description Check Memory Used Physical
check_command check_nrpe!Check_Mem! -a '-w 80% -c 90%'
check_interval 1
use generic-service
}

Whats wrong with my command define service??

this is the error CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: NRPE Chcek_Memory on Linix

Post by tgriep »

The check_mem should be in lower case. Try that and see if that fixes it.
Be sure to check out our Knowledgebase for helpful articles and solutions!
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: NRPE Chcek_Memory on Linix

Post by kwhogster »

tgriep

Good one I now have 1 out of 4 working.

TGCS018 which is Cent OS 7 is working now

The other three still not

The RaspberryPI running Raspbian I was running my Nagios on this device It has NRPE installed but maybe not setup correctly not sure
nagios@tgcs017:/usr/local/nagios/etc/objects$ /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.70 -t 30 -c check_mem -a ' -w 80% -c 90%'
No handler for command: check_mem

On Nagios No handler for command: check_mem

The LocalHost running Ubuntu 16.04.01 where I run Nagios on
nagios@tgcs017:/usr/local/nagios/etc/objects$ /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.79 -t 30 -c check_mem -a ' -w 80% -c 90%'
CHECK_NRPE: Error - Could not complete SSL handshake.

On Nagios CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

The VMA SU running SUSE Linux Enterprise Server 11 SP3 for VMware
nagios@tgcs017:/usr/local/nagios/etc/objects$ /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.7 -t 30 -c check_mem -a ' -w 80% -c 90%'
connect to address 10.2.8.7 port 5666: Connection refused
connect to host 10.2.8.7 port 5666: Connection refused

On Nagios (Return code of 255 is out of bounds)


Thoughts

Thanks
Tom
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: NRPE Chcek_Memory on Linix

Post by kwhogster »

This link gives me access denied

Take a look at this KB article to see if you can compile the latest NRPE agent on your vMA server.
https://support.nagios.com/kb/article.php?id=515
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: NRPE Chcek_Memory on Linix

Post by rkennedy »

The RaspberryPI running Raspbian I was running my Nagios on this device It has NRPE installed but maybe not setup correctly not sure
nagios@tgcs017:/usr/local/nagios/etc/objects$ /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.70 -t 30 -c check_mem -a ' -w 80% -c 90%'
No handler for command: check_mem

On Nagios No handler for command: check_mem
Since you're using NRPE here, you need to define a command for check_mem in your /usr/local/nagios/etc/nrpe.cfg file. That way, it knows what plugin to run when you call to it. As an example -

Code: Select all

command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$
The LocalHost running Ubuntu 16.04.01 where I run Nagios on
nagios@tgcs017:/usr/local/nagios/etc/objects$ /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.79 -t 30 -c check_mem -a ' -w 80% -c 90%'
CHECK_NRPE: Error - Could not complete SSL handshake.
You do not need to use NRPE to run check_mem on a local machine. Simply define the command in your commands configuration file, and assign it to the local service. NRPE is used as an 'agent'. As an example -

Code: Select all

define command {
       command_name                             check_mem
       command_line                             $USER1$/check_mem.sh
}
The VMA SU running SUSE Linux Enterprise Server 11 SP3 for VMware
nagios@tgcs017:/usr/local/nagios/etc/objects$ /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.7 -t 30 -c check_mem -a ' -w 80% -c 90%'
connect to address 10.2.8.7 port 5666: Connection refused
connect to host 10.2.8.7 port 5666: Connection refused
It sounds here like the agent wasn't installed properly. Did you follow a specific set of instructions? This could be firewall related if the process is indeed running on the SUSE machine.
Former Nagios Employee
Locked