HowTo monitor a linux server with NRPE – Introduction

This guide shows you howto monitor a linux server with NRPE. The Nagios Remote Plugin executor. It will shortly describe the steps to execute on the to be monitored server and provide the necessary tasks to include the services in Nagios or Icinga

Requirements and Definitions for monitoring a Linux Server with NRPE

Throughout this HowTo, the IP address of the Icinga/Nagios server will be 10.0.0.200

Linux Server Setup

In order to monitor a linux server with NRPE we have to install the NRPE software on your linux system which mostly consist of downloading and compiling it. We will also have to download the actual plugins and compile these on the system as well so everything is working with the architecture (32/64bit) and libraries on our linux server.

NRPE and Plugin Installation

yum install -y gcc openssl-devel openssl glibc.i686
cd /usr/src
wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz -O nrpe.tgz
tar -xzvf nrpe.tgz
rm -f nrpe.tgz
cd nrpe-2.15/
adduser nagios -s /sbin/nologin
./configure --enable-ssl
make all
make install
make install-plugin
make install-daemon
make install-daemon-config
echo "nrpe 5666/tcp # nrpe" >> /etc/services
make install-xinetd
cat /etc/xinetd.d/nrpe
sed -i 's/127\.0\.0\.1/10.0.0.200/ig' /etc/xinetd.d/nrpe
cat /etc/xinetd.d/nrpe
cd /tmp
wget https://www.monitoring-plugins.org/download/monitoring-plugins-2.1.2.tar.gz
tar -xzvf monitoring-plugins-2.1.2.tar.gz
rm -f monitoring-plugins-2.1.2.tar.gz
cd monitoring-plugins-2.1.2
./configure --with-openssl --prefix=/usr/local/nagios/
make all
make install
sed -i 's/127\.0\.0\.1/10.0.0.200/ig' /usr/local/nagios/etc/nrpe.cfg 
/etc/init.d/xinetd restart

Example NRPE Configuration ( /usr/local/nagios/etc/nrpe.cfg )

The following part of the nrpe.cfg file provides an example for monitoring a Linux Server with NRPE.

# COMMAND DEFINITIONS
# Check Symantec Backup Client
command[check_symantec]=/usr/local/nagios/libexec/check_procs -C beremote -c 1:  -m PROCS
# Check Swap Space
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 40 -c 20
# Check users
command[check_users]=/usr/local/nagios/libexec/check_users -w 60 -c 80
# Check System load
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
# Check Logical VOlume
command[check_root]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/mapper/VolGroup00-LogVol00
# Check Zombie processes
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
# Check processes
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 800 -c 1000
# Check ntp time sync
command[check_ntp_time]=/usr/local/nagios/libexec/check_ntp_time -H myNTPServer
# Check Mail Queue
command[check_mailq]=/usr/local/nagios/libexec/check_mailq -w 10 -c 20
# Check local webserver
command[check_http]=/usr/local/nagios/libexec/check_http -H localhost -p 80
# Check local mail server
command[check_mail_local]=/usr/local/nagios/libexec/check_smtp -H localhost -p 25
# Check remote mail server
command[check_mail_remote]=/usr/local/nagios/libexec/check_smtp -H myMailGateway -p 25
# Check Print Queue
command[check_lpstat]=/usr/local/nagios/libexec/check_lpstat.pl -w 1 -c 2