rubysecurity.org

Anecdotes from a Linux Systems Administrator. /root

Home About Books Blog Portfolio Archive
1 November 2012

Installing Nagios Remote Plugin Executor in CentOS and Ubuntu

by Alpha01

CentOS

yum install openssl openssl-devel gcc make autoconf xinetd

Debian/Ubuntu

apt-get install openssl build-essential libssl-dev gcc make autoconf xinetd

Create nagios user and give it a password.

/usr/sbin/useradd -m nagios
passwd nagios

Download and extract the latest stable Nagios Plugins from http://www.nagios.org/download/plugins/ Configure, compile and install the Nagios plugins.

./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

Download the latest NRPE plugin from http://exchange.nagios.org/directory/Addons/Monitoring-Agents/NRPE–2D-Nagios-Remote-Plugin-Executor/details. Extract, configure, compile and install the plugin with xinetd configuration.

./configure
make all
make install-daemon
make install-xinetd

Edit the /etc/xinetd.d/nrpe file and add the IP address of the monitoring server to the only_from directive.

only_from = 127.0.0.1 <nagios_ip_address>

Add the following entry for the NRPE daemon to the /etc/services file.

nrpe 5666/tcp # NRPE

Restart the xinetd service.

/etc/init.d/xinetd restart

Copy over sample config file.

mkdir /usr/local/nagios/etc/
cp sample-config/nrpe.cfg /usr/local/nagios/etc/nrpe.cfg

Copy over check_nrpe binary to /usr/local/nagios/libexec

cp src/check_nrpe /usr/local/nagios/libexec/

Update permissions.

chown nagios.nagios /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios/libexec

Update firewall.

iptables -A INPUT -p tcp -m tcp --dport 5666 -j ACCEPT

Testing Communication

Issue the following command to test communication on the Nagios monitoring server. Replace IP “192.168.0.1”, with the NRPE client’s IP.

/usr/local/nagios/libexec/check_nrpe -H 192.168.0.1

You should get a string back that tells you what version of NRPE is installed on the remote host, like this:

NRPE v2.13
Tags: [ nagios centos ubuntu ]