You need to do the installation and basic client configuration on a remote server to monitor your host and services with Nagios Core.
Step 1: First of all you need to install all required packages.
# yum install gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel vim wget xinetd
Step 2: Create a user using the below command.
# useradd -s /usr/sbin/nologin nagios
Step 3: Download the required packages by using the wget command.
# wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-4.1.0/nrpe-4.1.0.tar.gz
# wget https://nagios-plugins.org/download/nagios-plugins-2.4.7.tar.gz
Step 4: Now extract downloaded files to compile.
# tar xzf nagios-plugins-2.4.7.tar.gz
# cd nagios-plugins-2.4.7
# ./configure
# make
# make install
** Now extract nrpe file as well **
# tar xzf nrpe-4.1.0.tar.gz
# cd nrpe-4.1.0
# ./configure
# make all
# make install-plugin;
# make install-daemon;
# make install-daemon-config;
# make install-xinetd
Step 5: Set up permissions for required directories.
# chown nagios:nagios /usr/local/nagios
# chown -R nagios:nagios /usr/local/nagios/libexec
Step 6: Make an entry into /etc/services
# echo "nrpe 5666/tcp # NRPE" >> /etc/services
Sample Entry:
Step 7: Add Nagios server ip in to /etc/xinetd.d/nrpe file
# sed -i 's/127.0.0.1/127.0.0.1 <nagios-server-ip>/g' /etc/xinetd.d/nrpe
Note: Replace <nagios-server-ip> with your nagios core IP.
Step 8: Restart the service and check if it is configured correctly or not.
The output should be like this.
# systemctl restart xinetd.service
# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
That’s it!! You are good to go.
NOTE: If you are using iptables or firewall in your servers then you need to allow the 5666 port.