Just in case…
[email protected]:/home/root# /etc/init.d/nagios-nrpe-server restart
[ ok ] Restarting nagios-nrpe-server (via systemctl): nagios-nrpe-server.service.
Just in case…
[email protected]:/home/root# /etc/init.d/nagios-nrpe-server restart
[ ok ] Restarting nagios-nrpe-server (via systemctl): nagios-nrpe-server.service.
This was tested on a CentOS 7.
This might have TWO possible causes
Some important files/directories
nrpe.cfg – /etc/nagios/nrpe.cfg
nagios/nrpe plugins folder – /usr/lib64/nagios/plugins/
logs – /var/log/messages
My nrpe.cfg, in a CentOS 7, is located at /etc/nagios/nrpe.cfg
nano /etc/nagios/nrpe.cfg
In a default nrpe installation log is disabled!
You might want to enable it for better debug of the issues… Go to and enable it.
log_file=/var/run/nrpe.log
Yah!, the default installation will came also with debug disabled.
We want it enabled to see more information while we try to use service nrpe status for example.
debug=1
Server address… it might confuse you!
Server address ISN’T the NAGIOS’s ip address. It’s the actual external IP address of the current machine! allowed_hosts it’s actually it!
lsof -i:5666
netstat -an |grep 5666
If you don’t see any result… this probably means that nrpe is down!
See the ‘section’ Add NRPE to service bellow.
sudo firewall-cmd --permanent --zone=public --add-port=5666/tcp firewall-cmd --reload
sudo systemctl enable nrpe.service sudo systemctl start nrpe.service
Another nagios update – another issue -…
[1490254976] Event broker module ‘NERD’ deinitialized successfully.
[1490254991] Failed to obtain lock on file /var/run/nagios/nagios.pid: No such file or directory
[1490254991] Bailing out due to errors encountered while attempting to daemonize… (PID=792)
SHIT!
I had to
mkdir /var/run/nagios chown nagios:nagios /var/run/nagios
And restart nagios.
Return code of 127 is out of bounds – plugin may be missing
On the check_command, I had to prepend check_nrpe! since we are using the nrpe client on the server to read and return us the desired value.
No output returned from plugin
On the check_command, I had to append, with for example !1, since we need to pass $$ARG1$$
NRPE: Command ‘check_apt’ not defined
Check you /etc/nagios/nrpe.cfg you need to set it up there.
Well, I got it working!
On nagios nrpe server my /etc/nagios/nrpe.cfg I add the following line
command[check_apt]=/usr/lib/nagios/plugins/check_apt
Restart nagios-nrpe
service nagios-nrpe-server restart
On nagios server my /etc/nagios/hosts/s4.domain.com.cfg this is what I have
define service { use generic-service host_name s4.domain.com service_description SYS: system updates check_command check_nrpe!check_apt!1 }
Restart nagios server
service nagios restart
apt-get update && apt-get upgrade
apt-get install nagios-nrpe-server nagios-plugins
vi /etc/nagios/nrpe.cfg
Search for server_address and replace 120.0.0.1 for the public ip of this machine.
Search for allowed_hosts and replace 120.0.0.1 for the IP of your nagios server.
/etc/init.d/nagios-nrpe-server restart
That’s kinda it…