Nagios is a powerful tool for monitoring your IT infrastructure. It helps keep track of system performance and alerts you to any issues. In this guide, we’ll walk you through how to install and configure the Nagios NRPE (Nagios Remote Plugin Executor) client on Ubuntu 24.04. We’ll also show you how to add a host on the Nagios server for monitoring.
What You Need
A server running Ubuntu 24.04
Nagios server already set up and running
Basic understanding of Linux commands
Step 1: Update Your System
First, make sure your system is up to date. Open the terminal and run:
sudo apt update
sudo apt upgrade
Step 2: Install Nagios NRPE Client
Install the NRPE client and Nagios plugins by running:
sudo apt install nagios-nrpe-server nagios-plugins
Step 3: Configure NRPE
Edit the NRPE configuration file to allow connections from your Nagios server. Open the file using a text editor:
sudo nano /etc/nagios/nrpe.cfg
Find the line that starts with allowed_hosts and add your Nagios server IP address. It should look like this:
allowed_hosts=127.0.0.1,<Nagios_Server_IP>
Save and close the file (press CTRL + X, then Y, and Enter).
Step 4: Start and Enable NRPE Service
Start the NRPE service and enable it to start on boot:
sudo systemctl start nagios-nrpe-server
sudo systemctl enable nagios-nrpe-server
Step 5: Verify NRPE Configuration
Ensure NRPE is working correctly by running the following command from your Nagios server. Replace <Client_IP> with the IP address of your Ubuntu server:
/usr/lib/nagios/plugins/check_nrpe -H <Client_IP>
You should see a response like this:
NRPE v4.0.3
Step 6: Add Host to Nagios Server
Now, let’s add the Ubuntu server as a host in Nagios for monitoring.
Create a Host Configuration File
On your Nagios server, create a configuration file for the new host. For example:
sudo nano /usr/local/nagios/etc/servers/ubuntu24.cfg
Add Host Configuration
Add the following configuration to the file. Replace <Host_Name> and <Client_IP> with appropriate values.
define host {
use linux-server
host_name <Host_Name>
alias Ubuntu 24.04 Server
address <Client_IP>
max_check_attempts 5
check_period 24×7
notification_interval 30
notification_period 24×7
}
Add Service Configuration
To monitor services like disk usage, CPU load, and memory usage, add the following configuration in the same file:
define service {
use generic-service
host_name <Host_Name>
service_description Check Disk
check_command check_nrpe!check_disk
}
define service {
use generic-service
host_name <Host_Name>
service_description Check Load
check_command check_nrpe!check_load
}
define service {
use generic-service
host_name <Host_Name>
service_description Check Memory
check_command check_nrpe!check_mem
}
Restart Nagios
Restart the Nagios service to apply the changes:
sudo systemctl restart nagios
Conclusion
You have successfully installed and configured the Nagios NRPE client on Ubuntu 24.04. You also added your Ubuntu server as a host on the Nagios server for monitoring. Now, Nagios will keep an eye on your server’s health and alert you if anything goes wrong.
The post How to Install and Configure Nagios NRPE Client on Ubuntu 24.04 appeared first on TecAdmin.
Source: Read More