Install Nagios Plugins and NRPE agents on CentOS 7/RHEL 7/Fedora 29


In this article, we are going to learn how to install Nagios Plugins and NRPE agents on CentOS 7/RHEL 7/Fedora 29 server using a package manager. You can install them from the source in case the server has no internet connections. This method however may results in the dependency issues.

In our previous tutorials, we learnt how to install Nagios plugins as well the Nagios NRPE agents from source. You can check them via the links below;

Install cPanel on Oracle FREE HOSTI...
Install cPanel on Oracle FREE HOSTING, Resize Storage, Update RDNS & Open Port 25

How to Install Nagios Plugins From Source RHEL/CentOS/Oracle Linux

How to Install Nagios NRPE Agent on RHEL/CentOS/Oracle Linux

Therefore to install Nagios Plugins and NRPE agents without facing any dependency related issue, using the package manager is a sure bet.

Install Nagios Plugins and NRPE agents on CentOS 7/RHEL 7/Fedora 29

Install EPEL repositories

Nagios plugins as well as NRPE agents are provided by EPEL repositories. Extra Packages for Enterprise Linux (EPEL) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, RHEL, CentOS and Scientific Linux (SL), Oracle Linux (OL).

For CentOS 7, you need to install EPEL repositories by running any of the command below;

yum install -y


yum install epel-release -y

For Fedora 29, Nagios NRPE and Nagios plugins are available on the default repositories and thus no need for extra repos.

Installing NRPE on Fedora 29/CentOS 7

Now that you have the required repositories to install NRPE and Nagios plugins; run the commands below to install them. The commands apply to both CentOS 7 and Fedora 29.

yum install nrpe -y

You can verify the version of the installed NRPE as shown below;

nrpe -V

Install Nagios plugins on Fedora 29/CentOS 7

There exist over 50 Nagios plugins that enables you to monitor just about anything and everything with Nagios. Talk about databases, operating systems, applications, network equipment, protocols etc. To list available Nagios plugins, run the command below;

yum list nagios-plugins*

On CentOS 7/RHEL 7;

Installed Packages
nagios-plugins.x86_64                       2.2.1-9git5c7eb5b9.el7        @epel
Available Packages
nagios-plugins-all.x86_64                   2.2.1-9git5c7eb5b9.el7        epel 
nagios-plugins-apt.x86_64                   2.2.1-9git5c7eb5b9.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-9git5c7eb5b9.el7        epel 
nagios-plugins-by_ssh.x86_64                2.2.1-9git5c7eb5b9.el7        epel 
nagios-plugins-check-updates.x86_64         1.6.18-2.el7                  epel 
nagios-plugins-cluster.x86_64               2.2.1-9git5c7eb5b9.el7        epel 
nagios-plugins-dbi.x86_64                   2.2.1-9git5c7eb5b9.el7        epel 
nagios-plugins-dhcp.x86_64                  2.2.1-9git5c7eb5b9.el7        epel 
nagios-plugins-dig.x86_64                   2.2.1-9git5c7eb5b9.el7        epel 
nagios-plugins-disk.x86_64                  2.2.1-9git5c7eb5b9.el7        epel 
nagios-plugins-disk_smb.x86_64              2.2.1-9git5c7eb5b9.el7        epel 

On Fedora 29

Installed Packages
nagios-plugins.x86_64                 2.2.1-14.20180725git3429dad.fc29  @fedora
Available Packages
nagios-plugins-all.x86_64             2.2.1-14.20180725git3429dad.fc29  fedora 
nagios-plugins-apt.x86_64             2.2.1-14.20180725git3429dad.fc29  fedora 
nagios-plugins-bacula.x86_64          9.2.1-1.fc29                      fedora 
nagios-plugins-bdii.x86_64            1.0.15-11.fc29                    fedora 
nagios-plugins-bonding.x86_64         1.4-11.fc29                       fedora 
nagios-plugins-breeze.x86_64          2.2.1-14.20180725git3429dad.fc29  fedora 
nagios-plugins-by_ssh.x86_64          2.2.1-14.20180725git3429dad.fc29  fedora 
nagios-plugins-check-updates.x86_64   1.6.23-1.fc29                     fedora 
nagios-plugins-cluster.x86_64         2.2.1-14.20180725git3429dad.fc29  fedora 
nagios-plugins-dbi.x86_64             2.2.1-14.20180725git3429dad.fc29  fedora 
nagios-plugins-dhcp.x86_64            2.2.1-14.20180725git3429dad.fc29  fedora 
nagios-plugins-dig.x86_64             2.2.1-14.20180725git3429dad.fc29  fedora

