NRPE is called as ‘Nagios Remote Plugin Executere‘. NRPE allows nagios server to remotely execute plugins on other Linux/Unix machines. NRPE is also available with some windows addons to monitor windows servers.
This article will help you to setup nrpe on systems CentOS and RHEL 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.
CentOS/RHEL 6, 32 Bit:
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
CentOS/RHEL 6, 64 Bit:
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
CentOS/RHEL 5, 32 Bit:
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
CentOS/RHEL 5, 64 Bit:
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-releas5-4.noarch.rpm
Step 2. Install NRPE and nrpe-plugins
After adding epel repository, use following commands to install nrpe and plugins in system. It may nrpe installed with name nrpe.
# yum --enablerepo=epel -y install nrpe nagios-plugins
We also need to install commands which nrpe executes for monitoring services. Use following command to get a list of available commands packages. Install the required packages.
# yum --enablerepo=epel -y list nagios-plugins\* Installed Packages nagios-plugins.x86_64 1.4.16-5.el6 @epel Available Packages nagios-plugins-by_ssh.x86_64 1.4.16-5.el6 epel nagios-plugins-dhcp.x86_64 1.4.16-5.el6 epel nagios-plugins-dig.x86_64 1.4.16-5.el6 epel nagios-plugins-disk.x86_64 1.4.16-5.el6 epel nagios-plugins-fping.x86_64 1.4.16-5.el6 epel nagios-plugins-http.x86_64 1.4.16-5.el6 epel nagios-plugins-icmp.x86_64 1.4.16-5.el6 epel nagios-plugins-linux_raid.x86_64 1.4.16-5.el6 epel nagios-plugins-load.x86_64 1.4.16-5.el6 epel nagios-plugins-log.x86_64 1.4.16-5.el6 epel nagios-plugins-mailq.x86_64 1.4.16-5.el6 epel
Step 3. Configure NRPE
First we need to edit /etc/nagios/nrpe.cfg and start the configuration to work properly.
# vim /etc/nagios/nrpe.cfg
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 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 auto start on system boot.
# service nrpe start # chkconfig nrpe on
Step 5. Test NRPE from Nagios Server
Login to nagios server and execute 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.
# check_nrpe -H 192.168.2.23NRPE v2.14
Reference: http://tecadmin.net/install-nrpe-on-centos-rhel/