Ubuntu
#> apt-get install nagios-nrpe-server nagios-nrpe-plugin
CentOS and Fedora
#> yum install nrpe nagios-plugins-load nagios-plugins-users nagios-plugins-swap nagios-plugins-disk
#> chkconfig –add nrpe
FreeBSD
#> cd /usr/ports/net-mgmt/nrpe*
#> make
#> make install clean
#> In /etc/nagios/nrpe.cfg
Set the following
dont_blame_nrpe=1 (default set is 0)
Edit the local config file to only allow the nagios servers and set the check commands
This is in /etc/nagios/nrpe_local.cfg on Ubuntu boxes
allowed_hosts=127.0.0.1,66.178.152.26,172.16.3.42,69.9.130.13,10.0.1.194,69.9.129.2,69.9.144.4,172.15.25.2,10.0.201.200
command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20 -c 10
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200
command[check_swap]=/usr/lib/nagios/plugins/check_swap -w 20 -c 10
On CentOS it puts the hard coded commands into /etc/nagios/nrpe.cfg there is no local file
Also add this line as it is not there by default
command[check_swap]=/usr/lib64/nagios/plugins/check_swap -w 20 -c 10
This may bee needed on 64bit machines
mkdir /usr/lib/nagios
mkdir /usr/lib/nagios/plugins
ln -s /usr/lib64/nagios/plugins/check_nrpe /usr/lib/nagios/plugins/check_nrpe
If you are running a custom firewall or standard IP tables you may need to add an allow for the port (Fedora or CentOS)
Firewall (I added under the SSH section)
#NRPE
$IPTABLES -A INPUT -p tcp -s $ANY –destination-port 5666 -j ACCEPT
Standard IP Tables
-A INPUT -p tcp -s $ANY –destination-port 5666 -j ACCEPT
Restart the firewall
Restart the nrpe server
Ubuntu
/etc/init.d/nagios-nrpe-server restart
CentOS
/etc/init.d/nrpe restart
On the monitoring server you can run this to check for a response and make sure things are talking. This can also be ran on the local machine just use 127.0.0.1 as the server IP. If you get a response on the local machine but not the nagios server you likely have a firewall rule blocking you.