Monitoring remote system with Nagios and NRPE

This is a quick tutorial on how to prepare a remote system for monitoring using Nagios NRPE. I’m using 64 bit CentOS in this example (could probably be any RHEL based system)

Install NRPE and Nagios Plugins on remote host

[root@remotehost ~]# yum install nagios-nrpe nagios-plugins

 (these packages are on rpmforge, prepare your system first so it uses this repository)

Edit  /etc/nagios/nrpe.cfg

Change allowed_hosts to include the Nagios server (comma seperated list);


Restart nrpe

[root@remotehost ~]# service nrpe restart
Shutting down Nagios NRPE daemon (nrpe):                   [  OK  ]
Starting Nagios NRPE daemon (nrpe):                        [  OK  ]

Make sure your firewall allows NRPE (TCP 5666).
Check if it works on the Nagios server;

[root@nagioshost ~]# /usr/local/nagios/libexec/check_nrpe -H
NRPE v2.12

Configure the NRPE checks

This is an example of a disk usage check, add or change the checks in /etc/nagios/nrpe.cfg

command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w 10% -c 2% -p /dev/mapper/VolGroup00-LogVol00

Configure Nagios

We have a hostgroup defined for NRPE enabled hosts, so it’s easy to add an NRPE host or service: just add it to the hostgroup.

define hostgroup{
 hostgroup_name linux-nrpe-servers
 alias Linux servers with NRPE installed
 members mailgate1,mailgate2

define service{
 use generic-service
 hostgroup_name linux-nrpe-servers
 service_description Linux Disk usage
 check_command check_nrpe!check_disk

NRPE on Windows hosts?

It’s possible to use NRPE for Windows hosts.