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.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: NRPE Chcek_Memory on Linix

Post by Box293 »

kwhogster wrote:I tried both the Pi did not work

root@tgcs017:/usr/local/nagios/etc/objects# /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.7 -t 30 -c check_mem -a 80 90
[MEMORY] Total: 576 MB - Used: 154 MB - 26% [SWAP] Total: 133 MB - Used: 5 MB - 4% | MTOTAL=604598272;;;; MUSED=159191040;;;; MCACHE=95244288;;;; MBUFFER=92229632;;;; STOTAL=140505088;;;; SUSED=5779456;;;;
Whatever 10.2.8.7 is, that is working, can you explain why it isn't working?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
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 »

My define services

define service {
host_name RaspberryPi
service_description Check Memory Used Physical
check_command check_nrpe!check_mem! -a '-w 80 -c 90'
check_interval 1
servicegroups MemUsage
use generic-service
}
define service {
host_name TGCS018
service_description Check Memory Used Physical
check_command check_nrpe!check_mem! -a '-w 80% -c 90%'
check_interval 1
servicegroups MemUsage
use generic-service
}
define service {
host_name vMA
service_description Check Memory Used Physical
check_command check_nrpe!check_mem! -a '-w 80 -c 90'
check_interval 1
servicegroups MemUsage
use generic-service
}

the Pi No handler for command: check_mem
TGCS018 Works
VMA NRPE: Unable to read output

Thoughts
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: NRPE Chcek_Memory on Linix

Post by Box293 »

kwhogster wrote:the Pi No handler for command: check_mem
TGCS018 Works
VMA NRPE: Unable to read output
I think what is really important here is to solve one problem at a time. It's getting way too confusing.

Which one is the Pi?
Show us the command line test for the Pi.
Show us the service config for the Pi.
Even if you've just posted it a couple of posts ago we need to make it really clear and remove any confusion.

I don't want any other information on any other problems you are having until the Pi problem is resolved.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
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 »

Ok the PI only

Command line test from the Nagios Server

root@tgcs017:/usr/local/nagios/etc/objects# /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.72 -t 30 -c check_mem -a 80 90
CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

Code: Select all

define service {
        host_name                       RaspberryPi
        service_description             Check Memory Used Physical
        check_command                   check_nrpe!check_mem! -a '-w 80 -c 90'
        check_interval                  1
        servicegroups                   MemUsage
        use                             generic-service
}
On Nagios


Raspberry Pi UNKNOWN 08-26-2016 02:40:42 1d 4h 5m 22s 3/3 No handler for command: check_mem
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE Chcek_Memory on Linix

Post by lmiltchev »

Let's modify the "/etc/nagios/nrpe.cfg" one more time. I noticed that in this particular config you have:

Code: Select all

dont_blame_nrpe=0
however, you are trying to pass arguments in your command, which is not going to work. Change this line to:

Code: Select all

dont_blame_nrpe=1
Also, change this line:

Code: Select all

command[check_mem]=/usr/local/nagios/libexec/check_mem.sh -w $ARG1$ -c $ARG2$
to this:

Code: Select all

command[check_mem]=/usr/local/nagios/libexec/check_mem.sh $ARG1$
Save and exit. Restart the Pi box.
After the Pi is up, and NRPE is running, test your check by running the following command on the nagios server:

Code: Select all

/usr/lib/nagios/plugins/check_nrpe -H 10.2.8.7 -t 30 -c check_mem -a '-w 80 -c 90'
Let us know if this helped.
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 »

Ok

modified the nrpe.cfg /etc/Nagios/nrpe.cfg on the PI

dont_blame_nrpe=1

command[check_mem]=/usr/local/nagios/libexec/check_mem.sh $ARG1$

Then I restarted the PI


Check Memory Used Physical

Notifications for this service have been disabled

On Nagios
Raspberry PI UNKNOWN 08-26-2016 19:54:53 1d 21h 19m 48s 3/3 No handler for command: check_mem

From Nagios server ran this command

root@tgcs017:/usr/local/nagios/etc/objects# /usr/lib/nagios/plugins/check_nrpe -H 10.2.8.72 -t 30 -c check_mem -a '-w 80 -c 90'
NRPE: Unable to read output
root@tgcs017:/usr/local/nagios/etc/objects#


Thoughts
Thanks Tom


UPDATE UPDATE UPDATE

Could this be a problem???????????????????????????????????

