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

In the first part of the Nagios series article, we’ve explained in detail how to install and configure the latest version of Nagios Core and Nagios Plugins in RHEL-based distributions such as CentOS Stream, Rocky Linux, AlmaLinux, and Fedora.

In this article, we will show you how to add a Remote Linux machine and its services to the Nagios Core Monitoring host using NRPE (Nagios Remote Plugin Executor) agent.

We hope you already have Nagios Core installed and running properly. If not, please use the following installation guide to install it on the system.

If you are planning to add a remote Windows host to the Nagios monitoring server, use the following guide:

Once you’ve installed it, you can proceed further to install the NRPE agent on your Remote Linux host. Before heading further, let us give you a short description of NRPE.

What is NRPE?

The NRPE (Nagios Remote Plugin Executor) plugin allows you to monitor any remote Linux/Unix services, network devices, or resources like CPU load, Swap, Memory usage, Online users, etc. on local/remote Linux machines.

After all, these local resources are not mostly exposed to external machines, an NRPE agent must be installed and configured on the remote machines.

Note: The NRPE addon requires that Nagios Plugins must be installed on the remote Linux machine. Without these, the NRPE daemon will not work and will not monitor anything.

Installation of NRPE Plugin in Nagios Server and Remote Linux Host

To use the NRPE, you will need to do some additional tasks on both the Nagios Monitoring Server and the Remote Linux Host that the NRPE is installed on. We will be covering both installation parts separately.

Installing Nagios Plugins and NRPE On Remote Linux Host

Please use the below instructions to install Nagios Plugins and NRPE daemon on the Remote Linux Host.

Step 1: Install Required Dependencies

We need to install required libraries like gcc, glibc, glibc-common, and GD and its development libraries using the yum package manager.

# yum install -y gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel tar wget
Step 2: Create Nagios User

Create a new nagios user account and set a password.

# useradd nagios
# passwd nagios
Step 3: Install the Nagios Plugins

Create a directory for nagios plugin installation and all its future downloads.

# mkdir /root/nagios
# cd /root/nagios

Now download the latest Nagios Plugins package with the wget command.

# wget https://nagios-plugins.org/download/nagios-plugins-2.3.3.tar.gz
Step 4: Extract Nagios Plugins

Run the following tar command to extract the source code tarball.

# tar -xvf nagios-plugins-2.3.3.tar.gz

After, extracting one new folder will appear in that directory.

# ls -l

total 2724
drwxr-xr-x. 15 root root    4096 Mar 11  2020 nagios-plugins-2.3.3
-rw-r--r--.  1 root root 2782610 Mar 11  2020 nagios-plugins-2.3.3.tar.gz
Step 5: Compile and Install Nagios Plugins

Next, compile and install nagios plugins using the following commands

# cd nagios-plugins-2.3.3
# ./configure 
# make
# make install

Set the permissions on the plugin directory using the chown command.

# chown nagios.nagios /usr/local/nagios
# chown -R nagios.nagios /usr/local/nagios/libexec
Step 6: Installing NRPE Plugin

To install the nrpe plugin, first, download the latest NRPE Plugin or use the following wget command.

# cd /root/nagios
# wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-4.0.2/nrpe-4.0.2.tar.gz

Unpack the NRPE source code tarball.

# tar xzf nrpe-4.0.2.tar.gz
# cd nrpe-4.0.2

Compile and install the NRPE addon.

# ./configure
# make all

Note: If you get the following error while running the ‘make all‘ command:

In file included from ../include/common.h:34,
                 from ./nrpe.c:38:
