Install Nagios-NRPE Client in Debian Machines

Follow Step by Step to Install Nrpe client in Remote servers you want to monitor from Nagios core

  1. Update Repository and install GCC

    apt-get update && apt-get upgrade -y
    apt-get install build-essential -y
    gcc -v
    make -v
    
  2. Create user which will run NRPE scripts in remote servers

    useradd nagios
    passwd nagios
    
  3. Nagios plugin download and install

    cd /tmp
    #wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
    wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
    tar -xzvf nagios-plugins-*.tar.gz
    rm nagios-plugins-*.tar.gz
    cd nagios-plugins-*
    apt-get install libssl-dev -y
    ./configure --with-nagios-user=nagios --with-nagios-group=nagios
    make
    make install
    chown nagios:nagios /usr/local/nagios
    chown -R nagios:nagios /usr/local/nagios/libexec
    apt-get install xinetd -y
    
  4. NRPE daemon download and install

    cd /tmp
    #wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-3.2.1/nrpe-3.2.1.tar.gz
    wget https://github.com/amitanvir/nagios-plugin-and-nrpe-installer/raw/master/nrpe-2.12.tar.gz
    tar -xzvf nrpe-*.tar.gz
    rm nrpe-*.tar.gz
    cd nrpe-*
    ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/libssl.so
    ./configure
    make all
    make install-plugin
    make install-daemon
    make install-daemon-config
    make install-xinetd
    
  5. Configure NRPE

    Edit Xinetd NRPE entry for adding Nagios Monitoring server to the “only_from” directive

    nano /etc/xinetd.d/nrpe

    only_from = 127.0.0.1 {nagios server ip}

    Edit services file for adding entry for nrpe daemon

    nano /etc/services

    nrpe 5666/tcp # NRPE

    Restart the NRPE service

    /etc/init.d/xinetd restart

    Test if NRPE is listening

    netstat -at | grep nrpe

    The output out this command should show something like this
    tcp 0 0 *:nrpe *:* LISTEN

    Next, check to make sure the NRPE daemon is functioning properly. To do this, run the check_nrpe plugin that was installed for testing purposes.

    /usr/local/nagios/libexec/check_nrpe -H localhost

    If everything is fine you will see this output:
    NRPE v2.12