root@raspberrypi:~# service nagios-nrpe-server status
● nagios-nrpe-server.service - LSB: Start/Stop the Nagios remote plugin execution daemon
Loaded: loaded (/etc/init.d/nagios-nrpe-server)
Active: active (exited) since Fri 2016-08-26 19:46:04 EDT; 22min ago
Process: 509 ExecStart=/etc/init.d/nagios-nrpe-server start (code=exited, status=0/SUCCESS)

Aug 26 19:46:03 raspberrypi nrpe[567]: Starting up daemon
Aug 26 19:46:03 raspberrypi nagios-nrpe-server[509]: Starting nagios-nrpe: na...
Aug 26 19:46:03 raspberrypi nrpe[567]: Bind to port 5666 on 0.0.0.0 failed:...e.
Aug 26 19:46:03 raspberrypi nrpe[567]: Bind to port 5666 on :: failed: Addr...e.
Aug 26 19:46:04 raspberrypi systemd[1]: Started LSB: Start/Stop the Nagios r....
Hint: Some lines were ellipsized, use -l to show in full.


Firewall on raspbian????

What should I check?????????????????????????
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: NRPE Chcek_Memory on Linix

Post by Box293 »

Execute this command on your Nagios server, it will test if it can connect to port 5666 on the Pi

Code: Select all

nmap -Pn -p T:5666 10.2.8.72
What is the output of this on the pi:

Code: Select all

ps -ef | grep nrpe
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
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 »

TRoy

On the PI

root@raspberrypi:~# ps -ef | grep nrpe
nagios 501 1 0 Aug26 ? 00:00:00 /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -f
root 6662 915 0 21:22 pts/1 00:00:00 grep nrpe
root@raspberrypi:~#

Also on the pi

root@raspberrypi:~# lsof -i TCP| fgrep LISTEN
sshd 489 root 3u IPv4 8266 0t0 TCP *:ssh (LISTEN)
sshd 489 root 4u IPv6 8268 0t0 TCP *:ssh (LISTEN)
nrpe 501 nagios 4u IPv4 8322 0t0 TCP *:nrpe (LISTEN)
nrpe 501 nagios 5u IPv6 8323 0t0 TCP *:nrpe (LISTEN)
apache2 629 root 4u IPv6 9242 0t0 TCP *:http (LISTEN)
apache2 5202 www-data 4u IPv6 9242 0t0 TCP *:http (LISTEN)
apache2 5203 www-data 4u IPv6 9242 0t0 TCP *:http (LISTEN)
apache2 5204 www-data 4u IPv6 9242 0t0 TCP *:http (LISTEN)
apache2 5205 www-data 4u IPv6 9242 0t0 TCP *:http (LISTEN)
apache2 5206 www-data 4u IPv6 9242 0t0 TCP *:http (LISTEN)
root@raspberrypi:~#





On the Nagios Server

root@tgcs017:/usr/local/nagios/etc/objects# nmap -Pn -p T:5666 10.2.8.72

Starting Nmap 7.01 ( https://nmap.org ) at 2016-08-28 21:21 EDT
Nmap scan report for raspberrypi.our.network.tgcsnet.com (10.2.8.72)
Host is up (0.00062s latency).
PORT STATE SERVICE
5666/tcp open nrpe


Seems to be open ???
MAC Address: B8:27:EB:D9:3E:C0 (Raspberry Pi Foundation)

Nmap done: 1 IP address (1 host up) scanned in 1.78 seconds
root@tgcs017:/usr/local/nagios/etc/objects#
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: NRPE Chcek_Memory on Linix

Post by Box293 »

It seems to me that you have two separate instances of NRPE installed on the Pi.
kwhogster wrote:root@raspberrypi:~# ps -ef | grep nrpe
nagios 501 1 0 Aug26 ? 00:00:00 /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -f
This clearly states that NRPE is stated and using the config file /usr/local/nagios/etc/nrpe.cfg
kwhogster wrote:modified the nrpe.cfg /etc/Nagios/nrpe.cfg on the PI
But there you have a config file in a different location:

/etc/Nagios/nrpe.cfg

You should make all the changes to the /usr/local/nagios/etc/nrpe.cfg file.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
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 »

TRoy

I use to run Nagios on the pi and started with nrpe plugin on there and had problems running on the pi so I built the Ubuntu server to run Nagios server

should I remove Nagios on the PI I just have the service stopped now
Locked