• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Configure Nagios NRPE Client for System Monitoring (CentOS/RHEL)

by admin

Question: How to configure CentOS/RHEL system as Nagios NRPE Client so it can be monitored from Nagios-Server for system health/performance?

Enable EPEL REPO (Fedora Repository) and Install Required Packages

1. Download the epel repository packages for CentOS/RHEL 5 and 6.

FOR CentOS/RHEL 6:

# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

For CentOS/RHEL 5:

# wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

2. Install Epel repostiory

# yum install /path/to/downloaded/rpm/with/wget/epel-release-X-X.noarch.rpm

where X-X is your version eg. CentOS 6 or CentOS 5 rpm file.

3. Enable epel repo and install nrpe and nagios-plugins from it.

# yum --enablerepo=epel install nrpe nagios-plugins

4. After the installation, disable EPEL repo ( just in case ):

# yum-config-manager --disable epel

5. Install below packages which are required later on by NRPE or any 3rd party Nagios Plugin:

# yum install xinetd gcc openssl-devel make lm_sensors net-snmp-utils postresql-libs

Install and configure Xinetd

1. Install xinetd which is necessary for NRPE:

# yum install xinetd

2. Configure xinetd for NRPE by creating xinetd file for NRPE

# vi /etc/xinetd.d/nrpe
### & (Paste below rows)

service nrpe
{
flags = REUSE
type = UNLISTED
port = 5666
socket_type = stream
wait = no
user = nagios
group = nagios
server = /usr/sbin/nrpe
server_args = -c /etc/nagios/nrpe.cfg --inetd
log_on_failure += USERID
disable = no # change
only_from = 127.0.0.1 XXX.XXX.XXX.XXX        ### Replace XXX.XXX.XXX.XXX with actual Nagios Server IP
}

Above entry will allow xinetd access from XXX.XXX.XXX.XXX Nagios Server and localhost 127.0.0.1.

Configuration

1. Add nrpe port to /etc/services – Add NRPE service to /etc/services and make sure port 5666 (default) is open on Firewall:

# echo "nrpe 5666/tcp # NRPE" >> /etc/services

2. Make necessary changes to nrpe.conf – Edit nrpe.cfg and add allowed hosts which can talk to NRPE daemon eg. Nagios Server or any Other NRPE Client (edit allowed_hosts= stanza).

# vi /etc/nagios/nrpe.cfg

allowed_hosts=127.0.0.1, XXX.XXX.XXX.XXX 
### Replace XXX.XXX.XXX.XXX with desired IP addresses

3. Start xinetd/nrpe and enable them at system boot:

# service xinetd start
# service nrpe start
# chkconfig xinetd on
# chkconfig nrpe on

Misc

Nagios NRPE commands can be added in file /etc/nagios/nrpe.cfg.

Example confing:

command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 150 -c 200

To install additional plugins from EPEL:

# yum install nagios-plugins-all

Above yum command will install all additional Nagios Plugins which can be used for system checks. All plugins will be located in /usr/lib64/nagios/plugins – please remember to set proper permissions/user for any 3rd party plugin ( User/group should be: nagios:nagios and permissions: 755 )

Additional plugins can be found here.

Test NRPE Client from Nagios Server

From Nagios Server test new NRPE Client configuration by using check_nrpe plugin:

./check_nrpe -H NEWLY_CONFIGURED_NRPE_CLIENT_IP
nrpe-2.15-2.el6.x86_64

Now proceed with the further configuration on Nagios Server (add client-node-config/commands to check).

Filed Under: DevOps, Nagios

Some more articles you might also be interested in …

  1. How to schedule master node running pod/service as a worker node
  2. How to List / Search / Pull docker images on Linux
  3. Docker Basics – Expose ports, port binding and docker link
  4. Hello Newbies in Tech! Switching From Windows to Linux? Read This First
  5. How to add new host entry in /etc/hosts when a docker container is run
  6. How to update/add a file in the Docker Image
  7. How to add header and trailer line to a file in Linux
  8. New User Failed Run Kubectl with Error “The connection to the server xxx.xxx.xxx was refused – did you specify the right host or port?”
  9. Examples of creating command alias in different shells
  10. The Ultimate Beginner’s Guide to Static Website Hosting With Google Firebase (for FREE)

You May Also Like

Primary Sidebar

Recent Posts

  • What are /dev/zero and /dev/null files in Linux
  • grpck command – Remove corrupt or duplicate entries in the /etc/group and /etc/gshadow files.
  • xxd command – Expressed in hexadecimal form
  • sesearch: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright