Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Monitoring Tools»Nagios»How to Install Nagios Client (NRPE) on Ubuntu 20.04

    How to Install Nagios Client (NRPE) on Ubuntu 20.04

    RahulBy RahulJune 4, 20213 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.

    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 v2.15” 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
    Previous ArticleHow to Move a Directory to New Git Repository with Commit History
    Next Article Shell Script to Add Two Numbers

    Related Posts

    How to Install Nagios Server on Ubuntu 20.04

    Updated:June 3, 20213 Mins Read

    How To Install NRPE on LinuxMint 19/18

    Updated:December 6, 20182 Mins Read

    How to Monitor Memory, CPU and Disk on Linux using NRPE and Nagios

    Updated:January 11, 20183 Mins Read

    How to Create Own Nagios Plugin using Bash Shell Script

    Updated:December 1, 20172 Mins Read

    How To Install NRPE on CentOS/RHEL 7/6

    Updated:November 10, 20173 Mins Read

    How to Install NRPE on Ubuntu 18.04 & 16.04 LTS

    Updated:June 3, 20213 Mins Read

    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

    Recent Posts
    • How to run “npm start” through docker
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    • What is difference between var, let and const in JavaScript?
    • What is CPU? – Definition, Types and Parts
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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