NRPE (Nagios Remote Plugin Executor) is used for executing Nagios plugins on remote client systems. In previous article we had described about installation of Nagios Server on Ubuntu operating system. This article will help you to install NRPE on Ubuntu 18.04 LTS, 16.04 LTS & LinuxMint 19/18 systems.
Step 1 – Install NRPE on Ubuntu
NRPE packages are available under the default repositories on Ubuntu systems. Open a terminal and run the following command to install:
sudo apt update sudo apt install nagios-nrpe-server nagios-plugins
Here nagios-nrpe-server package install service on system and nagios-plugins provides monitoring scripts, which is called with NRPE client on request of Nagios server.
Step 2 – Configure NRPE
In NRPE configuration, first we need to nrpe to which nagios servers it accepts requests, For example your Nagios server IP is 192.168.1.100, then add this IP to allowed hosts list. Edit NRPE configuration file /etc/nagios/nrpe.cfg and make the necessary changes like below:
sudo nano /etc/nagios/nrpe.cfg
We can allow multiple Nagios servers by a comma-separated list.
Next, restart NRPE service. Now it is ready to listen to requests from Nagios server
sudo /etc/init.d/nagios-nrpe-server restart
Step 3 – Verify Connection
Let’s verify the connection between the Nagios server and NRPE client machine. Login to your Nagios server and check the Nagios server can communicate with NRPE service properly.
Use check_nrpe command on the Nagios server under the plugins directory. The command will be like as below here 192.168.1.11 is the IP address of client machine.
check_nrpe -H 192.168.1.11 NRPE v2.15
The output “NRPE v2.15” shows that the Nagios server successfully communicated with NRPE.
Step 4 – Add Check Commands in NRPE
All the services check commands with the nagios plugins packages, which is by default installed in /usr/lib/nagios/plugins/ for 32 bit systems. Default installation adds few commands in configuration file. Add more commands as per your requirements like below
command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10 command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20 command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1 command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200
Step 5 – Manage NRPE Service
Use the following commands to start, stop or restart NRPE service. Each time we make any changes in the configuration file required to restart service
sudo /etc/init.d/nagios-nrpe-server stop sudo /etc/init.d/nagios-nrpe-server start sudo /etc/init.d/nagios-nrpe-server restart