NRPE (Nagios Remote Plugin Executor) is a Nagios plugin that allows you to execute Nagios plugins on remote Linux/Unix hosts. it’s allows you to remotely execute Nagios plugins on other Linux/Unix machines. This allows you to monitor remote machine metrics (disk usage, CPU load, etc.)
NRPE can also communicate with some of the Windows agent addons, so you can execute scripts and check metrics on remote Windows machines as well.
It is designed to allow you to execute plugins on remote machines and report the results back to your Nagios server. This allows you to monitor systems that are not directly connected to your Nagios server, such as servers in a remote data center or servers behind a firewall.
NRPE uses a small daemon that runs on the remote host and listens for incoming requests from the Nagios server. When it receives a request, it executes the plugin and returns the result to the Nagios server. NRPE is an important component of the Nagios system and is widely used to monitor remote systems.
In this tutorial, we’ll go over the steps to install NRPE on an Ubuntu machine.
Before we begin, make sure that you have a working Nagios server set up, NRPE is designed to work with Nagios, so you’ll need a Nagios server to monitor the remote machines.
How to install nrpe on Ubuntu 22.04
Before we start installing NRPE, we’ll need to install a few prerequisites:
1- Install the package build-essential, which includes the C compiler and other tools needed to build NRPE from source :
# sudo apt-get update # sudo apt-get install build-essential
2- Install the openssl library, which is required by NRPE :
# sudo apt-get install openssl libssl-dev
3- Install the xinetd daemon, which is used to run NRPE :
# sudo apt-get install xinetd
Installing NRPE :
Now that we have the prerequisites installed, we can proceed with the NRPE installation :
1- Download the NRPE source code from the Nagios website. At the time of writing, the latest version is NRPE 3.2.1, You can either download the tarball manually or use the wget command to download it :
# wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-3.2.1/nrpe-3.2.1.tar.gz
2- Extract the tarball :
# tar xvzf nrpe-3.2.1.tar.gz
3- Change into the NRPE directory :
# cd nrpe-3.2.1
4- Run the configure script :
# ./configure --enable-command-args
The –enable-command-args flag is optional, but it allows NRPE to accept arguments when executing plugins.
5- Compile and install NRPE :
# make all # sudo make install
Configuring NRPE :
Now that NRPE is installed, we need to configure it to work with our Nagios server.
1- Create a new NRPE configuration file :
# sudo nano /usr/local/nagios/etc/nrpe.cfg
2- Add the following lines to the configuration file, replacing NAGIOS_SERVER_IP with the IP address of your Nagios server :
3- Optionally, you can also configure NRPE to run specific plugins. To do this, add a line in the format command=. For example, to run the check_disk plugin, you would add the following line :
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10%
4- Next, restart NRPE service
Adjust Firewall :
# sudo firewall-cmd --permanent --zone=public --add-port=5666/tcp # sudo firewall-cmd --reload
Samba : Installation et Configuration sur Ubuntu 22.04
Comment vérifier la version d’apache
nmap : les 12 commandes que vous devez connaître
Trois commandes pour vérifier si un port est ouvert sur un système Linux distant
Fail2Ban : How to protect Linux services