Page 1 of 1

NRPE not working

Posted: Tue Aug 14, 2018 5:09 am
by Siddharth Hegde
Hi,

I wanted to check some basic things in a ubuntu server, Like, disk space, PING,etc. I installed NRPE from the below source

https://support.nagios.com/kb/article.php?id=515#Ubuntu

But NRPE is not running when I check the status.

Also if I try
/etc/init.d/nagios-nrpe-server restart
,NRPE is running otherwise it is not

I'm getting this error

On Nagios Server
CHECK_NRPE: Error - Could not connect to client IP address: Connection reset by peer
On Client
#service nrpe status
● nrpe.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
Aug 14 08:26:24 Prodcampaigndaemon-1 systemd[1]: Stopped Nagios Remote Plugin Executor.
Aug 14 08:26:24 Client systemd[1]: Started Nagios Remote Plugin Executor.
Aug 14 08:26:24 Client nrpe[27076]: Starting up daemon
Aug 14 08:26:24 Client nrpe[27076]: Server listening on 0.0.0.0 port 5666.
Aug 14 08:26:24 Client nrpe[27076]: Server listening on :: port 5666.
Aug 14 08:26:24 Client nrpe[27076]: Warning: Daemon is configured to accept command arguments from clients!
Aug 14 08:26:24 Client nrpe[27076]: Listening for connections on port 5666
Aug 14 08:26:24 Client nrpe[27076]: Allowing connections from: 127.0.0.1,::1,10.30.30.10
Aug 14 09:05:17 Client systemd[1]: Stopping Nagios Remote Plugin Executor...
Aug 14 09:05:17 Client systemd[1]: Stopped Nagios Remote Plugin Executor.
# /etc/init.d/nagios-nrpe-server start
[ ok ] Starting nagios-nrpe-server (via systemctl): nagios-nrpe-server.service.
root@Client:/home/rootusr# /etc/init.d/nagios-nrpe-server restart
[ ok ] Restarting nagios-nrpe-server (via systemctl): nagios-nrpe-server.service.
root@Client:/home/rootusr# /etc/init.d/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; bad; vendor preset: enabled)
Active: active (running) since Tue 2018-08-14 09:33:46 UTC; 12s ago
Docs: man:systemd-sysv-generator(8)
Process: 42314 ExecStop=/etc/init.d/nagios-nrpe-server stop (code=exited, status=0/SUCCESS)
Process: 42321 ExecStart=/etc/init.d/nagios-nrpe-server start (code=exited, status=0/SUCCESS)
Tasks: 1
Memory: 1.3M
CPU: 11ms
CGroup: /system.slice/nagios-nrpe-server.service
└─42334 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d

Aug 14 09:33:46 Client systemd[1]: Starting LSB: Start/Stop the Nagios remote plugin execution daemon...
Aug 14 09:33:46 Client nagios-nrpe-server[42321]: * Starting nagios-nrpe nagios-nrpe
Aug 14 09:33:46 Client nagios-nrpe-server[42321]: ...done.
Aug 14 09:33:46 Client systemd[1]: Started LSB: Start/Stop the Nagios remote plugin execution daemon.
Aug 14 09:33:46 Client nrpe[42334]: Starting up daemon
Aug 14 09:33:46 Client nrpe[42334]: Server listening on 0.0.0.0 port 5666.
Aug 14 09:33:46 Client nrpe[42334]: Server listening on :: port 5666.
Aug 14 09:33:46 Client nrpe[42334]: Listening for connections on port 0
Aug 14 09:33:46 Client nrpe[42334]: Allowing connections from: 127.0.0.1 <nagios Private IP address>
I'm getting Socket timed out error

Please let me know how to resolve this issue

Regards,
Siddarth Hegde

Re: NRPE not working

Posted: Tue Aug 14, 2018 3:03 pm
by lmiltchev
Do you have an old install of NRPE from a repo? If you did a source install, you wouldn't have the /etc/init.d/nagios-nrpe-server file on your system...

When is the Ubuntu version that you are installing NRPE on?

Does the daemon start when you run the command below?
on Ubuntu 14.04

Code: Select all

start nrpe
on Ubuntu 16.04

Code: Select all

systemctl start nrpe.service
I would recommend that you remove the "old" NRPE and do a "clean" install from source, following all of the steps, outlined in the document you referenced.

Re: NRPE not working

Posted: Thu Aug 16, 2018 2:11 am
by Siddharth Hegde
Hi lmiltchev,
systemctl status nrpe.service
● nrpe.service - Nagios Remote Plugin Executor
Loaded: loaded (/lib/systemd/system/nrpe.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2018-08-16 07:22:55 UTC; 15s ago
Docs: http://www.nagios.org/documentation
Process: 123168 ExecStopPost=/bin/rm -f /usr/local/nagios/var/nrpe.pid (code=exited, status=0/SUCCESS)
Process: 123157 ExecStart=/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -f (code=exited, status=2)
Main PID: 123157 (code=exited, status=2)

Aug 16 07:22:55 Prodcampaigndaemon-1 systemd[1]: Started Nagios Remote Plugin Executor.
Aug 16 07:22:55 Prodcampaigndaemon-1 systemd[1]: nrpe.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Aug 16 07:22:55 Prodcampaigndaemon-1 systemd[1]: nrpe.service: Unit entered failed state.
Aug 16 07:22:55 Prodcampaigndaemon-1 systemd[1]: nrpe.service: Failed with result 'exit-code'.
Also another NRPE is installed
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
NRPE v2.15
The version I'm installing from source is
NRPE v3.2.1
I tried removing NRPE by following this article https://support.nagios.com/kb/article/n ... e-741.html but could not remove completely.

How to completely remove NRPE?

Regards,
Siddarth Hegde

Re: NRPE not working

Posted: Thu Aug 16, 2018 10:42 am
by lmiltchev
I tried removing NRPE by following this article https://support.nagios.com/kb/article/n ... e-741.html but could not remove completely.

How to completely remove NRPE?
Can you elaborate on "could not remove completely"? What didn't get removed?

You should be able to uninstall the old NRPE (from the repo) by running:

Code: Select all

apt-get remove nagios-nrpe-server
You can then remove the rest by following the article above. To make sure you don't have any NRPE files on the system, you could search for them:

Code: Select all

sudo updatedb
locate nrpe
then remove them. After you cleaned up your system, try reinstalling NRPE by following the article below:
https://support.nagios.com/kb/article.php?id=515#Ubuntu

Re: NRPE not working

Posted: Fri Aug 17, 2018 1:46 am
by Siddharth Hegde
Hi lmiltchev,

This one helped me remove NRPE completely. Thanks

Code: Select all

apt-get remove nagios-nrpe-server
sudo updatedb
locate nrpe
Also, after following this article https://support.nagios.com/kb/article.php?id=515#Ubuntu, I got connection refused error. I had to run this one

Code: Select all

/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
.

NRPE is running now properly.

Thank You lmiltchev for resolving this issue.

Re: NRPE not working

Posted: Fri Aug 17, 2018 9:25 am
by lmiltchev
I am glad I could help! :)

I am locking this topic. If you have any more questions/issues, please start a new thread.