How to configure Nagios Remote Plugin Executor (NRPE) in Linux)
Nagios is one of the most powerful tools for network management. Nagios can monitor the accessibility of remote hosts and the status of running services. But what if we want to monitor anything other than the network service in the remote host? For example, we may want to monitor the disk utilization or CPU processor load on the remote host. Nagios Remote Plugin Executor (NRPE) is a tool that can help you complete these operations. NRPE allows you to execute the Nagios plugin installed on a remote host and integrate it into an existing Nagios server.
How to Use the Nagios remote execution plug-in (NRPE) to detect server memory usage
Network Monitor Nagios Overview
Nagios construction and Configuration
Build a Nagios monitoring platform in the Nginx Environment
Configure the basic Nagios System on RHEL5.3 (using Nagios-3.1.2)
CentOS 5.5 + Nginx + Nagios monitoring and control terminal installation and Configuration Guide
Install Nagios Core for Ubuntu 13.10 Server
This tutorial describes how to configure NRPE in a deployed Nagios instance. This tutorial consists of two parts:
- Configure the remote host.
- Configure the Nagios monitoring server.
Then, we will end this tutorial by defining some custom commands that can be used by NRPE.
Step 1: Install the NRPE Service
You need to install the NRPE service on each remote host that you want to use NRPE monitoring. The NRPE service daemon on each remote host will communicate with a Nagios monitoring server.
The software packages required by the NRPE service can be easily installed using apt-get or yum, depending on the platform. For CentOS, because NRPE is not in the CentOS repository, we need to add a Repoforge repository.
For Debian, Ubuntu, or Linux Mint:
- # Apt-get install nagios-nrpe-server
For CentOS, Fedora, or RHEL:
- # Yum install nagios-nrpe
Step 2: Prepare the configuration file
The configuration file/etc/nagios/nrpe. cfg is similar in Debian or RedHat-based systems. Let's back up and modify the configuration file:
- # Vim/etc/nagios/nrpe. cfg
- # The NRPE service port can be customized ##
- Server_port = 5666
-
- # Allow access from Nagios monitoring server ##
- # Note: There is no space after the comma ##
- Allowed_hosts = 127.0.0.1, X.X.X.X-IP _ v4_of_Nagios_server
-
- # In the following example, the parameters are hardcoded.
- # These parameters can be modified as needed.
-
- # Note: For CentOS 64-bit users, use/usr/lib64 instead of/usr/lib ##
-
- Command [check_users] =/usr/lib/nagios/plugins/check_users-w 5-c 10
- Command [check_load] =/usr/lib/nagios/plugins/check_load-w 15,10, 5-c 30,25, 20
- Command [check_hda1] =/usr/lib/nagios/plugins/check_disk-w 20%-c 10%-p/dev/hda1
- Command [check_zombie_procs] =/usr/lib/nagios/plugins/check_procs-w 5-c 10-s Z
- Command [check_total_procs] =/usr/lib/nagios/plugins/check_procs-w 150-c 200
Now that the configuration file is ready, the NRPE service can be started.
Step 3: Initialize the NRPE Service
For RedHat-based systems, the NRPE service needs to be added as a startup service.
For Debian, Ubuntu, and Linux Mint:
- # Service nagios-nrpe-server restart
For CentOS, Fedora, or RHEL:
- # Service nrpe restart
- # Chkconfig nrpe on
Step 4: Verify the NRPE service status
The status information of the NRPE daemon can be found in the system log. For Debian-based systems, log files are stored in/var/log/syslog, while for RedHat-based systems, the log files are/var/log/messages. A sample log is provided below for your reference:
- Nrpe [19723]: Starting up daemon
- Nrpe [19723]: Listeningfor connections on port 5666
- Nrpe [19723]: Allowing connections from: 127.0.0.1, X. X
If a firewall is used, TCP port 5666 used by the NRPE daemon should be enabled.
- # Netstat-tpln | grep 5666
- Tcp 000.0.0.0: 56660.0.0.0: * LISTEN 19885/nrpe
For more details, please continue to read the highlights on the next page: