How to Add Linux Host to Nagios Monitoring Server Using NRPE Plugin

If you have any questions or problems regarding this article and want help within 24 Hours? Ask Now

Support TecMint: Did you find this tutorial helpful?. Please help to keep it alive by donating. Every cent counts! - Donate Now

Ravi Saive

Simple Word a Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

Receive Your Free Complimentary eBook NOW! -

Download Free Linux eBooks

Advanced Bash-Scripting Guide
Linux Bible
A Newbie's Getting Started Guide to Linux
Introduction to Linux - A Hands on Guide

You may also like...

355 Responses

  1. Shweta says:

    Hi Ravi,

    I want to check the disk space usage of a mounted server. That is the path where to check the disk space is to be customized.
    I have installed nrpe plugin 2.14.
    After the installation, i have defined the remote service in localhost.cfg like this..
    define service{
    use generic-service ; Name of service template to use
    host_name step-sa-sjc0
    service_description Check Free space in /auto/ses/ location
    check_command check_nrpe!check_auto_ses
    }

    Changed the command.cfg as this:
    # ‘check_nrpe’ command definition
    define command{
    command_name check_nrpe
    command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
    }

    Finally the nrpr.cfg like this:
    dont_blame_nrpe = 1
    Added this line:
    command[check_auto_ses]=/opt/nagios/libexec/check_disk -w 20% -c 10% -p /auto/ses

    But its giving the error: “Connection refused by host.”

    I am not able to figure out the problem. Appreciate your help.

    Thanks

  2. Deepak says:

    Hi Ravi,

    I am configuring nagios nrpe plugin and getting below error. please assist.

    [root@nagiosClient Desktop]# netstat -at | grep 5666
    [root@nagiosClient Desktop]# /usr/local/nagios/libexec/check_nrpe -H 10.0.0.20
    connect to address 10.0.0.20 port 5666: Connection refused
    connect to host 10.0.0.20 port 5666: Connection refused
    [root@nagiosClientDesktop]/usr/local/nagios/libexec/usr/local/nagios/libexec/check_nrpe -H localhost
    connect to address ::1 port 5666: Connection refused
    connect to address 127.0.0.1 port 5666: Connection refused
    connect to host localhost port 5666: Connection refused
    [root@nagiosClient Desktop]#

    • Ravi Saive says:

      @Deepak,
      Please open the port 5666 on firewall and try again..

      • Deepak says:

        it will be fine if I turned off the firewall as of now? I already disabled Firewall and Selinux before testing..

        • Ravi Saive says:

          @Deepak,
          Yes not an issue, if you turnoff firewall for testing. After disabling firewall? will you able to see that the port 5666 is listening?

        • Deepak says:

          I turned on firewall and allowed port 5666.

          [root@nagiosClient Desktop]# service iptables status
          Table: filter
          Chain INPUT (policy ACCEPT)
          num target prot opt source destination
          1 ACCEPT all — 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
          2 ACCEPT icmp — 0.0.0.0/0 0.0.0.0/0
          3 ACCEPT all — 0.0.0.0/0 0.0.0.0/0
          4 ACCEPT tcp — 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
          5 ACCEPT tcp — 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5666
          6 REJECT all — 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
          7 ACCEPT tcp — 0.0.0.0/0 0.0.0.0/0 tcp dpt:5666

          Chain FORWARD (policy ACCEPT)
          num target prot opt source destination
          1 REJECT all — 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

          Chain OUTPUT (policy ACCEPT)
          num target prot opt source destination

          • Deepak says:

            How can i checked whether port 5666 is listening or not ?

            when I tried to run below command. nothing is coming out

            [root@nagiosClient Desktop]# netstat -at | grep 5666
            [root@nagiosClient Desktop]#

          • Ravi Saive says:

            @Deepak,
            Use telnet command to check 5666 port is listening or not:

            # telnet ipaddress 5666
            
          • Deepak says:

            Its not listening port 5666.

            [root@nagiosClient Desktop]# telnet 10.0.0.21 5666
            Trying 10.0.0.21…
            telnet: connect to address 10.0.0.21: Connection refused
            [root@nagiosClient Desktop]#

          • Ravi Saive says:

            @Deepak,
            I am sorry, but it’s clear from the error that your host not able to connect to port 5666..

          • Deepak says:

            Hi Ravi

            I configured everything on client host now. but now i am not able to get check_nrpe script on nagios server side.
            As per your steps we have to run below command to very nrpe daemon on server side

            [root@tecmint]# /usr/local/nagios/libexec/check_nrpe -H

            however check_nrpe does not exist in libexec directory.

            [root@NagiosServer nrpe-2.15]# /usr/local/nagios/libexec/check_
            check_apt check_jabber check_ping
            check_breeze check_ldap check_pop
            check_by_ssh check_ldaps check_procs
            check_clamd check_load check_real
            check_cluster check_log check_rpc
            check_dhcp check_mailq check_sensors
            check_dig check_mrtg check_simap
            check_disk check_mrtgtraf check_smtp
            check_disk_smb check_mysql check_spop
            check_dns check_mysql_query check_ssh
            check_dummy check_nagios check_ssmtp
            check_file_age check_nntp check_swap
            check_flexlm check_nntps check_tcp
            check_ftp check_nt check_time
            check_http check_ntp check_udp
            check_icmp check_ntp_peer check_ups
            check_ide_smart check_ntp_time check_uptime
            check_ifoperstatus check_nwstat check_users
            check_ifstatus check_oracle check_wave
            check_imap check_overcr
            check_ircd check_pgsql

          • Deepak says:

            Hi Ravi,

            Finally setted up everything as per your tutorial. But there are two points i want to raise.

            1. please make two changes in you tutorial.

            In Step 1. add below command
            [root@tecmint]# make install-Plugin

            On Server side:
            The correct path for hosts.cfg and services.cfg is /usr/local/nagios/etc/objects

            I think this difference is due to different versions of NRPE Plugin.

            2. I am still not able to see my client host on Web Interface of Nagios Server. it is showing maching in two ways i;e as localhost and as hostname of the machine. however client machine is still missing. please assit.

          • Ravi Saive says:

            @Deepak,

            Thanks for the findings and suggestions, let me give a try again and see if there is change in installation and configuration paths, we will make change as per new version of nrpe..thanks again..

          • Deepak says:

            I am still not able to see my client host on Web Interface of Nagios Server. it is showing my nagios server machine in two ways i;e as localhost and as a hostname of the machine. however client machine is still missing. please assist.

          • Deepak says:

            Your welcome. But my client machine is still not reflecting on Server side. Web Interface of Nagios is only showing Nagios server machine. I can’t attached the screenshot of nagios web interface. could you please share troubleshoot steps

          • Ravi Saive says:

            @Deepak,

            I am happy to help you, just send me your server login details at admin@tecmint.com..

          • Deepak says:

            Thank for your help.. I have shared the details with you. but not sure whether you can ping me or not as I have setup this machine on VM.

          • Ravi Saive says:

            @Deepak,
            Okay thanks for sharing information, you will surely get response from us..

      • hi Ravi,
        I could not able to download nrpe plugin for nagios monitor server by below url’
        wget http://garr.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz

        showing below error.
        [root@ip-172-31-16-82 nagios]# wget http://garr.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
        –2016-01-20 07:15:23– http://garr.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
        Resolving garr.dl.sourceforge.net (garr.dl.sourceforge.net)… failed: Name or service not known.
        wget: unable to resolve host address ‘garr.dl.sourceforge.net’
        [root@ip-172-31-16-82 nagios]#

        Kindly share correct url

        • Ravi Saive says:

          @Santanu,

          Thanks a ton for informing us, seems the link is dead now, added new working download link of nrpe plugin and sorry for trouble..

  3. Bikram says:

    Hi Ravi,
    Thanks a lot for nice presentation.
    I got stuck in two nagios servers for two sites:
    1. One site form client side says “CHECK_NRPE: Error – Could not complete SSL handshake.”. I tired all those techniques by adding allowed hosts in nrpe.cfg file/adding nagios ip in nrpe file….but failed. Can you please recommend what I should do.
    2. Another site, when I am going to browse the nagios web-interface it says “Error 404-File not found”

    I need your advice.

    Thanks
    bikram

    • Ravi Saive says:

      @Bikram,
      In first scenario, make sure that port 5666 port opened in remote Linux system on Firewall and also make sure that you’ve added Nagios Monitoring Server IP address in nrpe file under Xinetd..

      Second problem, could be SELinux, try to disable it and then try again or if you still get same problem that means your Nagios installation was unsuccessful.

  4. Miso says:

    There’s an error under NAGIOS MONITORING SERVER:
    Compile and install the NRPE addon.

    [root@tecmint]# ./configure
    [root@tecmint]# make all
    [root@tecmint]# make install-daemon

    it should be “make install-plugin”
    That’s why I got error “check_nrpe: No such file or directory.”

  5. Ferdz says:

    Hi,

    Any idea why check_nrpe is missing on the Hosts Server, I’ve installed as from your steps but cannot find the file check_nrpe from /usr/local/nagios/libexec/.

    • Ravi Saive says:

      @Ferdz,
      If check_nrpe is missing on the host, that means your installation was not successful. Please try to follow steps again carefully..

      • Ferdz says:

        Thanks for the reply Ravi, have managed to resolve the check_nrpe missing but now facing this error.

        CHECK_NRPE: Error – Could not complete SSL handshake.

        Still trying to figure out where the issue is. Any idea on this error?

        • Ferdz says:

          I’m getting this on the Monitoring Server by the way, the remote server seems to have installed smoothly.

        • Ravi Saive says:

          @Ferdz,
          Just add Nagios Monitoring Server IP address under xinetd directory in nrpe file like this:

          only_from = 127.0.0.1 localhost 
          

          Else follow Step 7 correctly in this article..

    • Deepak says:

      Run command
      make install-plugin

Leave a Reply

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

Join Over 95000+ Linux Users
  1. 66,682
  2. 3,836
  3. 31,647

Enter your email to get latest Linux Howto's