Page 1 of 2

Not Happy NRPE on Raspberry PI

Posted: Tue Aug 30, 2016 7:23 pm
by kwhogster
OK First off I had an issue open and the last posted replied wipe your PI and start over with clean install of NRPE and Plugins

The He LOCKED the QUESTION so I can no longer posted I never asked for it to be locked and now I have to start all over again this is not acceptable

So I removed all NRPe and Nagios Server and Nagios Plugins on the PI

restarted the PI

Started to install NRPE again and now can not start the NRPE daemon service

ran this to install
sudo apt-get install nagios-nrpe-server


After I put Allowed_hosts=10.2.8.79 the Nagios server ip address

I tried to start the service this failed

root@raspberrypi:/tmp# sudo service nagios-nrpe-server restart
Failed to restart nagios-nrpe-server.service: Unit nagios-nrpe-server.service failed to load: No such file or directory

I believe that file Nagios-nrpe-server belongs in this folder /etc/init.d it is not there and it did not get created during the install

Need help on this please

Re: Not Happy NRPE on Raspberry PI

Posted: Tue Aug 30, 2016 7:48 pm
by Box293
Is there anything logged in /var/log/syslog ?

Re: Not Happy NRPE on Raspberry PI

Posted: Tue Aug 30, 2016 7:54 pm
by kwhogster
yes tons of stuff what to look for


I used these instructions to install nrpe on the PI

https://outsideit.net/monitor-raspberry/

this failed to run

make install-xinetd
ran this
apt-get install xinetd

then it worked

But still now nrpe service of any kind running

Re: Not Happy NRPE on Raspberry PI

Posted: Tue Aug 30, 2016 8:04 pm
by Box293
If you're using xinetd then you don't use an NPRE service, xinetd is responsible for running nrpe (it starts and stops it every time a connection attempt is made).

There should be a file called /etc/xinetd.d/nrpe

Please post any configuration files you changed and the location of these files.

Also post the result of testing NRPE from the nagios server:

Code: Select all

check_nrpe -H pi_address

Re: Not Happy NRPE on Raspberry PI

Posted: Tue Aug 30, 2016 8:18 pm
by kwhogster
root@raspberrypi:/usr/local/nagios/nrpe-2-15# ls /etc/xinetd.d
chargen daytime discard echo nrpe time
root@raspberrypi:/usr/local/nagios/nrpe-2-15# ls /etc/xinetd.d/nrpe
/etc/xinetd.d/nrpe
root@raspberrypi:/usr/local/nagios/nrpe-2-15# vi /etc/xinetd.d/nrpe



# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags = REUSE
socket_type = stream
port = 5666
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nrpe
server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd
log_on_failure += USERID
disable = no
only_from = 127.0.0.1
}

The only file I modified is this one located here

vi /usr/local/nagios/etc/nrpe.cfg


log_facility=daemon
pid_file=/var/run/nagios/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=10.2.8.79
dont_blame_nrpe=1
allow_bash_command_substitution=0
debug=0
command_timeout=60
connection_timeout=300
command[check_load]=/usr/lib/nagios/plugins/check_load $ARG1$
command[check_mem]=/usr/lib/nagios/plugins/check_mem $ARG1$
command[check_procs]=/usr/lib/nagios/plugins/check_procs $ARG1$
command[check_swap]=/usr/lib/nagios/plugins/check_swap $ARG1$

from the Nagios server

root@tgcs017:/usr/local/nagios/etc/objects# /usr/lib/nagios/plugins/./check_nrpe -H 10.2.8.72
connect to address 10.2.8.72 port 5666: Connection refused
connect to host 10.2.8.72 port 5666: Connection refusedroot@tgcs017:/usr/local/nagios/etc/objects#


Update

Checked etc/services
# Nagios services
nrpe 5666/tcp

that's there



Update
ran this on the PI

service xinetd restart


Now from Nagios server

root@tgcs017:/usr/local/nagios/etc/objects# /usr/lib/nagios/plugins/./check_nrpe -H 10.2.8.72
CHECK_NRPE: Error - Could not complete SSL handshake.

Re: Not Happy NRPE on Raspberry PI

Posted: Tue Aug 30, 2016 10:37 pm
by Box293
You need to edit this file:
/etc/xinetd.d/nrpe
And change this line to include your IP Address
only_from = 127.0.0.1 10.2.8.79

Then restart the xinetd service.

When xinetd is used, the allowed_hosts= line in /usr/local/nagios/etc/nrpe.cfg is ignored.

Re: Not Happy NRPE on Raspberry PI

Posted: Wed Aug 31, 2016 7:17 am
by kwhogster
Getting closer on this one

made the change

You need to edit this file:
/etc/xinetd.d/nrpe
And change this line to include your IP Address
only_from = 127.0.0.1 10.2.8.79


Now on Nagios server this works

root@tgcs017:/usr/local/nagios/etc/objects# /usr/lib/nagios/plugins/./check_nrpe -H 10.2.8.72
NRPE v2.15


On the Nagios Page I still get this warning No handler for command: check_mem


Update

When I run this from the Nagios server I get this it works

root@tgcs017:/usr/local/nagios/etc/objects# /usr/lib/nagios/plugins/./check_nrpe -H 10.2.8.72 -c check_mem
[MEMORY] Total: 434 MB - Used: 82 MB - 18% [SWAP] Total: 99 MB - Used: 0 MB - 0% | MTOTAL=455725056;;;; MUSED=84869120;;;; MCACHE=245768192;;;; MBUFFER=71135232;;;; STOTAL=104853504;;;; SUSED=0;;;;


When I run this on the PI it works

root@raspberrypi:/home/pi/Downloads# /usr/local/nagios/libexec/./check_mem.sh
[MEMORY] Total: 434 MB - Used: 81 MB - 18% [SWAP] Total: 99 MB - Used: 0 MB - 0% | MTOTAL=455725056;;;; MUSED=84160512;;;; MCACHE=245768192;;;; MBUFFER=71135232;;;; STOTAL=104853504;;;; SUSED=0;;;;
root@raspberrypi:/home/pi/Downloads#


What am I missing here?

Thanks

Re: Not Happy NRPE on Raspberry PI

Posted: Wed Aug 31, 2016 9:13 am
by rkennedy
You need to setup a definition for check_mem in /usr/local/nagios/etc/nrpe.cfg, for example -

Code: Select all

command[check_mem]=/usr/local/nagios/libexec/check_mem.sh
Then, restart the service once again and it should return the expected result. If it does not, take a look at permissions and make sure the nagios user can execute check_mem.sh

Re: Not Happy NRPE on Raspberry PI

Posted: Wed Aug 31, 2016 5:28 pm
by kwhogster
I have that already defined in nrpe.cfg

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


Check permissions on what?

As you can see in my previous post

I am able to run check_mem.sh

How do I do this?

Re: Not Happy NRPE on Raspberry PI

Posted: Wed Aug 31, 2016 6:47 pm
by Box293
What is the output of:

Code: Select all

find / -name *nrpe*
find / -name *.cfg