• Home
  • Ubuntu 16.04
    • Whats New ?
    • Install JAVA 8
    • Setup LAMP Stack
    • Install LEMP Stack
    • Install Node.js
    • Install Git
    • Move Unity Launcher to Bottom
  • FeedBack
  • Funny Tools
  • Tutorials
    • Linux Distributions
      • CentOS
      • Debian
      • Fedora
      • LinuxMint
    • Monitoring Tools
      • Monit
      • Nagios
      • NRPE
    • Network Services
      • DHCP
      • DNS
      • FTP
    • Databases
      • MySQL
      • MariaDB
      • MongoDB
      • PostgreSQL
      • SQL Server
    • Amazon Web Services
  • Submit Article
  • About Us
TecAdmin.net
  • Home
  • Ubuntu 16.04
    • Whats New ?
    • Install JAVA 8
    • Setup LAMP Stack
    • Install LEMP Stack
    • Install Node.js
    • Install Git
    • Move Unity Launcher to Bottom
  • FeedBack
  • Funny Tools
  • Tutorials
    • Linux Distributions
      • CentOS
      • Debian
      • Fedora
      • LinuxMint
    • Monitoring Tools
      • Monit
      • Nagios
      • NRPE
    • Network Services
      • DHCP
      • DNS
      • FTP
    • Databases
      • MySQL
      • MariaDB
      • MongoDB
      • PostgreSQL
      • SQL Server
    • Amazon Web Services
  • Submit Article
  • About Us
25 July 2014

How to Monitor Remote Linux Host using Nagios and NRPE

Written by Rahul K. | July 25, 2014
Monitoring Tools, Nagios, NRPE linux, Monitor, monitoring, nagios, NRPE

Nagios is the most popular infrastructure monitoring server on internet. You can use our tutorial to install Nagios on RHEL based systems or Debian systems. You need to install NRPE on all remote Linux systems to monitor with Nagios.

NRPE is known as Nagios Remote Plugin Executor. The NRPE add-on is designed to execute plugins on remote Nix systems. In this setup, NRPE daemon is installed on the remote system to which services need to monitor through Nagios server. NRPE runs as a daemon on remote systems and waits for Nagios requests. When Nagios server needs to check the status of any resources or applications to that remote host, sends and commands signal, which command definition is stored on NRPE service. NRPE takes Nagios server request and execute the command on the local system and sends the result back to Nagios.

nagios-nrpe-monitoring

This article will help you to install NRPE service on your Linux system and add a host in Nagios server for monitoring.

Step 1 – Configure NRPE on Linux Host

Follow the below steps to install and configure NRPE on client machine and check connectivity with Nagios server.

Step 1.1 – Install NRPE

Firstly we would require installing nrpe service on remote Linux system, which we need to monitor through Nagios server.

On CentOS/RHEL/Fedora

# yum install nrpe nagios-plugins*

On Debian/Ubuntu/LinuxMint

$ sudo apt-get install nagios-nrpe-server nagios-plugins

Step 1.2 – Configure NRPE

After successfully installing NRPE service, Edit nrpe configuration file /etc/nagios/nrpe.cfg in your favorite editor and add your nagios service ip in allowed hosts.

# vim /etc/nagios/nrpe.cfg
allowed_hosts=127.0.0.1, 192.168.1.100

Where 192.168.1.100 is your Nagios server ip address.

After making above changes in nrpe configuration file, Lets restart NRPE service as per your system

# service nrpe restart      # On CentOS/RHEL/Fedora 
$ sudo /etc/init.d/nagios-nrpe-server restart  # On Debian/Ubuntu/LinuxMint

Step 1.3 – Verify Connectivity from Nagios

Now run the below command from Nagios server to make sure your nagios is able to connect nrpe client on remote Linux system. Here 192.168.1.11 is your remote Linux system ip.

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

NRPE v2.15

Step 2 – Add Linux Host in Nagios

We recommend using NagiosQL3 web interface for managing configuration of Nagios server. Below steps is for CLI lovers. To add a host in your Nagios server from command line.

First create a configuration file /usr/local/nagios/etc/servers/MyLinuxHost001.cfg using below values. for example you Linux hosts ip is 192.168.1.11. We also need to define a service with host. So add a ping check service, which will continuously check that host is up or not.

# vim /usr/local/nagios/etc/servers/MyLinuxHost001.cfg
#########################################################
# Linux Host 001 configuration file
#########################################################