To install specific Nagios plugins for example to check the load, http, users, processes, disk space, swap space, uptime, run the command below;

yum install nagios-plugins-{load,http,users,procs,disk,swap,nrpe,uptime} -y

Once the installation is done, tou can check your plugins under /usr/lib64/nagios/plugins/

ls /usr/lib64/nagios/plugins/
check_disk  check_load  check_procs  check_uptime  eventhandlers  urlize
check_http  check_nrpe  check_swap   check_users   negate

If you also need to monitor physical system memory, download the check_mem Nagios plugin following plugin to the plugins directory. Once you have downloaded, make it executable;

chmod +x /usr/lib64/nagios/plugins/check_mem

Configure NRPE Agent

The NRPE agent configuration file is located under /etc/nagios/nrpe.cfg. To configure NRPE agent to utilize the Nagios plugins, edit the file and make appropriate command substitutes for example;

vim /etc/nagios/nrpe.cfg
command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib64/nagios/plugins/check_load -r -w 8.0,7.5,7.0 -c 11.0,10.0,9.0
command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w 15% -c 10% /
command[check_mem]=/usr/lib64/nagios/plugins/check_mem -w 75% -c 90%
command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 300 -c 400
command[check_swap]=/usr/lib64/nagios/plugins/check_swap -w 10 -c 5

Once you are done with configurations, save and quit the file

Allow NRPE on Firewall

If firewall is running, allow NRPE through it;

firewall-cmd --add-service=nrpe --permanent
firewall-cmd --reload

Start and Enable NRPE to run on system boot

systemctl start nrpe
systemctl enable nrp

Verify the NRPE port is open and listening;

ss -altn | grep 5666
LISTEN   0         5            *       
LISTEN   0         5                      [::]:5666                [::]:*

Verify that your Plugins are working as expected.

Check Running Processes

/usr/lib64/nagios/plugins/check_nrpe -H -c check_total_procs
PROCS OK: 105 processes | procs=105;300;400;0;

Check Load

/usr/lib64/nagios/plugins/check_nrpe -H -c check_load
OK - load average: 0.04, 0.16, 0.08|load1=0.040;8.000;11.000;0; load5=0.160;7.500;10.000;0; load15=0.080;7.000;9.000;0;

Check Swap Memory

/usr/lib64/nagios/plugins/check_nrpe -H -c check_swap
SWAP OK - 100% free (1023 MB out of 1023 MB) |swap=1023MB;0;0;0;1023

Check Logged in Users;

/usr/lib64/nagios/plugins/check_nrpe -H -c check_users
USERS OK - 2 users currently logged in |users=2;5;10;0

Check Disk Space;

/usr/lib64/nagios/plugins/check_nrpe -H -c check_disk
DISK OK - free space: / 6440 MB (78.74% inode=99%);| /=1737MB;6951;7360;0;8178

Check Memory;

/usr/lib64/nagios/plugins/check_nrpe -H -c check_mem
DISK CRITICAL - free space: / 6438 MB (78.73% inode=99%); /boot 751 MB (82.64% inode=100%); /var/tmp 6438 MB (78.73% inode=99%);| /=1739MB;2044;817;0;8178 /boot=157MB;243;97;0;975 /var/tmp=1739MB;2044;817;0;8178

Hurray, you have successfully set up install and set up Nagios Plugins and NRPE agents on Fedora 29/RHEL 7/CentOS 7. Thank you for reading.

Related Tutorials:

Monitor Linux System Metrics with Prometheus Node Exporter

Monitor Squid logs with Grafana and Graylog

Monitor Squid Access Logs with Graylog Server

How to Install Nagios Plugins and NRPE agents on CentOS 7/RHEL 7/Fedora 29

Monitor Linux Hosts using Nagios check_by_ssh Plugin

How to Install Nagios Plugins From Source RHEL/CentOS/Oracle Linux

Install and Setup TIG Stack on Fedora 30