How to Install NRPE from source on Centos / RHEL 6

On Nagios server

yum install gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel
cd /root
wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-3.2.1/nrpe-3.2.1.tar.gz
tar zxvf nrpe-3.2.1.tar.gz
cd nrpe-3.2.1
./configure
make all
make install-daemon

Check NRPE daemon remotely

/usr/local/nagios/libexec/check_nrpe -H <ip_address>

/usr/local/nagios/libexec/check_nrpe -H <ip_address> -c check_disk

On the remote host

Add nagios user

useradd nagios

Compile and Install Nagios Plugins

cd /tmp

wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz

tar zxvf nagios-plugins-2.2.1.tar.gz

cd nagios-plugins-2.2.1

./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
rm -rf /tmp/nagios-plugins-2.2.1

Compile and install NRPE

yum install gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel xinetd

cd /root

wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-3.2.1/nrpe-3.2.1.tar.gz

tar zxvf nrpe-3.2.1.tar.gz

cd nrpe-3.2.1

./configure 
make all
make install-plugin
make install-daemon
make install-config

RHEL 5-6

make install-init

RHEL 7

make install-init
systemctl enable nrpe.service

Edit NRPE configuration file and Nagios server IP

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

allowed_hosts=127.0.0.1,::1,<ip_address>
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 10% -c 5% -p /

Test the agent locally

/usr/local/nagios/libexec/check_nrpe -H localhost

Add the port in the firewall if this is required

iptables -nvL --line-numbers
iptables -I INPUT 17 -s <nagios_server_ip> -p tcp -m tcp --dport 5666 -m state --state NEW,ESTABLISHED -j ACCEPT
service iptables save

Links