Installing Nagio NRPE on Ubuntu 18.04

A short tutorial on moving from Nagios NRPE using apt-get to source installation. We want to first remove all Nagios parts that were installed via apt:

sudo apt-get update
apt list --installed | grep nagios
nagios-nrpe-server/trusty,now 2.15-0ubuntu1 amd64 [installed]
nagios-plugins/trusty,now 1.5-3ubuntu1 all [installed]
nagios-plugins-basic/trusty,now 1.5-3ubuntu1 amd64 [installed,automatic]
nagios-plugins-common/trusty,now 1.5-3ubuntu1 amd64 [installed,automatic]
nagios-plugins-standard/trusty,now 1.5-3ubuntu1 amd64 [installed,automatic]
apt-get remove nagios-nrpe-server nagios-plugins nagios-plugins-basic nagios-plugins-common nagios-plugins-standard

Ensure we still have the nagios user:

sudo useradd nagios

Next, install the basics which will let us build NRPE:

sudo apt-get install build-essential openssl libssl-dev unzip make

Now we can download and install Nagios plugins:

cd /opt
curl -L -O
tar zxf nagios-plugins-*.tar.gz
cd nagios-plugins-*
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl
sudo make
sudo make install

Next install NRPE:

cd /opt
curl -L -O
tar zxf nrpe-*.tar.gz
cd nrpe-*
./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu
make all
sudo make install
sudo make install-config
sudo make install-init

Next, we need  to update the config file to suite your needs:

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

Most important is this setting:


Finally, start nrpe and make sure everything started correctly:

systemctl start nrpe.service
systemctl status nrpe.service
● nrpe.service - Nagios Remote Plugin Executor
      Loaded: loaded (/lib/systemd/system/nrpe.service; disabled; vendor preset: enabled)
      Active: active (running) since Mon 2021-01-25 16:08:52 UTC; 8s ago

Now from the Nagios server, ensure you can see NRPE:

/usr/local/nagios/libexec/check_nrpe -H remote_host_ip
NRPE v3.2.1