Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Monitoring Tools»How to Install Nagios NRPE Client on Ubuntu 20.04

    How to Install Nagios NRPE Client on Ubuntu 20.04

    By RahulMay 10, 20233 Mins Read

    NRPE is a client side application for executing Nagios plugins. The Nagios server communicate with remote system using this plugin. NRPE must be installed on all the remote systems needs to monitor by Nagios server. Nagios server sends instruction to the NRPE server using check_nrpe plugin.

    Advertisement

    In our previous tutorial, you have leaned about to install Nagios server on a Ubuntu 20.04 LTS system.

    Installing NRPE on Ubuntu 20.04

    Read more:
    How to Monitor Remote Linux System with Nagios
    How to Monitor Remote Linux System over SSH  
    

    This guide will help you to install NRPE on Ubuntu 20.04 LTS Linux systems.

    Step 1: Install Nagios Client 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 Nagios Client

    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 
    
     allowed_hosts=127.0.0.1, 192.168.1.100
    

    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 systemctl restart nagios-nrpe-server 
    

    Step 3: Verify Connection from Nagios

    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 v4.0.0
    

    The output “NRPE v4.0.0” shows that the Nagios server successfully communicated with NRPE.

    Step 4: Update Command Definitions for NRPE

    You must have define all the commands to be used by Nagios server. Some of them are pre-configured with the installation. You may required to change command definitions as per your system’s configuration. Also, you can add more customized commands to monitor your server.

    Edit the /etc/nagios/nrpe.cfg configuration file and search for COMMAND DEFINITIONS secitons. Here you can define or update check commands.

    sudo nano /etc/nagios/nrpe.cfg 
    
    /etc/nagios/nrpe.cfg
    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
    

    Save the configuration file and restart NRPE daemon to apply changes:

    sudo systemctl restart nagios-nrpe-server 
    

    All done.

    Step 5: Adjust Firewall

    The default NRPE service listen on port 5666. Use the following commands to open firewall port for NRPE service.

    sudo firewall-cmd --permanent --zone=public --add-port=5666/tcp  
    sudo firewall-cmd --reload  
    

    Conclusion

    This tutorial describes you the steps to install NRPE client on Ubuntu system. Also provides you instructions to add check command definitions.

    nagios NRPE
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Install Zabbix Agent on Ubuntu 22.04

    How to Install and Configure Nagios NRPE Client on Ubuntu 22.04

    How To Install and Configure Zabbix Server on Ubuntu 22.04

    View 2 Comments

    2 Comments

    1. Pravin Yadav on April 27, 2022 9:33 pm

      Hi Rahul,
      I have installed the Nagios NRPE Prometheus Exporter through on my Remote server (vagrant machine )this link https://www.robustperception.io/nagios-nrpe-prometheus-exporter , and NRPE plunging on my localhost machine through this given pdf- https://assets.nagios.com/downloads/nagioscore/docs/nrpe/NRPE.pdf .

      and executed this commands on my host..
      /usr/local/nagios/libexec/check_nrpe -H 192.168.**.*** (my vagrant IP address)

      it gives error – CHECK_NRPE: Error – Could not connect to 192.168.*******: Connection reset by peer

      how can I resolve this issue.
      Can you please help me out with this problem.???

      Thanks in advance.!!!!

      Reply
      • Rahul on April 28, 2022 6:13 am

        Hi Pravin,

        Generally, the error message you’re getting is a firewall blocking TCP/5666. Also, the NAGIOS server IP Address is not being listed in the NRPE daemon’s allowed_hosts.

        Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • A Comprehensive Look at the Simple Mail Transfer Protocol (SMTP)
    • Understanding Basic Git Workflow: Add, Commit, Push
    • The Difference Between Git Reset –soft, –mixed, and –hard
    • Understanding the Staging Area in Git’s Workflow
    • Python Function with Parameters, Return and Data Types
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.