Step 1 – Install EPEL Repository
NRPE packages and plugins are available under EPEL yum repository, Enable EPEL repository using one of the below commands.
### On CentOS/RHEL - 7 ### rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm ### On CentOS/RHEL - 6 ### rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Step 2 – Install NRPE and NRPE-plugins
After enabling EPEL repository, use following commands to install NRPE and plugins in your system.
yum --enablerepo=epel -y install nrpe nagios-plugins
We also need to install commands which NRPE executes for monitoring services. Use the following command to get a list of available commands packages. Install the required packages on your remote system.
yum --enablerepo=epel -y list nagios-plugins* Installed Packages nagios-plugins.x86_64 2.2.1-4git.el7 @epel Available Packages nagios-plugins-all.x86_64 2.2.1-4git.el7 epel nagios-plugins-apt.x86_64 2.2.1-4git.el7 epel nagios-plugins-bacula.x86_64 5.2.13-23.1.el7 base nagios-plugins-bonding.x86_64 1.4-3.el7 epel nagios-plugins-breeze.x86_64 2.2.1-4git.el7 epel nagios-plugins-by_ssh.x86_64 2.2.1-4git.el7 epel nagios-plugins-check-updates.x86_64 1.6.18-2.el7 epel nagios-plugins-cluster.x86_64 2.2.1-4git.el7 epel nagios-plugins-dbi.x86_64 2.2.1-4git.el7 epel nagios-plugins-dhcp.x86_64 2.2.1-4git.el7 epel nagios-plugins-dig.x86_64 2.2.1-4git.el7 epel nagios-plugins-disk.x86_64 2.2.1-4git.el7 epel nagios-plugins-disk_smb.x86_64 2.2.1-4git.el7 epel nagios-plugins-dns.x86_64 2.2.1-4git.el7 epel [...]
Step 3 – Configure NRPE
First, we need to edit the NRPE configuration file and start the configuration to work properly.
vim /etc/nagios/nrpe.cfg
Add your Nagios server ip with allowed_hosts like below, For example, Nagios server ip is 145.68.41.120.
allowed_hosts=127.0.0.1, 145.68.41.120
After adding above entry you will see that Nagios server is able to connect NRPE client. Let add commands to monitor services. Add new commands or update existing commands like below in the same file.
command[check_root_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p / command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
You can add more commands like above as per requirement of monitoring.
Step 4 – Start NRPE Service
After making all changes, reboot NRPE once to read new configuration, Also configure NRPE to autostart on system boot.
sudo systemctl enable nrpe.service sudo systemctl start nrpe.service
Step 5 – Test NRPE from Nagios Server
Login to Nagios server and execute the following command to verify that Nagios server is able to connect to clients NRPE services. On successful connection, it will show a version of clients NRPE package. For example, your remote system IP is 145.68.41.120 with NRPE installed.
check_nrpe -H 145.68.41.120 NRPE v3.1