define host {
        use                          linux-server
        host_name                    Linux_Host_001
        alias                        Linux Host 001
        address                      192.168.1.11
        register                     1
}
define service{
      host_name                       Linux_Host_001
      service_description             PING
      check_command                   check_ping!100.0,20%!500.0,60%
      max_check_attempts              2
      check_interval                  2
      retry_interval                  2
      check_period                    24x7
      check_freshness                 1
      contact_groups                  admins
      notification_interval           2
      notification_period             24x7
      notifications_enabled           1
      register                        1
}


#########################################################
# END OF FILE
#########################################################

Now verify configuration files using following command. If there are no errors found in configuration, restart nagios service.

# nagios -v /usr/local/nagios/etc/nagios.cfg
# service nagios restart

Step 3 – Check Host in Nagios Web Interface

Open your Nagios web interface and check for new Linux hosts added in Nagios core service. In my case, it looks like below.

Nagios-Linux-host

Share it!
Share on Facebook
Share on Twitter
Share on Google+
Share on Reddit
Share on Tumblr
Rahul K.
Rahul K.
Connect on Facebook Connect on Twitter Connect on Google+

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

Related Posts

  • How to Monitor Linux System Performance using Sysstat

  • Linux Mint 19 – Release Date, New Features & More

  • How to Monitor Memory, CPU and Disk on Linux using NRPE and Nagios

  • Delete All root User Emails from a Shell in Linux

  • How to Create Own Nagios Plugin using Bash Shell Script

11 Comments

  1. sujit ku behera Reply to sujit
    April 18, 2018 at 10:31 am

    is it possible if nrpe pkg vary both end remote host and nagios server.

  2. bhagyasree Reply to bhagyasree
    August 29, 2017 at 9:47 am

    HI Rahul,

    i need realtime examples for how to monitor the servers and services in nagios.

  3. prateek Reply to prateek
    July 14, 2017 at 4:42 pm

    HI Rahul,
    i have added hosts in my nagios config but has not configured nrpe in any remote hosts…although i can c the hosts added in my nagios server but nagios not showing it correctly. Even when my hosts is down it is showing as up…is this the reason that i have not configured nrpe in my remote host?? please reply at the earliest.

    • Rahul K. Rahul K. Reply to Rahul
      July 15, 2017 at 3:56 am

      Hi Prateek,

      check_ping does not require nrpe on the remote system. Check ping will return OK only if remote system IP ping successfully.

  4. KIRAN Reply to KIRAN
    May 16, 2017 at 5:14 am

    Hi Rahul,

    I am trying to configure multiple windows host as nagios monitoring it is not allowing . Please suggest on this

  5. Harinder Reply to Harinder
    May 14, 2017 at 4:24 am

    Is nrpe running under secure layer, Nagios, and NRPE communication is encrypted?

  6. Muhammad Fakhri Reply to Muhammad
    November 24, 2015 at 7:41 am

    Hi!
    Thanks for your tutorial, but why i can’t find the “check_nrpe”? I’m using Ubuntu Server 14.04 btw
    Hope you can explain why ASAP
    Thanks!

    • Rahul K. Rahul Reply to Rahul
      November 26, 2015 at 5:00 am

      HI,

      Check_nrpe command will be found on Nagios server. This command is part of nagios-nrpe-plugin package. Install it on your Nagios server.

  7. Prabhat Reply to Prabhat
    June 3, 2015 at 10:42 pm

    i have downloaded nrpe pkg and installed it. so how can i restart it.

    [[email protected] ~]# service nrpe restart
    nrpe: unrecognized service

  8. Jonus Joseph Reply to Jonus
    November 19, 2014 at 9:04 am

    Hello Brother,

    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 Windows 2008 i want to keep icon/image of M.S.Windows 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.

    [email protected]

    -Jonus Joseph

    • Rahul K. Rahul Reply to Rahul
      November 19, 2014 at 9:59 am

      Hi Joseph,

      Edit you host configuration file and add below line under define host section.

      define host {
      ——–
      ——–
      icon_image windowsserver.png
      }

      Now update an icon image at DOCUMENTROOT/images/logos/ directory with name windowsserver.png. change DOCUMENTROOT with path of your nagios html directory.

      I hope this will help you.

Leave a Reply

Cancel reply

Popular Posts

  • How to Install JAVA 8 on Ubuntu 16.04/14.04, LinuxMint 18/17
  • How to Install s3cmd in Linux and Manage Amazon s3 Buckets
  • How to Install AnyDesk on Ubuntu, Debian and LinuxMint (Alternative of TeamViewer)
  • How to Setup Selenium with ChromeDriver on Ubuntu 16.04
  • How to Install MySQL on macOS Sierra and High Sierra
All rights reserved. © 2013-2018 TecAdmin.net. This site uses cookies. By using this website you agree our term and services