How To Install NRPE on CentOS/RHEL 7/6

Channel: Linux
Abstract: which needs to monitor through nagios server. Step 1 – Install EPEL Repository NRPE packages and plugins are available under EPEL yum repositoryAfter

NRPE is ‘Nagios Remote Plugin Executor‘. NRPE allows Nagios server to remotely execute plugins/commands on Linux/Unix machines and get the result back of the executed command. NRPE is also available with some windows add-ons to monitor windows servers. This article will help you to install NRPE on your CentOS/RHEL 7/6 Systems, which needs to monitor through nagios server.

Step 1 – Install EPEL Repository

NRPE packages and plugins are available under EPEL yum repository, Enable EPEL repository using one of 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 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 Nagio server ip is 192.168.1.110.

allowed_hosts=127.0.0.1, 192.168.1.110

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 version of clients NRPE package. For example, your remote system IP is 192.168.1.20 with NRPE installed.

check_nrpe -H 192.168.1.20

NRPE v3.1

Ref From: tecadmin

Related articles