Page 1 of 1

Problems installing nrpe on Ubuntu PCs

Posted: Tue Mar 16, 2021 8:15 am
by kCyborg
Hi guys.

First of all: I did a researh before asking the question but I could not find the answer to my problem :-(

Im begun to work on this new job administrating a network, and I decided that the services can be improved, so I did a research and find Nagios (a software that I have heard a lot in my college years) and I decided to install nagios to monitorize my server and PCs's stats and their services. I have a Proxmox server where all my servers live, so all the mentioned servers are Proxmoxs VMs.

So far so good, I installed Nagios core on a Debian 10 VM, I added some Windows and Debian hosts via (obviously) nrpe and all work flawlessly, but as soon as I try to install nrpe on a Ubuntu 18.10 the problems start.

The steps to install nrpe on a host are quite simple to follow:

Code: Select all

sudo apt-get update
sudo apt-get install nagios-nrpe-server monitoring-plugins

nano /etc/nagios/nrpe.cfg
And change:

Code: Select all

server_address=127.0.0.1, 192.168.0.225 (IP of the host)
allowed_hosts=127.0.0.1,::1,192.168.0.220 (IP of the Nagios core server)

Code: Select all

nano /etc/nagios/nrpe_local.cfg
And add:

Code: Select all

command[check_root]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
command[check_ping]=/usr/lib/nagios/plugins/check_ping -H 192.168.0.225 -w 100.0,20% -c 500.0,60% -p 5
command[check_ssh]=/usr/lib/nagios/plugins/check_ssh -4 192.168.0.225
command[check_http]=/usr/lib/nagios/plugins/check_http -I 192.168.0.225
command[check_apt]=/usr/lib/nagios/plugins/check_apt
Then just restart the nrpe service:

Code: Select all

sudo /etc/init.d/nagios-nrpe-server restart 
[ ok ] Restarting nagios-nrpe-server (via systemctl): nagios-nrpe-server.service.
But when I try on a server:

Code: Select all

sudo /etc/init.d/nagios-nrpe-server status
I get this answer:

Code: Select all

* nagios-nrpe-server.service - Nagios Remote Plugin Executor
   Loaded: loaded (/lib/systemd/system/nagios-nrpe-server.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2021-03-16 13:06:48 UTC; 32s ago
     Docs: http://www.nagios.org/documentation
  Process: 8291 ExecStopPost=/bin/rm -f /var/run/nagios/nrpe.pid (code=exited, status=0/SUCCESS)
  Process: 8273 ExecStart=/usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -f $NRPE_OPTS (code=exited, status=1/FAILURE)
 Main PID: 8273 (code=exited, status=1/FAILURE)

Mar 16 13:06:48 TeamSpeak systemd[1]: Started Nagios Remote Plugin Executor.
Mar 16 13:06:48 TeamSpeak nrpe[8273]: Starting up daemon
Mar 16 13:06:48 TeamSpeak nrpe[8273]: bad addr or host: 127.0.0.1,192.168.0.221 (Name or service not known)
Mar 16 13:06:48 TeamSpeak systemd[1]: nagios-nrpe-server.service: Main process exited, code=exited, status=1/FAILURE
Mar 16 13:06:48 TeamSpeak systemd[1]: nagios-nrpe-server.service: Failed with result 'exit-code'.
The thing is that when I edit the /etc/nagios/nrpe.cfg
And change:

Code: Select all

server_address=127.0.0.1
Letting just the local IP addres and deleting the host IP the service run flawlessly, but obviosly when from the Nagios core server I try to check I get a refuse connection error

Code: Select all

sudo /usr/lib/nagios/plugins/check_nrpe -H 192.168.0.221
connect to address 192.168.50.221 port 5666: Connection refused
connect to host 192.168.50.221 port 5666: Connection refused
I tried to not use an IP but the hostname itself, and I got the exact same anser when I try the restart and then the status check

So... What am I doing wrong? I guess it's something simple that Im not able to see, but I cant find where is my error, can you guys help me?

Re: Problems installing nrpe on Ubuntu PCs

Posted: Thu Apr 01, 2021 1:18 pm
by kCyborg
It was a firewall problem...

@admins if you wanna can delete this thread

Re: Problems installing nrpe on Ubuntu PCs

Posted: Fri Apr 02, 2021 2:41 pm
by benjaminsmith
It was a firewall problem...
@admins if you wanna can delete this thread
Sounds good. We'll lock this one.

Have a great weekend!

Benjamin
Nagios Support Team