Skip to content

How to Install and Configure Nagios NRPE Client on Ubuntu 24.04

Steps
6
Covers
Nagios, Ubuntu
Versions & support
About Ubuntu →
On this page 6 steps

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 of 6Update Your System

First, make sure your system is up to date. Open the terminal and run:

sudo apt update
sudo apt upgrade

Step 2 of 6Install Nagios NRPE Client

Install the NRPE client and Nagios plugins by running:

sudo apt install nagios-nrpe-server nagios-plugins

Step 3 of 6Configure 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 of 6Start 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 of 6Verify 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 of 6Add Host to Nagios Server

Now, let’s add the Ubuntu server as a host in Nagios for monitoring.

  1. Create a Host Configuration File
  2. On your Nagios server, create a configuration file for the new host. For example:

    sudo nano /usr/local/nagios/etc/servers/ubuntu24.cfg
    

  3. Add Host Configuration
  4. 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                    24x7
    	notification_interval           30
    	notification_period             24x7
    }
    
    

  5. Add Service Configuration
  6. 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
    }
    
    

  7. Restart Nagios
  8. 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.

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top