In this tutorial, we will show you how to install NRPE on Ubuntu 20.04 LTS. For those of you who didn’t know, Monitoring is a crucial aspect of any IT infrastructure, and Nagios is one of the most popular open-source monitoring solutions available. While Nagios Core can monitor local resources on the server it’s installed on, it requires additional components to monitor remote systems. This is where NRPE (Nagios Remote Plugin Executor) comes into play. NRPE allows Nagios to execute plugins on remote Linux/Unix hosts, enabling comprehensive monitoring of network services, system metrics, and more from a central location.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the Nagios Client (NRPE) on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
Prerequisites
- A server running one of the following operating systems: Ubuntu 20.04, 18.04, and any other Debian-based distribution like Linux Mint or elementary OS.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- An active internet connection.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install NRPE on Ubuntu 20.04 LTS Focal Fossa
Step 1. It’s always a good practice to update your system packages before installing new software. Open a terminal on your Ubuntu server and run the following commands:
sudo apt update sudo apt upgrade
This will ensure that your system is up-to-date with the latest security patches and bug fixes.
Step 2. Installing NRPE (Nagios Remote Plugin Executor) on Ubuntu 20.04.
NRPE packages are available under the default repositories on Ubuntu systems. Now run the following command to install it:
sudo apt install nagios-nrpe-server nagios-plugins
Once installed, verify the status of the NRPE agent using the following command:
sudo systemctl status nagios-nrpe-server
For additional resources on installing Nagios, read the post below:
Step 3. Configure NRPE.
Now we edit the NRPE configuration file /etc/nagios/nrpe.cfg
and make the necessary changes like below:
sudo nano /etc/nagios/nrpe.cfg
Add your Monitor server address to the allowed_hosts
parameter as a comma-separated list in the appropriate section:
allowed_hosts=127.0.0.1, 192.168.1.100
Save the changes and exit the configuration file. For the changes to take effect, be sure to restart the NRPE agent daemon:
sudo systemctl restart nagios-nrpe-server
You can verify the connection from the Nagios server to remote use check_nrpe
the script, which is available on the Nagios core server:
check_nrpe -H 192.168.1.11
Step 4. Configure Firewall Rules.
The default NRPE service listens on port 5666. Use the following commands to open the firewall port for NRPE service:
sudo firewall-cmd --permanent --zone=public --add-port=5666/tcp sudo firewall-cmd --reload
Congratulations! You have successfully installed NRPE. Thanks for using this tutorial for installing the Nagios Client (NRPE) on the Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you check the official Nagios website.