Linux Web Hosting, DevOps, and Cloud Solutions

NRPE installation Ubuntu

NRPE installation installation Ubuntu

Tested: Ubuntu 14.04 64 bit

#Install necessary packages
apt-get install gettext autoconf gcc libc6 libmcrypt-dev make libssl-dev wget automake libtool bc gawk dc build-essential snmp libnet-snmp-perl

#Add icinga user and group
groupadd -g 9000 icinga
useradd -u 9000 -g icinga -d /usr/local/nagios -c "Nagios NRPE" icinga

# Install latest NRPE

cd /usr/local/src/
wget --no-check-certificate -O nrpe.tar.gz https://github.com/NagiosEnterprises/nrpe/archive/nrpe-3.2.0.tar.gz
tar xvf nrpe.tar.gz
cd nrpe-nrpe-3.2.0
./tools/setup
./configure --enable-command-args --with-ssl-lib=/usr/lib/x86_64-linux-gnu/ --with-nrpe-user=icinga --with-nrpe-group=icinga --with-nagios-user=icinga --with-nagios-group=icinga #Ubuntu x86_x64
#For Ubuntu i386
#./configure --enable-command-args --with-ssl-lib=/usr/lib/i386-linux-gnu/ --with-nrpe-user=icinga --with-nrpe-group=icinga --with-nagios-user=icinga --with-nagios-group=icinga
make all
make install
make install-config

#Update Services File
echo “Adding nrpe to running services”
echo “nrpe 5666/tcp # Nagios NRPE” >>/etc/service
s

#Install Service / Daemon
make install-init #Ubuntu 13.x / 14.x

#systemctl enable nrpe.service #Ubuntu 15.x / 16.x / 17.x

#Open the incoming TCP port 5666 on your firewall. You will have to do this using firewall software, like firewall ufw.

#Update Configuration File
The file nrpe.cfg is where the following settings will be defined. It is located:

/usr/local/nagios/etc/nrpe.cfg

allowed_hosts=

At this point NRPE will only listen to requests from itself (127.0.0.1). If you wanted your nagios server to be able to connect, add it's IP address after a comma (in this example it's 10.25.5.2):

allowed_hosts=127.0.0.1,10.25.5.2

The following commands make the configuration changes described above.

sudo sh -c "sed -i '/^allowed_hosts=/s/$/,10.25.5.2/' /usr/local/nagios/etc/nrpe.cfg"
sudo sh -c "sed -i 's/^dont_blame_nrpe=.*/dont_blame_nrpe=1/g' /usr/local/nagios/etc/nrpe.cfg"

#Start Service / Daemon

Different Linux distributions have different methods of starting NRPE.

Ubuntu 13.x / 14.x

sudo start nrpe

Ubuntu 15.x / 16.x / 17.x

sudo systemctl start nrpe.service

Test NRPE

Now check that NRPE is listening and responding to requests.

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

You should see the output similar to the following:
NRPE v3.2.0

If you get the NRPE version number (as shown above), NRPE is installed and configured correctly.

You can also test from your Nagios host by executing the same command above, but instead of 127.0.0.1 you will need to replace that with the IP Address / DNS name of the machine with NRPE running.

Service / Daemon Commands

Different Linux distributions have different methods of starting / stopping / restarting / status NRPE.

Ubuntu 13.x / 14.x

sudo start nrpe
sudo stop nrpe
sudo restart nrpe
sudo status nrpe

Ubuntu 15.x / 16.x / 17.x

sudo systemctl start nrpe.service
sudo systemctl stop nrpe.service
sudo systemctl restart nrpe.service
sudo systemctl status nrpe.service

Installing The Nagios Plugins

NRPE needs plugins to monitor different parameters. T

#Install Latest Nagios plugins

cd /usr/local/src/
wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz
tar zxf nagios-plugins.tar.gz
cd nagios-plugins-release-2.2.1/
./tools/setup
./configure --enable-perl-modules
make
make install

#Test NRPE + Plugins

Using the check_load command to test NRPE:
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_load

You should see the output similar to the following:
OK - load average: 0.01, 0.13, 0.12|load1=0.010;15.000;30.000;0; load5=0.130;10.000;25.000;0; load15=0.120;5.000;20.000;0;

You can also test from your Nagios host by executing the same command above, but instead of 127.0.0.1 you will need to replace that with the IP Address / DNS name of the machine with NRPE running.

Exit mobile version