/usr/include/openssl/err.h:413:15: note: declared here
  413 | unsigned long ERR_get_error_line_data(const char **file, int *line,
      |               ^~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccWQBjHb.o: in function `init_ssl':
/root/nagios/nrpe-4.0.2/src/./nrpe.c:474: undefined reference to `get_dh2048'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:48: nrpe] Error 1

Then, you need to disable SSL for nrpe configuration with ./configure --disable-ssl flag as shown.

# ./configure --disable-ssl
# make all

Next, install the NRPE plugin daemon, and sample config files.

# make install-plugin
# make install-daemon
# make install-config

Install the NRPE daemon under systemd as a service.

# make install-init
Step 7: Configuring NRPE Plugin

Now open /usr/local/nagios/etc/nrpe.cfg file and add the local host and IP address of the Nagios Monitoring Server.

allowed_hosts=127.0.0.1,192.168.102

Next, enable and restart the nrpe service.

# systemctl enable nrpe
# systemctl restart nrpe
Step 8: Open NRPE Port in Firewall

Make sure that the Firewall on the local machine will allow the NRPE daemon to be accessed from remote servers. To do this, run the following iptables command.

# firewall-cmd --zone=public --add-port=5666/tcp
# firewall-cmd --zone=public --add-port=5666/tcp --permanent
Step 8: Verify NRPE Daemon Locally

Run the following netstat command to verify the NRPE daemon working correctly under systemd.

# netstat -at | grep nrpe
OR
# netstat -na | grep "5666"


tcp        0      0 0.0.0.0:nrpe            0.0.0.0:*               LISTEN     
tcp6       0      0 [::]:nrpe               [::]:*                  LISTEN 

If you get output similar to the above, means it working correctly. If not, make sure to check the following things.

  • Make sure to check that the nrpe entry is correctly added in the/etc/services file.
  • The allowed_hosts contains an entry for “nagios_ip_address” in the /usr/local/nagios/etc/nrpe.cfg file.
  • Check for the errors in the system log files for about nrpe and fix those problems.

Next, verify the NRPE daemon is functioning properly by running the “check_nrpe” command that was installed earlier for testing purposes.

# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1

You will get the following string on the screen, it shows you what version of NRPE is installed:

NRPE v4.0.2
Step 9: Customize NRPE Commands

The default NRPE configuration file that got installed has several command definitions that will be used to monitor this machine. The sample configuration file is located at.

# vi /usr/local/nagios/etc/nrpe.cfg

The following are the default command definitions that are located at the bottom of the configuration file. For the time being, we assume you are using these commands. You can check them by using the following commands.

# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_users

USERS OK - 1 users currently logged in |users=1;5;10;0
# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_load

OK - load average: 3.90, 4.37, 3.94|load1=3.900;15.000;30.000;0; load5=4.370;10.000;25.000;0; load15=3.940;5.000;20.000;0;
# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_hda1

DISK OK - free space: /boot 154 MB (84% inode=99%);| /boot=29MB;154;173;0;193
# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_total_procs

PROCS CRITICAL: 297 processes
# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_zombie_procs

PROCS OK: 0 processes with STATE = Z

You can edit and add new command definitions by editing the NRPE config file. Finally, you’ve successfully installed and configured NRPE agent on the Remote Linux Host.

Now it’s time to install an NRPE component and add some services to your Nagios Monitoring Server

Installing NRPE On Nagios Monitoring Server

Now login into your Nagios Monitoring Server. Here you will need to do the following things:

  • Install the check_nrpe plugin.
  • Create a Nagios command definition using the check_nrpe plugin.
  • Create a Nagios host and add service definitions for monitoring the remote Linux host.
Step 1: Install NRPE Plugin in Nagios

Go to the nagios download directory and download the latest NRPE Plugin or use the following wget command.

# cd /root/nagios
# wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-4.0.2/nrpe-4.0.2.tar.gz

Unpack the NRPE source code tarball.

# tar xzf nrpe-4.0.2.tar.gz
# cd nrpe-4.0.2

Compile and install the NRPE addon.

# ./configure
# make all
# make install-plugin
# make install-daemon
# make install-init
Step 2: Verify NRPE Daemon Remotely

Make sure that the check_nrpe plugin can communicate with the NRPE daemon on the remote Linux host. Add the IP address in the command below with the IP address of your Remote Linux host.

# /usr/local/nagios/libexec/check_nrpe -H <remote_linux_ip_address>

You will get a string back that shows you what version of NRPE is installed on the remote host, like this:

NRPE v4.0.2

If your receive a plugin time-out error, then check the following things.

  • Make sure your firewall isn’t blocking the communication between the remote host and the monitoring host.
  • Make sure that the NRPE daemon is installed correctly under systemd.
  • Make sure that the remote Linux host firewall rules block the monitoring server from communicating with the NRPE daemon.

Adding Remote Linux Host to Nagios Monitoring Server

To add a remote host you need to create two new files “hosts.cfg” and “services.cfg” under the “/usr/local/nagios/etc/” location.

Step 1: Creating Nagios Host and Services File
# cd /usr/local/nagios/etc/
# touch hosts.cfg
# touch services.cfg

Now add these two files to the main Nagios configuration file. Open the nagios.cfg file with any editor.

# vi /usr/local/nagios/etc/nagios.cfg

Now add the two newly created files as shown below.

# You can specify individual object config files as shown below:
cfg_file=/usr/local/nagios/etc/hosts.cfg
cfg_file=/usr/local/nagios/etc/services.cfg
Step 2: Configuring Nagios Host and Services File

Now open hosts.cfg file and add the default host template name and define remote hosts as shown below. Make sure to replace host_name, alias, and address with your remote host server details.

# vi /usr/local/nagios/etc/hosts.cfg
## Default Linux Host Template ##
define host{
name                            linux-box               ; Name of this template
use                             generic-host            ; Inherit default values
check_period                    24x7        
check_interval                  5       
retry_interval                  1       
max_check_attempts              10      
check_command                   check-host-alive
notification_period             24x7    
notification_interval           30      
notification_options            d,r     
contact_groups                  admins  
register                        0                       ; DONT REGISTER THIS - ITS A TEMPLATE
}

## Default
define host{
use                             linux-box               ; Inherit default values from a template
host_name                       tecmint		        ; The name we're giving to this server
alias                           CentOS 6                ; A longer name for the server
address                         5.175.142.66            ; IP address of Remote Linux host
}

Next open services.cfg file and add the following services to be monitored.

# vi /usr/local/nagios/etc/services.cfg
define service{
        use                     generic-service
        host_name               tecmint
        service_description     CPU Load
        check_command           check_nrpe!check_load
        }

define service{
        use                     generic-service
        host_name               tecmint
        service_description     Total Processes
        check_command           check_nrpe!check_total_procs
        }

define service{
        use                     generic-service
        host_name               tecmint
        service_description     Current Users
        check_command           check_nrpe!check_users
        }

define service{
        use                     generic-service
        host_name               tecmint
        service_description     SSH Monitoring
        check_command           check_nrpe!check_ssh
        }

define service{
        use                     generic-service
        host_name               tecmint
        service_description     FTP Monitoring
        check_command           check_nrpe!check_ftp
        }
Step 3: Configuring NRPE Command Definition

Now NRPE command definition needs to be created in commands.cfg file.

# vi /usr/local/nagios/etc/objects/commands.cfg

Add the following NRPE command definition at the bottom of the file.

###############################################################################
# NRPE CHECK COMMAND
#
# Command to use NRPE to check remote host systems
###############################################################################

define command{
        command_name check_nrpe
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
        }

Finally, verify Nagios Configuration files for any errors.

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Total Warnings: 0
Total Errors:   0

Finally, restart Nagios to apply recent configuration changes:

# systemctl restart nagios
Step 4: Monitoring Remote Linux in Nagios

Now go to the Nagios Monitoring Web interface at “http://Your-server-IP-address/nagios” or “http://FQDN/nagios” and Provide the username “nagiosadmin” and password. Check that the Remote Linux Host was added and is being monitored.

Monitoring Remote Linux Host in Nagios
Monitoring Remote Linux Host in Nagios
Conclusion

That’s it! for now, in my upcoming article, I will show you how to add a Windows host to Nagios monitoring Server. If you’re facing any difficulties while adding the remote host to Nagios.

Please do comment on your queries or problem via the comment section, till then stay tuned to Tecmint.com for more such valuable articles.

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

526 Comments

Leave a Reply
  1. Hi Ravi

    Great Article and tutorial!

    I need your help!
    I have 50 host that I want to add to Nagios for monitoring.
    I am correct to say that I must add 50 host entries to the /usr/local/nagios/etc/hosts.cfg and 250 (50 x5) entries in the /usr/local/nagios/etc/services.cfg file?

    I completely understand the benefit once it is configured but is there a better way?

    thanks in advance for you help

    Reply
  2. Hi, thanks for the tutorial.

    I have an error when i try to verify my nagios.cfg file though.

    It says, template generic_servce specified in service definition could not be found (config file /usr/local/nagios/etc/services.cfg) also i can run nagios on the web but when i try to click lets say…services it says that Error: Could not read object configuration data!, I am assuming because the config file is wrong.

    Thanks!

    Reply
    • @Aleks,

      Have you created services.cfg file under /usr/local/nagios/etc/ and added the entry in nagios.cfg file? if yes, could you share the services.cfg file entries with us? let me take a look and give you a proper solution..

      Reply
  3. Hi, I am not able to find below file… what I am missing here ? :-(

    Now open /etc/xinetd.d/nrpe file and add the localhost and IP address of the Nagios Monitoring Server.

    Reply
    • @Jose,

      Thanks for finding this article useful, yes there were some mistakes even I faced for NRPE version 3.0 during my setup on CentOS 7.2 and CentOS 6.8, will modify and add the correct steps for nrpe 3.0 source installation..

      Reply
  4. [root@localhost nrpe-3.0]# make install-inetd
    No inetd file to install
    make: *** [install-inetd] Error 1
    ==========================================================
    Hello I encountered this problem, ask where the problem lies
    thanks

    Reply
  5. Thanks for Sharing nagios is working cool.
    if i have to add multiple hosts for monitoring ? so we need to add continues adding in this file ? /usr/local/nagios/etc/services.cfg

    Reply
  6. Hi Ravi,

    I successfully configured the nagios server, but facing problem with Nrpe3.0, so I went with Nrpe2.14 version, but again ./configure stopped at SSL headers Error.

    To sort this out I proceeded with installation of Openssl-devel package through yum, but that also failed seeking dependencies. And dependencies also need more dependencies which creates chain of packages to be installed.

    Would be grateful to you if you could suggest some alternatives.
    Thanks!

    Reply
    • @Anu,

      The error is clear that you don’t have SSL headers installed on the system and that can be fixed installing:

      yum install openssl-devel
      
      Reply
  7. HI,

    I am facing below error, while installing npre deamon.

    # make install-daemon-config
    make: *** No rule to make target `install-daemon-config’. Stop.

    Reply
      • Hi Ravi,

        I was following the instructions the to run make install-deamon-config after running the yum groupinstall “Development Tools” and after doing that when i run make install-daemon-config commnad i am having the same output:

        make: *** No rule to make target `install-daemon-config’. Stop.

        due to this i am not able to see /etc/xientd.d/nrpe file to add the nagios host IP

        Please suggest.

        Ankit

        Reply
        • Ravi, I am also getting the same error even after installing “Development Tools”.

          Its been 3 days, now i am loosing hope ..Please Help,if you can…Thanks

          Reply
          • I also want to mention here the O.P. of “make install-plugin” & “make install-daemon”
            > showing “make[1]: Leaving directory `/root/nagios/nrpe-3.0/src'”
            is it OK to have this in O.P.

            #make install-plugin
            cd ./src/; make install-plugin
            make[1]: Entering directory `/root/nagios/nrpe-3.0/src'
            /usr/bin/install -c -m 755 -d /usr/local/nagios/bin
            /usr/bin/install -c -m 755 ../uninstall /usr/local/nagios/bin/nrpe-uninstall
            /usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/libexec
            /usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/libexec
            /usr/bin/install -c -m 775 -o nagios -g nagios check_nrpe /usr/local/nagios/libexec
            make[1]: Leaving directory `/root/nagios/nrpe-3.0/src'
            
            
            
            #make install-daemon
            cd ./src/; make install-daemon
            make[1]: Entering directory `/root/nagios/nrpe-3.0/src'
            /usr/bin/install -c -m 755 -d /usr/local/nagios/bin
            /usr/bin/install -c -m 755 ../uninstall /usr/local/nagios/bin/nrpe-uninstall
            /usr/bin/install -c -m 755 nrpe /usr/local/nagios/bin
            make[1]: Leaving directory `/root/nagios/nrpe-3.0/src'
            
            # make install-daemon-config
            make: *** No rule to make target `install-daemon-config'.  Stop.
            
          • @Randeep,

            I think some issues with latest NRPE Plugin, give me a day let me check in my CentPS 7 box, and will get back to you with solution. Till, then I suggest you to use NRPE 2.x version and see..

  8. Has anyone found a somewhat simple way to add remote host service checks to Nagios server using automation (Chef, HTTP POST, etc.)? There are some ideas floating around, but haven’t been able to find what I need.

    Reply
    • What could be the simplest way than this ? I’ve created a bash script doing this by connecting to remote host and running the installation script

      Reply
  9. hiii
    i m facing this error how can remove it and how can share my screen shot

    CHECK_NRPE: Socket timeout after 10 seconds.

    Reply
    • @Abhishek,

      Socket timeout error related to your network connection, make sure there isn’t any network issues between two servers..

      Reply
  10. HI Ravi

    Ravi it seems the configuration is not complete, you did used default templates for commands but some how they are not working, I’m getting error monitoring ssh:
    OK – load average: 0.01, 0.02, 0.05
    USERS OK – 0 users currently logged in
    NRPE: Command ‘check_ssh’ not defined

    SSH is something installed on the server by default

    Regards

    Reply
    • @Zack,

      You need to define check_ssh command in services.cfg file in Nagios monitoring server as well as in nrpe.cfg file on host machine..

      Reply
      • @Ravi , when i create another file under /usr/local/nagios/etc , after putting entry in nagios.cfg then error comes like Nagios Configuration error: “Unexpected token or statement in file” during Pre-flight check
        configuration nagios

        Comes ! Why ?

        Reply
  11. Im getting error while executing below commands.

    [root@Test2 nrpe-3.0]# make install-daemon-config
    make: *** No rule to make target `install-daemon-config’. Stop.

    [root@Test2 nrpe-3.0]# make install-xinetd
    make: *** No rule to make target `install-xinetd’. Stop.

    And im not able to see nrpe file at /etc/xinetd.d/

    I have made /etc/service entry for NRPE,
    But not able to see port 5666 open.
    Please reply.

    Reply
  12. this article is not working or not proper steps.. i have try 3 times this article but when try to install nrpe 3.0 configuration it shows [root@vps nrpe-3.0]# make install-daemon-config
    make: *** No rule to make target `install-daemon-config’. Stop. this error and more…..please tell me what is the issue

    Reply
    • after ./configure during nrpe installation , use below steps , forgot article steps

      make all
      make nrpe
      make check_nrpe
      make install-groups-users
      make install
      make install-plugin
      make install-daemon
      make install-config
      make install-inetd
      make install-init

      Reply
  13. im try to install make install-daemon-config but it can’t executed ?????????????

    im getting this error while install make install-daemon-config command [root@vps nrpe-3.0]# make install-daemon-config
    make: *** No rule to make target `install-daemon-config’. Stop.

    Reply
  14. any one help me for nagios Compile and install the NRPE addon ./configure command run time error.

    checking for type of socket size… size_t
    checking for Kerberos include files… configure: WARNING: could not find include files
    checking for pkg-config… pkg-config
    checking for SSL headers… configure: error: Cannot find ssl headers
    [root@localhost nrpe-3.0]#

    Reply
  15. Hi Ravi,

    I followed your procedures for both Nagios server set up and a remote machine setup. I am getting following error for verify NRPE daemon remotely.

    [root@nagios-server]# /usr/local/nagios/libexec/check_nrpe -H nagios-client
    CHECK_NRPE: Receive header underflow – only 0 bytes received (4 expected).
    [root@nagios-server etc]#

    log message from Nagios-server as follows
    Aug 26 14:44:23 nagios-server check_nrpe: Remote nagios-client does not support Version 3 Packets
    Aug 26 14:44:23 nagios-server check_nrpe: Remote nagios-client accepted a Version 2 Packet

    log message from Nagios-client as follows
    Aug 26 14:46:00 nagios-client xinetd[62465]: START: nrpe pid=24359 from=::ffff:10.251.226.114
    Aug 26 14:46:00 nagios-client nrpe[24359]: Error: Could not complete SSL handshake with : 1
    Aug 26 14:46:00 nagios-client xinetd[62465]: EXIT: nrpe status=0 pid=24359 duration=0(sec)

    I googled to get know more about the error, but couldn’t get the correct answer. You have any idea about the error?

    Thanks

    Reply
    • @Kishor,

      Make sure you have the same NRPE version installed on the both Nagios server and remote Linux client, and also make sure to add Nagios Server IP address in remote Linux nrpe.cfg file under Xinetd file..

      Reply
      • Hi Ravi,

        They both(Nagios server and remote client) at same version.

        [root@kinagios-server]# /usr/local/nagios/libexec/check_nrpe -V

        NRPE Plugin for Nagios
        Copyright (c) 1999-2008 Ethan Galstad ([email protected])
        Version: nrpe-3.0
        Last Modified: 07-12-2016
        License: GPL v2 with exemptions (-l for more info)
        =======================================================
        [root@nagios-client ~]# /usr/local/nagios/libexec/check_nrpe -V

        NRPE Plugin for Nagios
        Copyright (c) 1999-2008 Ethan Galstad ([email protected])
        Version: nrpe-3.0
        Last Modified: 07-12-2016
        License: GPL v2 with exemptions (-l for more info)
        SSL/TLS Available: OpenSSL 0.9.6 or higher required

        Also Nagios Server IP address existing in remote Linux nrpe.cfg file and in Xinetd file.

        I am wondering why its accepting only v2 packets even if they are at 3.0 version of NRPE

        Thanks!
        Kishore

        Reply
        • @Kishore,

          Thanks for sharing the details about NRPE version on both servers, seems strange problem, let me check and get back to you…

          Reply
          • Hello Ravi,

            I have the same issue: both server and client are both version: nrpe-3.0.

            Do you have any update on this?

          • @Kay,

            I think the issue with the latest Nrpe 3.0 version, might have been some bugs, try to use little older version of nrpe and see..

          • The error message misleading us.

            nagios-server check_nrpe: Remote nagios-client does not support Version 3 Packets
            nagios-server check_nrpe: Remote nagios-client accepted a Version 2 Packet

            It says remote client not accepting v3 packets.

            I configured multiple remote-clients, same error for all the clients. Then I re-configured the Nagios server itself which worked fine this time.

            Looks some thing gone wrong with Server setup initially.

          • @Kishore,

            Both Nagios Server and Client machines have same version of NRPE plugin installed to communicate properly, I suggest you to configure same NRPE version on all clients..

  16. Hi Tecmint Team / Ravi,

    Do we have any tutorial for SNMP trap monitoring using Nagios ? if not, can we get this documented ?

    Reply
    • @Jonus,

      No we don’t have a artice for SNMP trip monitoring, but we will create a article on same, could you tell us more about SNMP trap monitoring? is there any tool to do so or it has Nagios plugin available to setup?

      Reply
      • Definition of “variable bindings” SNMP Trap :

        An SNMP trap allows a network device or SNMP enabled devices to contact the network management(monitoring application) when there is a significant event.
        This is done via unsolicited SNMP messages.

        example of SNMP Trap:

        if a UPS is out of power, an SNMP trap will be sent to the network administrator’s computer with the message, “Out of power.” A door sensor can send messages when the door is open.

        The SNMP Trap allows the manager to be notified when there is a problem so he can respond to it quickly without having to manually check everything to see what the error is.
        The program can receive such SNMP messages (SNMP traps) and alert a network administrator about them using a variety of methods

        https://exchange.nagios.org/directory/Tutorials/Other-Tutorials-And-HOWTOs/Receiving-SNMP-Traps-in-Nagios/details

        Reply
    • Hi Ravi,

      As per the Nagios official portal(web site) the best Article to implement SNMP Trap using Nagios monitoring given in below link:

      The SNMP Trap Implementation given in below source or URL may be good and accurate, but as I am unable to understand it because this is not much descriptive as like as the tecmint articles are.

      I am too much confident and sure if tecmint publish article on SNMP Trap monitoring that could be understand by everyone or most of the people.

      https://exchange.nagios.org/directory/Tutorials/Other-Tutorials-And-HOWTOs/Receiving-SNMP-Traps-in-Nagios/details

      Reply
      • @Jonus,

        Thanks for the information about SNMP, we take a look and write a detailed easy to understand article on same, just give us some time..

        Reply
  17. I get to the part where I need to make install-xinetd and run into an issue…

    [root@ip-172-24-2-0 nrpe-3.0]# make install-xinetd
    make: *** No rule to make target `install-xinetd’. Stop.

    So I try to make install-inetd and I get it…

    [root@ip-172-24-2-0 nrpe-3.0]# make install-inetd
    No inetd file to install
    make: *** [install-inetd] Error 1

    This is on Centos 6.8. Any ideas?

    Reply
    • @Nick,

      Have you installed Xinetd package before running that command? If no, install it or else it seems your NRPE installation was not successful..

      Reply
  18. bash: /usr/local/nagios/libexec/check_nrpe: No such file or directory

    I try to install nrpe plugin into nagios server. while installation no any coming error. when try to run below command
    /usr/local/nagios/libexec/check_nrpe -H 192.168.0.57(client IP). then coming error bash: /usr/local/nagios/libexec/check_nrpe: No such file or directory. Please help me.

    Reply
  19. I am getting error when I ran /usr/local/nagios/libexec/check_nrpe -H localhost
    CHECK_NRPE: Error – Could not complete SSL handshake.

    Reply
      • Hi ,
        I installed nrpe at nagios server. install has been successful. but when i try to communicate with client host with below command
        /usr/local/nagios/libexec/check_nrpe -H 192.168.0.57

        then coming below massage. Please help me.
        /usr/local/nagios/libexec/check_nrpe: No such file or directory

        Reply
        • @Mukesh,

          It seems that your Nagios NRPE plugin installation was not successful, thats the reason you getting such error, I suggest you to try the installation again and see.

          Reply
        • @Mukesh,

          The error is clear that the connection id refusing, you need to open the port 5666 on the firewall to function properly..

          Reply
  20. Hello,

    When we install nagios agent in the client machine we will get lot of checks in the directory /usr/local/nagios/libexec and also few checks defined in the /etc/nrpe.cfg file right..

    But is it necessary to define these checks in the nrpe.cfg file??

    because there are only 7 predifined checks in my nrpe.cfg file and when I checked the front end Internet Explorer in the nagiosadmin I can see the graphical interface is showing 10 checks.

    I found out that these checks are defined in the nagios server for that host.

    I think we need only to define check in nrpe.cfg of the agent for custom checks..

    what is the difference between these two check mentioned below

    eximmail queue is custom check atnd is defined in the nrpe.cfg of agent. But check_http is not defined in the nrpe.cfg of agent…
    ==
    define service{
    use local-service ; Name of service template to use
    host_name harmonicland
    service_description HTTP
    check_command check_http
    notifications_enabled 0
    }

    define service{
    use local-service ; Name of service template to use
    host_name harmonicland
    service_description eximqueue
    check_command check_nrpe!check_eximqueue
    notifications_enabled 0
    }
    ====
    So i think we need to check

    Reply
    • @Sandy,

      Yes you 100% right, these nagios checks are installed under /usr/local/nagios/libexec and checks are defined in /etc/nrpe.cfg file, yes you can define your own checks in nrpe.cfg file under client machine.

      Reply
  21. Now open /etc/xinetd.d/nrpe file and add the localhost and IP address of the Nagios Monitoring Server.

    only_from = 127.0.0.1 localhost

    i don’t know the nagios ip address ,how can i find it?
    and the local host is mine or the one which created above (nagios)?

    Reply
  22. Hi Ravi,
    Do we need to install NRPE and Nagios Plugins in both of the Nagios monitor server and remote linux system?

    Reply
    • @Ashok,

      NRPE and Nagios plugins in Nagios monitoring server and only NRPE plugin is enough on remote Linux server.

      Reply
  23. Hi ,
    I’m adding four ubuntu host in the nagios server but all the four host showing same root partition and all the services

    Reply
    • @Nagaraj,

      Have you add all Ubuntu servers to Nagios hosts.cfg file? and defined services for these 4 servers in services.cfg file? also on each Ubuntu server in nrpe.cfg file have you defined proper root device name and all services? Please check these things first and confirm..

      Reply
      • i done the following thing:
        1) vi /usr/local/nagios/etc/objects/localhost.cfg /usr/local/nagios/etc/objects/newhost.cfg

        2:edit the usr/local/nagios/etc/objects/newhost.cfg
        in HOST DEFINITION
        and change the hostname to newhost
        And same changes in

        SERVICE DEFINITIONS

        and save the file

        3) to add newhost in the /usr/local/nagios/etc/nrpe.cfg file also

        verify with /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

        no error

        where i did the mistake and where the hosts.cfg file located

        Reply
      • where hosts.cfg file is located & below find my steps

        1)copy localhost.cfg file to newhost.cfg

        and edit the newhost.cfg file and change the host name in the file to newhost and also i added the entry in the nrpe.cfg file also

        Reply
  24. @Ravi,

    I have installed client in ubuntu. i followed below link to install the nrpe in cleint.
    http://sharadchhetri.com/2013/06/11/how-to-install-and-configure-nagios-nrpe-client-in-ubuntu-with-apt-get-command/

    [root@localhost ~]# /usr/local/nagios/libexec/check_nrpe -H xxx.xxx.xx.xxx
    NRPE v2.15
    [root@localhost ~]# /usr/local/nagios/libexec/check_nrpe -H xxx.xxx.xx.xxx -c check_load
    OK – load average: 0.03, 0.08, 0.13|load1=0.030;15.000;30.000;0; load5=0.080;10.000;25.000;0; load15=0.130;5.000;20.000;0;

    but it is not displayed on console. We have added command also in /usr/local/nagios/etc/objects/command.cfg like below

    define command{
    command_name check_nrpe
    command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$
    }

    define command{
    command_name check_load
    command_line /usr/local/nagios/libexec/check_load -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$
    }

    Reply
    • @Balaraju,

      You should all add those check commands in remote nrpe.cfg file under /etc directory to display on the web..

      Reply
  25. Hi Team,

    I did all the configuration as above . But i am getting the error as below on console
    (No output on stdout) stderr: execvp(/usr/lib/nagios/plugins/check_nrpe, …) failed. errno is 2: No such file or directory

    Reply
    • @balaraju,

      Have you changed the default Nagios installation location? the default location for nagios-plugins source will be /usr/local/nagios/libexec, here all plugins installs. The error you getting seems you’ve chosen different location for nagios-plugins sources while compiling…

      Reply
      • I was also having the same problem, the solution which worked for me was renamed /usr/local/nagios/libexec to some temorary name /usr/local/nagios/libexec_temp and re-compile nrpe-2.15 which again created /usr/local/nagios/libexec/ folder with check_nrpe file, and then I moved all files within /usr/local/nagios/libexec_temp directory to /usr/local/nagios/libexec/

        I hope this helps, thanks :-)

        Reply
    • Very nice article, I was able to setup Nagios host & multiple servers monitor fairly quickly, since this article is a bit old I used some latest available softwares, e.g nagion-4.1.1, nagios plugins-2.1.1

      Reply
      • @Vinod,

        Yes, this article is a bit old, but I am in process of updating it to most recent version, just give me some time to prepare, test and implement it..

        Reply
  26. hi i have received the error “NRPE: Command ‘check_ping’ not defined” while defining it.

    root@alpha:/usr/local/nagios/etc# /usr/local/nagios/libexec/check_nrpe -H 192.168.9.250 -c check_swap
    NRPE: Command ‘check_swap’ not defined

    Reply
  27. Hey i appreciate this great article.
    However i have a road block and was wondering if anyone could please help.
    it gives me an error when i check fro errors

    Error: Cannot open config file ‘/usr/local/nagios/etc/hosts.cfg ;new file added ‘ for reading: No such file or directory
    Error processing object config files!

    ***> One or more problems was encountered while processing the config files…

    Check your configuration file(s) to ensure that they contain valid
    directives and data defintions. If you are upgrading from a previous
    version of Nagios, you should be aware that some variables/definitions
    may have been removed or modified in this version. Make sure to read
    the HTML documentation regarding the config files, as well as the
    ‘Whats New’ section to find out what has changed.
    my conf file is perfect as far as i know but i cant seem to figure out where the error is coming from

    #
    ###############################################################################

    # Define a host for the remote machine

    define host{
    use linux-server ; Name of host template to use
    ; This host definition will inherit all variables that are defined
    ; in (or inherited by) the linux-server host template definition.
    host_name nci-helicarrier.nci.nih.gov
    alias CentOS 6.5
    address 128.231.12.230
    }

    # Linux host definition template #

    define host{
    name linux-server ; The name of this host template
    use generic-host ; This template inherits other values from the generic-host template
    check_period 24×7 ; By default, Linux hosts are checked round the clock
    check_interval 5 ; Actively check the host every 5 minutes
    retry_interval 1 ; Schedule host check retries at 1 minute intervals
    max_check_attempts 10 ; Check each Linux host 10 times (max)
    check_command check-host-alive ; Default command to check Linux hosts
    notification_period workhours ; Linux admins hate to be woken up, so we only notify during the day
    ; Note that the notification_period variable is being overridden from
    ; the value that is inherited from the generic-host template!
    notification_interval 120 ; Resend notifications every 2 hours
    notification_options d,u,r ; Only send notifications for specific host states
    contact_groups admins ; Notifications get sent to the admins by default
    register 1 ; DONT REGISTER THIS DEFINITION – ITS NOT A REAL HOST, JUST A TEMPLATE!
    }
    [Ryan01@ nci-s078880 ~]$

    even the objects configuration file seems perfect

    # OBJECT CONFIGURATION FILE(S)
    # These are the object configuration files in which you define hosts,
    # host groups, contacts, contact groups, services, etc.
    # You can split your object definitions across several config files
    # if you wish (as shown below), or keep them all in a single config file.

    # You can specify individual object config files as shown below:
    cfg_file=/usr/local/nagios/etc/objects/commands.cfg
    cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
    cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
    cfg_file=/usr/local/nagios/etc/objects/templates.cfg
    cfg_file=/usr/local/nagios/etc/hosts.cfg ;new file added
    cfg_file=/usr/local/nagios/etc/services.cfg ;new file added

    # Definitions for monitoring the local (Linux) host

    i cant seem to find the issue here

    1) the file is readable
    2) its labelled right
    3) The only thing i changed on it was the (hostname, alias and IP addresse.) Please help if you can.

    Reply
  28. I also got error “check_nrpe: No such file or directory.”, I copied complete libexec (/usr/local/nagios/libexec) directory from client host.
    Issue has resolved.

    Reply
  29. Hi Ravi,

    I realy appricaite your effort for preparing & sharing wonderful articles.

    While running ./configure cmd in Nagios monitoring server, i am getting below prompt.

    checking for strstr… yes
    checking for strtoul… yes
    checking for initgroups… yes
    checking for closesocket… no
    checking for socklen_t… yes
    checking for type of socket size… size_t
    checking for SSL headers… configure: error: Cannot find ssl headers
    [root@localhost nrpe-2.15]#

    Even not finding nrpe file inside xinetd folder

    [root@localhost nrpe-2.15]# cd /etc/xinetd.d/
    [root@localhost xinetd.d]# ls -lrt
    total 4
    -rw-r–r–. 1 root root 332 Mar 28 2014 rsync
    [root@localhost xinetd.d]#

    From Client configuration end, everything seems to ve fine.

    Help me out to fix this.

    Thank you

    Reply
    • @Vinay,

      It’s because you don’t have SSL libraries installed on your system to configure Nagios nrpe properly, just install those missing SSL headers using following command and try the configure script again:

      # yum install openssl openssl-devel
      
      Reply
  30. 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

    Reply
  31. 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]#

    Reply
        • @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?

          Reply
        • 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

          Reply
          • 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]#

          • 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]#

          • 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

          • 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.

          • @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..

          • 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.

          • 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

          • 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.

      • 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

        Reply
        • @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..

          Reply
  32. 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

    Reply
    • @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.

      Reply
  33. 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.”

    Reply
  34. 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/.

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

      Reply
      • 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?

        Reply
        • @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..

          Reply
  35. I was able to follow this to monitor the remote windows server (Windows server 2008 R2), however I have a tomcat server running on that system that i actually need to monitor. Any ideas how I could proceed with that?

    Reply
  36. Hi Ravi,

    I just want your help on how to execute windows commands remotely from Linux server?

    For Linux to Linux it is possible using below command.
    #ssh [email protected] ls -l

    But for Linux to Windows it is not possible , do you have any document / solution for this ?
    #ssh [email protected]

    Thanks,
    Jonus Joseph

    Reply
  37. Nice Article, I used this article for configuring the Remote linux host on Nagios Server and it got configured properly without any error.

    Reply
  38. when i am excute make install-xinetd it tell /usr/bin/install -c -m 644 sample-config/nrpe.xinetd /etc/xinetd.d/nrpe this is correctly installed or not

    Reply
  39. Hi when I execute /usr/local/nagios/libexec/check_n then press tab not coming nrpe in nagios server
    it will come for check_nagios check_ntp..like that but nrpe is not shown here

    Reply
  40. The 2 problems I encountered and resolved were the following:

    1. In the Nagios 4.0.1 Installation Guide on RHEL/CentOS 6.x/5.x & Fedora 19/18/17 article ## include openssl and openssl-devel needing to be installed on the Nagios Server
    2. Not sure why during the NRPE install on the Nagios Server, the check_nrpe program did not get copied in the /usr/local/nagios/libexec/ directory so I copied it over.

    Everything else worked as expected and I am monitoring remote servers.

    Reply
  41. very useful information. I am wondering how to write a plugin from scratch and get the info displayed in nagios. I would like to create the plugin in my nagios server and not need to install any agents like nrpe but still be able to get some stats from remote server…is it possible ? if so, please point me to the right docs or send an email to [email protected] with any links.

    Reply
  42. Hi when I execute /usr/local/nagios/libexec/check_nrpe -H localhost -c check_users it says
    NRPE: Unable to read output

    what went wrong?
    I follow the above procedure please help thanks!

    Reply
  43. I had installed the nagios server and configured nrpe by following the steps given.All the steps executed successfully but i am not able to see the remote host in nagios URL.Please help me out.Thanks in advance

    Reply
      • Ravi – Thanks for the tutorial. I have same questions. Lets say I have to monitor 10 nodes of same configuration, do I only need to add like below and thats it? OR do I need to add service monitoring for each server separately? I tried to use below configuration but my all servers are showing similar data. Looks like some configuration is messed up. Please help with the process of adding multiple servers in same hostgroup.

        define host{
        use linux-server
        host_name brpc001
        alias brpc001 – Test server for nagios
        address 10.20.30.21
        contact_groups admins
        }

        define host{
        use linux-server
        host_name brpc002
        alias brpc002 – Test server for nagios
        address 10.20.30.22
        contact_groups admins
        }

        define host{
        use linux-server
        host_name brpc003
        alias brpc003 – Test server for nagios
        address 10.20.30.23
        contact_groups admins
        }

        define host{
        use linux-server
        host_name brpc005
        alias brpc005 – Test server for nagios
        address 10.20.30.25
        contact_groups admins
        }

        Reply
  44. (No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_nrpe, …) failed. errno is 2: No such file or directory

    Reply
  45. Hello ,

    Am getting the below error while trying to open hosts and service tab in Nagios webpage .

    Error:
    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Reply
    • @Madhan,
      It seems your Nagios installation was not correct, try to follow steps carefully and install all required packages before compiling the Nagios.

      Reply
      • Am getting the error “SSH Monitoring;CRITICAL;SOFT;1;(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_nrpe, …) failed. errno is 2: No such file or directory” in Nagios Page , Seems the server is not getting monitor .

        Reply
      • Host Sort by host name (ascending)Sort by host name (descending) Service Sort by service name (ascending)Sort by service name (descending) Status Sort by service status (ascending)Sort by service status (descending) Last Check Sort by last check time (ascending)Sort by last check time (descending) Duration Sort by state duration (ascending)Sort by state duration time (descending) Attempt Sort by current attempt (ascending)Sort by current attempt (descending) Status Information

        CPU Load
        CRITICAL 06-23-2015 15:44:26 0d 1h 36m 38s 3/3 (No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_nrpe, …) failed. errno is 2: No such file or directory
        Current Users
        CRITICAL 06-23-2015 15:45:30 0d 1h 35m 34s 3/3 (No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_nrpe, …) failed. errno is 2: No such file or directory
        FTP Monitoring
        CRITICAL 06-23-2015 15:46:34 0d 1h 34m 30s 3/3 (No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_nrpe, …) failed. errno is 2: No such file or directory
        SSH Monitoring
        CRITICAL 06-23-2015 15:37:38 0d 1h 33m 26s 3/3 (No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_nrpe, …) failed. errno is 2: No such file or directory
        Total Processes
        CRITICAL 06-23-2015 15:38:42 0d 1h 32m 22s 3/3 (No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_nrpe, …) failed. errno is 2: No such file or directory

        Reply
    • when u installing nrpe packg in both side ,jest follow this steps (in above sever side not completely installed )
      ./configure
      # make all
      # make install-plugin
      # make install-daemon
      # make install-daemon-config
      # make install-xinetd

      Reply
  46. succesfully completed client installation but in server while i am verifying. it gives a error Cannot able to open the file /usr/local/nagios/etc/server.

    Reply
  47. I just need to know the procedure for installing Nagios on clients centos servers, not the Nagios server, what pkgs i need to install on client machine, i’m running centos7
    Thx

    Reply
  48. Sir , i am getting an error in the ‘Adding remote linux host to nagios montoring server where i have created files namely Hosts and Services and added them in nagios .cfg as well.. But when i use gedit to open Hosts.cfg it shows empty file.. So where am i going wrong? Im sure i have done all above steps correctlu.. Please help thanks

    Reply
  49. CPU load UNKNOWN 03-21-2015 09:48:08 0d 0h 17m 8s 3/3 NRPE: Unable to read output
    Current Users UNKNOWN 03-21-2015 09:49:11 0d 0h 16m 5s 3/3 NRPE: Unable to read output
    FTP Monitoring CRITICAL 03-21-2015 09:50:15 0d 0h 48m 59s 3/3 NRPE: Command ‘check_ftp’ not defined
    SSH Monitoring CRITICAL 03-21-2015 09:48:00 0d 0h 47m 55s 3/3 NRPE: Command ‘check_ssh’ not defined
    Total Processes UNKNOWN 03-21-2015 09:49:04 0d 0h 16m 12s 3/3 NRPE: Unable to read output

    Reply
  50. Current Load CRITICAL 03-20-2015 20:38:24 0d 3h 59m 13s 4/4 (No output on stdout) stderr:
    Current Users OK 03-20-2015 20:41:02 0d 7h 56m 34s 1/4 (No output on stdout) stderr:
    HTTP WARNING 03-20-2015 20:40:37 0d 7h 55m 57s 4/4 HTTP WARNING: HTTP/1.1 403 Forbidden – 5155 bytes in 0.000 second response time
    PING OK 03-20-2015 20:42:17 0d 7h 55m 19s 1/4 (No output on stdout) stderr:
    Root Partition OK 03-20-2015 20:37:54 0d 7h 54m 42s 1/4 (No output on stdout) stderr:
    SSH Notifications for this service have been disabled CRITICAL 03-20-2015 20:41:27 0d 7h 54m 4s 4/4 (No output on stdout) stderr:
    Swap Usage OK 03-20-2015 20:39:09 0d 7h 53m 27s 1/4 SWAP OK – 100% free (4895 MB out of 4895 MB)
    Total Processes OK 03-20-2015 20:39:47 0d 7h 52m 49s 1/4 PROCS OK: 87 processes with STATE = RSZDT

    Reply
  51. Ravi,
    Thank your for your superb docs . I have configured Nagios and working well…..But I have a problem in the configuration of the statusmap.
    Pls help me to get the status map….

    Thanks in advance
    -Noufal

    Reply
  52. Thanks for the information ..
    While installing NRPE Plugin on Monitoring server i am getting
    “checking for SSL headers… configure: error: Cannot find ssl headers” while running ./configure

    Run “yum install -y openssl-devel” to resolve the error .

    Reply
    • @Papouz,
      Which next article you talking about, we’ve already included links to the installation of Nagios and how to add windows host to Nagios at the beginning of the article. Please check and let me know is there anything you want from us..

      Reply
  53. [root@node2 nrpe-2.15]# /usr/local/nagios/libexec/check_nrpe -H localhost -c check_load
    CHECK_NRPE: Error – Could not complete SSL handshake.

    anybody??? =(

    Reply
  54. Hi all,

    While i tried to install and compile the NRPE plugins with the ./configure-command, i received following error:

    checking for SSL headers… configure: error: Cannot find ssl headers

    To fix this on CentOS you need to install the openssl-devel package.
    # yum install openssl-devel

    Cheers,
    Tom

    Reply
    • @Shantanu,
      Here is the command to check memory usage of remote linux client from Nagios server..make sure you opened port 5666 on remote linux client.

      # /usr/local/nagios/libexec/check_nrpe -H localhost -c check_mem -f -w 20 -c 10 
      
      Reply
  55. I can confirm if I follow the same procedure for the remote and local host, i.e. installing the plugin, daemon and daemon config, then I get the check_nrpe file present in the required directory.

    Ruth

    Reply
  56. Hi Ravi,

    Thanks for this detailed and helpful article. I followed the instructions to the letter, and I see the remote host on the Nagios dashboard, however I get the error on all checks that others have reported:

    (No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_nrpe, …) failed. errno is 2: No such file or directory

    I think this problem is due to the fact that when you install the daemon on the Nagios server, the check_nrpe file is not installed, as others suggested, so the checks do not work.

    On the remote host when installing, you advise to run the following:

    [root@tecmint]# make install-plugin
    [root@tecmint]# make install-daemon
    [root@tecmint]# make install-daemon-config

    But on the Nagios server only to run

    [root@tecmint]# make install-daemon

    Could this possibly be related? I don’t know – but I also have the same issue in that the check_nrpe file is missing on the Nagios server, and is present on the Remote server.

    Ruth

    Reply
    • @Ruth,
      It could be incomplete installation…it seems your installation is not perfect that’s the reason some plugins missing…try to follow instructions again..

      Reply
    • That’s correct Ruth, I had this error after running the following command on the monitoring nagios server:
      (Step 2: Verify NRPE Daemon Remotely)
      /usr/local/nagios/libexec/check_nrpe -H
      -bash: /usr/local/nagios/libexec/check_nrpe: No such file or directory

      And as you pointed out was due to not having executed:
      [root@tecmint]# make install-plugin
      [root@tecmint]# make install-daemon
      [root@tecmint]# make install-daemon-config

      Therefore the instructions on “Monitoring Server – Step 1: Install NRPE Plugin:”
      should be:
      [root@tecmint]# tar xzf nrpe-2.15.tar.gz
      [root@tecmint]# cd nrpe-2.15
      Compile and install the NRPE addon.

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

      [root@tecmint]# make install-plugin
      [root@tecmint]# make install-daemon
      [root@tecmint]# make install-daemon-config

      Thank you for your help Ruth

      Reply
  57. if i try to run nagios command to check the remote linux host then it shows me the result but only doesnt work if i add host nagios config !!

    will you please give little bit explantion how can i trouble shoot this problem?

    thankss

    Reply
    • @Kunal
      It seems that host key of the remote host was changed, you need to manually edit or remove that key from the ~/.ssh/known_hosts file and then try.

      Reply
  58. Hii Ravi!! I have followed your article and i have got strange problem

    Remote command execution failed: Host key verification failed.

    I get this unknown error on Nagios Web page.

    you help will be really appreciating!!!

    Thanks

    kunal

    Reply
    • @Kunal,
      Seems problem with SSH, i think plugin not able to authenticate with your remote SSH server, please check SSH keys both end..

      Reply
  59. I’m getting the following error from the server side.

    # /usr/local/nagios/libexec/check_nrpe -H 10.18.1.14
    connect to address 10.18.1.14 port 5666: Connection refused
    connect to host 10.18.1.14 port 5666: Connection refused

    SELINUX – Disabled in server and client
    IPTABLES – no rules @ server
    ACCEPT tcp — 0.0.0.0/0 0.0.0.0/0 tcp dpt:5666 @ client side…

    Please suggest what if i need to do

    Reply
  60. Hi Ravi,
    Thank you very much. i have done it. my nagios server and remot host are centos mechine and it is working fine.
    Can you please help me in how to add a ubuntu client mechine to nagios server.
    Wish you happy new year 2015.

    Reply
    • @Vinay,
      That’s great to hear that finally your Nagios setup is working properly..currently instructions supports RedHat based systems, we will soon add steps to add Ubuntu to Nagios server..stay tuned for updates….and wish you same..happy new year..

      Reply
  61. Hi ravi,
    i have created hosts.cfg and services.cfg, and given the entry in the nagios file but this file is blank.can you please help me to get the default template.

    Reply
    • @Vinay
      Please follow the instructions given in the article, I’ve already explained how to add host and services to these two files..please read carefully..

      Reply
  62. Ravi your articles are great. I was a real newbie to Linux and started off installing Nagios from your articles. I have used all 3 articles regarding installing Nagios on Server, Installing Remote Linux & Windows Hosts.

    Everything works fine except for the fact I get an error on my web interface saying

    “(Return code of 255 is out of bounds)”

    for all services I configured for Nagios Server,

    Reply
      • I get this error for Services Configured for my Nagios Server. Not to my remote hosts.

        ex:

        Host Services Status Information
        ===== ========= =================
        Nagios_Server CPU Load (Return code of 255 is out of bounds)
        Current Users (Return code of 255 is out of bounds)
        HTTP (Return code of 255 is out of bounds)
        SSH Monitoring (Return code of 255 is out of bounds)
        Swap Usage (Return code of 255 is out of bounds)
        Total Processes (Return code of 255 is out of bounds)
        Zombie Procs (Return code of 255 is out of bounds)

        Reply
        • @Kaveen,
          Have you added Nagio Server IP address to remote host nrpe.cfg file? or the plugin has correct write permissions? Please check all these

          Reply
  63. Ravi,

    I tried and fixed the issue. Thank you for your fabulous link. I would also request you to pen down the steps to add different services like mysql, jboss, tomcat etc.

    Thanks & Regards

    Reply
    • @Ritesh,
      I’ve never tried yet those services, have you tried? If yes, could you please provide us steps so that I can include in this article..

      Reply
  64. Hello Ravi,

    To monitor any Linux hosts we install nrpe,
    My concern is how does nrpe execute its command from nagios to remote host ?

    Eg:

    Remote Server: NRPE file (nrep.cfg):

    command[check_cpu_jonus]=/usr/local/nagios/libexec/check_cpu -w 80 -c 90

    Nagios Side:

    #/usr/local/nagios/libexec/check_nrpe -H 192.168.6.1 -p 5666 -c check_cpu_jonus

    My question is how does nagios execute this check (check_cpu_jonus) on remote server through SSH ? or any other protocol ?

    or in other words i can say if we remove SSH from remote host will this check (check_cpu_jonus) will execute on remote host and give output to nagios server ?

    Please help me to understand how does NRPE works from nagios server to remote server which we want to monitoring.

    Thanks in advance.

    -Jonus Joseph

    Reply
    • @Jonus,
      NRPE works as a agent on remote machines to fetch resources such as system load, disk usage, whos’ online and other monitoring stuff via a script that is hosted on remote host.. it uses port 5666 to execute all commands on the remote host.

      Reply
  65. how to remove server entry in nagios monitoring system, please let me know. I have disabled the host entry lines in host entry file, bu showing in nagios monitoring

    Reply
  66. Ravi,

    I have verified my configs still couldn’t remove “CHECK_NRPE: Error – Could not complete SSL handshake” from nagios web page.

    Could you kindly help me please.

    Note: Nagios server ip is there on /etc/xinetd.d/nrpe

    Reply
    • Further for your information, I am working on CentOS Linux release 7.0.1406 (Core)

      And your nrpe download link isn’t working(Step 1: Install NRPE Plugin(on monitoring server).

      Your advise is eagerly awaited!

      Regards

      Reply
  67. Hello,

    My question is : How to add icon/image in front of host or services on nagios portal.
    for example i have one host in nagios it is RHEL7 i want to keep icon/image of REDHAT in front of host on nagios portal so that i can recognize easily.
    how to do this process through nagios configurations ?

    Thank you very much in advance.

    -Jonus Joseph

    Reply
  68. The article is great and working,

    How do I add more than one linux host? should I create separate host.cfg file or can it be given using comma separator?

    Reply
      • Thank you for that, I have a strange issue now, I am monitoring two linux machines and the second one says Service Check Timed Out for check_smtp status where as the first one is fine.

        when I do the same from command line

        [root@nagios]# /usr/lib64/nagios/plugins/check_smtp x.x.x.x
        SMTP OK – 0.056 sec. response time|time=0.055673s;;;0.000000

        its working fine, only pb is from web interface,

        I have even tried increasing the timeout using -t argument in the commands.cfg file

        Reply
  69. Great post!
    All the services work just fine except one – I am getting errors with the FTP service – check_ftp. I have defined the service and edited the services.cfg file as well as the nrpe.cfg.

    But, I receive the error as ‘Connection refused’. I am trying from command line on the remote host: ./check_ftp -H and this gives me ‘connect to address and port 21: Connection refused’. Same error on the Nagios UI.

    I have Firewalls turned off. What could be the issue here?

    Thanks

    Reply
  70. Hi Mate,

    Very NIce article.. I have installed Nagios in Aws cloud.. I can telnet from nagios server to remote server.. But GUI always shows host is down..

    usr/local/nagios/libexec/check_nrpe -H *.*.*.*
    gives
    NRPE v2.15..

    Can you please suggest what might be the problem.. Thanks once again..

    Reply
  71. Hi, this guide worked very well for me, however I am curious as to why the Cgi refers to the Nagios server as “localhost” rather than the actual server name. Is there a reason for this? I’ve tried several ways around this, but they all seem to break something….

    Reply
  72. Hello..

    The document is very useful
    I have configured the whole configuration. Everything went successfully.But when I checked nagios web interface all the services were in critical condition with the description (Return code of 20 is out of bounds) & Connection refused by host
    My nagios server is Centos and client is Fedora20

    When i check all these services manually from the terminal of the server i am getting the required information. I am stuck here. please help me to sort out of this

    Reply
  73. It show in ps as below.

    ps -aux | grep logstash
    Warning: bad syntax, perhaps a bogus ‘-‘? See /usr/share/doc/procps-3.2.8/FAQ
    logstash 27423 166 2.1 1706480 84716 pts/0 SNl 18:31 0:03 /usr/bin/java -Djava.io.tmpdir=/var/lib/logstash -Xmx500m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -Djava.awt.headless=true -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -jar /opt/logstash/vendor/jar/jruby-complete-1.7.11.jar -I/opt/logstash/lib /opt/logstash/lib/logstash/runner.rb agent -f /etc/logstash/conf.d -l /var/log/logstash/logstash.log

    Reply
  74. Hi Ravi Saive!

    I am using logstash. How can i monitor it. it is not install as a typical server rathar than script mode. When i use check_tcp to monitor the port it is listening on or by using check_procs, it close with exception error. How can i verify it weather it is running or not.

    Reply
  75. Ravi,

    The post was very helpful, Thanks for that.

    1) Suppose if I wanted to add more servers then do i need to create hosts.cfg and services.cfg for every hosts ?
    2) Also, I want my localhost to be monitored for some specific services as well, where do i have to configure for that ?
    3) for some services its giving me error that “NRPE : command check_ftp not found” how I can resolve this ?

    Reply
    • Dear Gaurav,

      Thanks for the kind words, please see the answers for all your 3 points.

      1. No need to create each file, just add the hosts info in hosts.cfg file and services in services.cfg file.
      2. Yes, you can define specific services for localhost machine in localhost.cfg, this will be located somewhere in nagios folder, search for it.
      3. You need to define those services commands in services.cfg file at Nagios server and in nrpe.cfg file in remote host file.

      Reply
  76. I have a RHEL 6.3 server that is registered with red hat. I’ve installed the nagios plugins(2.0.3) and the nrpe-2.15.

    When I run the following command, netstat -at | grep nrpe I get nothing.

    When I run the following command, /usr/local/nagios/libexec/check_nrpe -H localhost I get:

    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

    When i do a less /var/log/messages I get the following:

    Sep 11 09:06:03 localhost xinetd[46274]: Server /usr/local/nagios/bin/nrpe is not executable [file=/etc/xinetd.d/nrpe] [line=11]
    Sep 11 09:06:03 localhost xinetd[46274]: Error parsing attribute server – DISABLING SERVICE [file=/etc/xinetd.d/nrpe] [line=11]
    Sep 11 09:06:03 localhost xinetd[46274]: Must specify a server in nrpe
    Sep 11 09:06:03 localhost xinetd[46274]: xinetd Version 2.3.14 started with libwrap loadavg labeled-networking options compiled in.
    Sep 11 09:06:03 localhost xinetd[46274]: Started working: 0 available services
    Sep 11 09:07:48 localhost xinetd[46274]: Exiting…

    When I run a ps -ef |grep xinetd, I get:

    root 5107 1 0 09:26 ? 00:00:00 xinetd -stayalive -pidfile /var/run/xinetd.pid
    root 32359 13266 0 09:54 pts/0 00:00:00 grep xinetd

    I’ve restarted the xinetd process multiple times

    When I run grep nrpe /etc/services I get:

    nrpe 5666/tcp # NRPE

    I added port 5666 to the iptables:

    *filter
    :INPUT ACCEPT [368773:68873995]
    :FORWARD ACCEPT [0:0]
    :OUTPUT ACCEPT [372083:68473830]
    -A INPUT -p tcp -m tcp –dport 5666 -j ACCEPT
    -A INPUT -p tcp -m tcp –dport 5666 -j ACCEPT
    COMMIT
    # Completed on Thu Sep 11 09:21:53 2014

    My /etc/xinetd.d/nrpe configuration file looks like this:

    # default: on
    # description: NRPE (Nagios Remote Plugin Executor)
    service nrpe
    {
    flags = REUSE
    socket_type = stream
    port = 5666
    wait = no
    user = nagios
    group = nagios
    server = /usr/local/nagios/bin/nrpe
    server_args = -c /usr/local/nagios/etc/nrpe.cfg –inetd
    log_on_failure += USERID
    disable = no
    only_from = 192.168.0.29
    }

    I’ve also tried adding in the 127.0.0.1 in the only_from field and I get the same problem.

    xinetd is running:

    chkconfig –list xinetd
    xinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:off

    when i run lsof -i:5666, i get nothing

    I noticed There is no path for /usr/local/nagios/bin/nrpe, the furthest i can go is /usr/local/nagios, there is no bin directory in the nagios folder. Maybe this is the problem?

    Reply
  77. I wish to monitor 3 servers which is running in LINUX machine from my windows nagwin .

    Do I need to configure the steps of this article for every 3 Linux machines?

    Reply
  78. i hv used check_udp as following.

    ./check_udp -H Server IP -p 514 -s 0x1234 -e ” -v
    ./check_udp -H Server IP -p 514 -s 0x1234 -e E
    ./check_udp -H Server IP -p 514 -s 0x1234 -e 1 etc.

    Reply
  79. Hi Geeks

    We have configured Nagios v4 on Centos 6.5 to monitor our logging server.
    Everything is fine with TCP but problem with UDP. we we use following command we receive response OK.
    nmap -p 514 -sU -P0 172.20.16.81 But when we check weather port is listening by using
    netstat -at | grep syslog or netstat -at | grep rsyslog or netstat -at | grep 514
    there is nothing.

    Response of the following command ./check_udp with respective arguments is always Critical. What reason can be.I also used a script check_udp_port.sh but it output is not readable to Nagios.

    Reply
  80. Hi Ravi,

    I forget to add my another query, here is that

    This example is for adding only host to the nagios server, please let me know how we can add many host?

    – Karthik

    Reply
  81. Hi Ravi,

    Awesome!.. Very useful.

    I need to monitor services like named, mysql. So what are the libexec should I include in “/usr/local/nagios/etc/services.cfg” file.

    Also please suggest me, is it possible to set nagios to send notification sms alert to custom mobile number.

    – Karthik

    Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.