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

    How to Install NRPE on Ubuntu 18.04 & 16.04 LTS

    By RahulJune 3, 20213 Mins Read

    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.

    Advertisement

    Install NRPE

    Useful Articles:

    • How to Monitor Remote Linux System with Nagios
    • How to Monitor Remote Linux System over SSH

    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
    
    /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 /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

    vim /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
    

    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
    

    check_nrpe monitoring nagios NRPE
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Bash Script to Monitor Disk Space and Notify

    Shell Script to Monitor Disk Space and Send Alert

    How to Install Nagios Client (NRPE) on Ubuntu 20.04

    Installing Nagios on Ubuntu

    How to Install Nagios Server on Ubuntu 20.04

    View 20 Comments

    20 Comments

    1. thomas on December 28, 2020 9:56 am

      CHECK_NRPE: (ssl_err != 5) Error – Could not complete SSL handshake with 192.168.0.172: 1
      how to resolve this issue
      my nagios server is installed in ubuntu 18.04
      and nrpe is installed in ubuntu 14.04

      all the remote host which as ubuntu 18.04 has no issue but for the os version below 16.04 is facing this issue

      Reply
      • Seren on January 21, 2021 10:48 pm

        This is probably due to the DH key being too small on the older ubuntu/nrpe. Try logging manually with “-g out.log -s -1” (example: /usr/local/nagios/libexec/check_nrpe -H ubuntu1404.example.com -g /tmp/out.log -s -1) and see if it says “dh key too small”. You may need to upgrade the version of nrpe you’re using on the older server.

        Reply
    2. Tarandeep on November 2, 2020 1:05 pm

      Hi rahul

      i have configured nagios on 50+ servers but for one of my server its showing this !!

      for disk
      DISK CRITICAL – /sys/kernel/debug/tracing is not accessible: Permission denied

      For memory
      NRPE: Unable to read output

      Reply
      • Rahul on November 2, 2020 1:20 pm

        Hi Tarandeep,

        Which operating system are you using on your server?

        Reply
    3. idntknow on January 13, 2020 12:26 pm

      check_nrpe results in “command not found” sir

      Reply
    4. Vikas on April 15, 2019 1:30 am

      (Return code of 255 is out of bounds)

      Reply
    5. Arshad on March 17, 2019 7:30 pm

      Hi
      i have installed the NRPE in one the server and I am trying to monitor the through the Nagios server I have little confusion about IP address
      which IP address should give while defining the host in Nagios server whether it is public Ip or private IP
      and the second one is in client side which Ip should I mention in whether it public Ip of Nagios server or the public Ip of Nagios server

      Reply
      • Rahul on March 18, 2019 9:50 am

        If you are connecting NRPE with LAN IP then add private IP. If connecting through public IP then use Public.

        Reply
    6. Muralidharan on April 23, 2018 2:01 pm

      HI..

      I have done nagios core in ubuntu 16.04LTS then installed and configured nrpe plug in and nrpe server finally i got the below error

      1153:~# check_nrpe -H 192.168.31.61
      check_nrpe: command not found

      check_nrpe not available .

      Reply
    7. Sheen Ismhael Lim on August 8, 2017 12:42 am

      Hello,

      I have a 2 Ubuntu 17.04 Server, 1 with nagios installed and NRPE client (plugin) installed, the other with NRPE Server installed.

      When I run check nrpe from the NRPE client, I have this result.
      [email protected]:/etc/nagios3/conf.d$ /usr/lib/nagios/plugins/check_nrpe -H 192.168.36.144 -c check_load
      CHECK_NRPE: Error – Could not connect to 192.168.36.144: Connection reset by peer
      [email protected]:/etc/nagios3/conf.d$ tail /var/log/syslog
      Aug 8 05:39:06 Server1 systemd[1]: Started Clean php session files.
      Aug 8 05:46:38 Server1 dhclient[948]: DHCPREQUEST of 192.168.36.137 on ens33 to 192.168.36.254 port 67 (xid=0x483d61d1)
      Aug 8 05:46:38 Server1 dhclient[948]: DHCPACK of 192.168.36.137 from 192.168.36.254
      Aug 8 05:46:38 Server1 dhclient[948]: bound to 192.168.36.137 — renewal in 807 seconds.
      Aug 8 05:49:55 Server1 check_nrpe: Error: Could not complete SSL handshake with 192.168.36.144: rc=-1 SSL-error=5
      Aug 8 05:54:15 Server1 systemd[1682]: Time has been changed
      Aug 8 05:54:15 Server1 systemd[1]: Time has been changed
      Aug 8 05:54:15 Server1 systemd[1]: apt-daily.timer: Adding 7h 35min 17.413926s random time.
      Aug 8 05:54:15 Server1 systemd[1]: snapd.refresh.timer: Adding 3h 28min 6.371800s random time.
      Aug 8 05:56:09 Server1 check_nrpe: Error: Could not complete SSL handshake with 192.168.36.144: rc=-1 SSL-error=5

      On the NRPE Server side, these are the logs that are shown.
      [email protected]:~$ tail /var/log/syslog
      Aug 8 05:35:23 Server3 dhclient[878]: DHCPACK of 192.168.36.144 from 192.168.36.254
      Aug 8 05:35:23 Server3 dhclient[878]: bound to 192.168.36.144 — renewal in 770 seconds.
      Aug 8 05:46:07 Server3 kernel: [28496.550944] perf: interrupt took too long (3452 > 3148), lowering kernel.perf_event_max_sample_rate to 57750
      Aug 8 05:48:13 Server3 dhclient[878]: DHCPREQUEST of 192.168.36.144 on ens33 to 192.168.36.254 port 67 (xid=0x2aed808)
      Aug 8 05:48:13 Server3 dhclient[878]: DHCPACK of 192.168.36.144 from 192.168.36.254
      Aug 8 05:48:13 Server3 dhclient[878]: bound to 192.168.36.144 — renewal in 824 seconds.
      Aug 8 05:49:55 Server3 nrpe[15350]: Error: Request packet version was invalid!
      Aug 8 05:49:55 Server3 nrpe[15350]: Could not read request from client 192.168.36.137, bailing out…
      Aug 8 05:56:09 Server3 nrpe[15357]: Error: Request packet version was invalid!
      Aug 8 05:56:09 Server3 nrpe[15357]: Could not read request from client 192.168.36.137, bailing out…

      Any ideas why the SSL Handshake is failing? I’m just started to learn linux nagios and I’m quite lost.

      Reply
      • Rahul K. on August 8, 2017 9:36 am

        It looks you didn’t allowed Nagios server in NRPE configuration. Please check Step 2.

        Also, make sure NRPE port is accessible to Nagios server.

        Reply
        • Sheen Ismhael Lim on August 8, 2017 10:15 am

          Hi Rahul,

          Actually, I did.

          I have added the server address where the “nagios-nrpe-server” is installed (which is the target server).

          192.168.36.137 – Is the server where nagios is and the “nagios-nrpe-plugin” is installed.

          Please see image below via link, I am being blocked by your website when posting the content of the nrpe.cfg
          !ApePyXZrHH4NhvETTo34dpVlLigTcg

          Reply
    8. PRABHU KIRAN on May 24, 2017 8:38 pm

      Hi Rahul,
      For Nagios Server I am choosing ” Amazon Linux AMI 2017.03.0 (HVM), SSD Volume Type – ami-c58c1dd3 ”
      And I try to add CentOs, Ubuntu, Windows Servers. It taking only Centos and AWS Linux servers, But I try to ADD Ubuntu And Window I am getting Error:

      [[email protected] nagios]# vim nagios.cfg
      [[email protected] nagios]# service nagios restart
      Running configuration check… CONFIG ERROR! Restart aborted. Check your Nagios configuration.

      If I uncomment the Ubuntu Path in Nagios.cfg file (Ubuntu Server :#cfg_file=/etc/nagios/servers/ProdAppEmpi.cfg), It’s Working.

      [[email protected] nagios]# vim nagios.cfg
      [[email protected] nagios]# service nagios restart
      Running configuration check…done.
      Stopping nagios: done.
      Starting nagios: done.

      Here My question is, does we choosing Centos for Nagios server it Accept only centos Server for Remote monitoring. And If we choose Ubuntu Does it accept only Ubuntu servers.

      We do have any Option to add all types of NRPE (Remote Monitor Servers) to one Nagios Server(either centos r Ubuntu r windows..etc..) ?????

      Reply
      • Rahul K. on May 26, 2017 3:59 am

        Hi Prabhu,

        You can install Nagios on any OS and it will monitor everything. There will be some issue with ProdAppEmpi.cfg configuration file. Can you please show me this file content?

        Reply
    9. prateek on May 18, 2017 2:18 am

      HI Rahul..i have been trying to install nagios for monitoring purpose. I have got the nagios dashbord also but the hosts i am adding are not reflecting. Kindly suggest which are the necessary confg files where i need to make changes? Also tell me how to configure email and sms alerts in nagios?

      Reply
    10. Singh on April 15, 2017 5:11 pm

      check_nrpe did not work until I added the /usr/lib/nagios/plugins into the environments file. Overall nice work.

      Reply
    11. Balaraju on April 23, 2016 7:32 am

      I am getting this below error.
      cpu_load
      CRITICAL 04-23-2016 12:59:11 0d 21h 50m 33s 3/3 (No output on stdout) stderr: execvp(/usr/lib/nagios/plugins/check_nrpe, …) failed. errno is 2: No such file or directory

      Myserver is centos4.0.8 and client is ubuntu

      Reply
    12. Balaraju on April 23, 2016 7:31 am

      I have done all the steps i am able to communicate to client. i am getting the check_load also from server end.but it is not displayed on nagios web page.

      Reply
    13. common-sense on October 27, 2015 9:32 pm

      This is all client side rick.

      Reply
    14. Rick on July 30, 2015 11:45 am

      The problem with this explanation, every explanation so far, is that it isn’t clear weather your talking about the Nagios server or Client side configuration.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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