• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Install NRPE on Ubuntu 18.04 & 16.04 LTS

Written by Rahul, Updated on March 24, 2020

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.

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
    

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

19 Comments

  1. Avatar thomas Reply
    December 28, 2020 at 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

  2. Avatar Tarandeep Reply
    November 2, 2020 at 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

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

      Hi Tarandeep,

      Which operating system are you using on your server?

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

    check_nrpe results in “command not found” sir

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

    (Return code of 255 is out of bounds)

  5. Avatar Arshad Reply
    March 17, 2019 at 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

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

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

  6. Avatar Muralidharan Reply
    April 23, 2018 at 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 .

  7. Avatar Sheen Ismhael Lim Reply
    August 8, 2017 at 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.

    • Rahul Rahul K. Reply
      August 8, 2017 at 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.

      • Avatar Sheen Ismhael Lim Reply
        August 8, 2017 at 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

  8. Avatar PRABHU KIRAN Reply
    May 24, 2017 at 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..) ?????

    • Rahul Rahul K. Reply
      May 26, 2017 at 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?

  9. Avatar prateek Reply
    May 18, 2017 at 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?

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

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

  11. Avatar Balaraju Reply
    April 23, 2016 at 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

  12. Avatar Balaraju Reply
    April 23, 2016 at 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.

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

    This is all client side rick.

  14. Avatar Rick Reply
    July 30, 2015 at 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.

Leave a Reply Cancel reply

Popular Posts

  • How To Install Python 3.9 on Ubuntu 20.04 5
  • How To Install Python 3.9 on Ubuntu 18.04 0
  • How to Use AppImage on Linux (Beginner Guide) 2
  • How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31 0
  • How To Install VNC Server on Ubuntu 20.04 1
© 2013-2020 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy