Linux NRPE3
IMPORTANT: This monitoring connector is deprecated. For a more standard deployment, monitor your Linux servers using Linux NRPE4.
Overview​
NRPE (Nagios Remote Plugin Executor) is a protocol that was designed to remotely run monitoring commands.
This Monitoring Connector relies on 3 components that are listed below:
Component | Type | Location | Role |
---|---|---|---|
centreon_nrpe3_plugin | Binary executable | Poller | Sends a command name and arguments associated to it |
centreon_linux_local.pl | Perl Script | Monitored host | Is run locally and returns a status, an output message and metrics |
centreon-nrpe3 | Service/daemon | Monitored host | Listens on port 5666 and runs the configured commands on demand |
Monitoring Connector assets​
Monitored objects​
- CentOS 7 / RHEL7 Linux servers (to which this procedure applies)
- Other GNU/Linux distributions, provided that the plugin and the daemon are installed and configured manually)
Collected metrics​
Only standard metrics are described in this section. Be aware that a lot of other checks and metrics are available from the centreon_linux_local.pl
Plugin. Here is a non-exhaustive list:
- OS-Linux-NRPE3-custom
Service Alias | Service Template | Service Description |
---|---|---|
Check-Plugin | OS-Linux-Check-Plugin-NRPE3-custom | SSH execution commands in a remote host |
Cmd-Generic | OS-Linux-Cmd-Generic-NRPE3-custom | Check command returns |
Connections-Generic | OS-Linux-Connections-Generic-NRPE3-custom | Check tcp/udp connections |
Cpu-Detailed | OS-Linux-Cpu-Detailed-NRPE3-custom | Check average usage for each CPUs |
Disk | OS-Linux-Disks-NRPE3-custom | Check storage usage |
Disk-IO | OS-Linux-Disk-IO-NRPE3-custom | Check some disk io counters |
File-Date-Generic | OS-Linux-File-Date-Generic-NRPE3-custom | Check time of files/directories |
File-Size-Generic | OS-Linux-File-Size-Generic-NRPE3-custom | Check size of files/directories |
Inodes | OS-Linux-Inodes-NRPE3-custom | Check Inodes space usage |
Is-File-Generic | OS-Linux-Is-File-Generic-NRPE3-custom | Check the presence of a file |
Is-Not-File-Generic | OS-Linux-Is-Not-File-Generic-NRPE3-custom | Check the absence of a file |
Load | OS-Linux-Load-NRPE3-custom | Check system load-average |
Ntp | OS-Linux-Ntp-NRPE3-custom | Check ntp daemons |
OpenFile | OS-Linux-OpenFile-NRPE3-custom | Check open files |
Packet-Errors | OS-Linux-Packet-Errors-NRPE3-custom | Check packet errors and discards on interfaces |
Pending-Updates | OS-Linux-Pending-Updates-NRPE3-custom | Check pending updates |
Process-Generic | OS-Linux-Process-Generic-NRPE3-custom | Check linux processes |
Systemd-Journal | OS-Linux-Systemd-Journal-NRPE3-custom | Count journal entries |
Systemd-Sc-Status | OS-Linux-Systemd-Sc-Status-NRPE3-custom | Check services managed by systemd |
Traffic | OS-Linux-Traffic-NRPE3-custom | Check Traffic |
The services listed above are created automatically when the OS-Linux-NRPE3-custom host template is used.
Here are the metrics that are collected by default:
- Cpu
- Load
- Memory
- Swap
- Uptime
Metric | Description | UOM |
---|---|---|
0#core.cpu.utilization.percentage | Average core 0 CPU usage | % |
1#core.cpu.utilization.percentage | Average core 1 CPU usage | % |
... | ... | % |
cpu.utilization.percentage | Average overall CPU usage | % |
Metric | Description | UOM |
---|---|---|
load1 | System load average on last 1 minute | |
load5 | System load average on last 5 minutes | |
load15 | System load average on last 15 minutes |
Metric | Description | UOM |
---|---|---|
buffer | Amount of memory allocated to buffers | B |
cached | Amount of memory allocated to cache | B |
slab | Amount of memory allocated to Slab | B |
used | Total amount of used memory | B |
Metric | Description | UOM |
---|---|---|
swap.free.bytes | Free Swap space | B |
swap.usage.bytes | Used Swap space | B |
swap.usage.percentage | Swap space usage | % |
Metric | Description | UOM |
---|---|---|
uptime | Elapsed time since last reboot | s |
Prerequisites​
This chapter describes the installation prerequisites required by the plugin to run.
Network flows​
The default TCP port for NRPE is 5666.
Source | Destination | Protocol | Port |
---|---|---|---|
Poller | Monitored host | TCP | 5666 |
Installation of Centreon-packaged NRPE3 daemon and Linux local plugin​
The monitored hosts will need two components to be monitored:
- the
centreon_linux_local.pl
plugin - the NRPE3 daemon
To install them, run the commands below:
- RHEL / CentOS / Oracle Linux 8
- CentOS 7
- Debian 11 & 12
dnf install -y dnf-plugins-core
dnf config-manager --add-repo https://packages.centreon.com/rpm-standard/22.10/el8/centreon-22.10.repo
dnf install centreon-nrpe3-daemon.x86_64 centreon-plugin-Operatingsystems-Linux-Local.noarch
NB: To avoid installing the Centreon Yum repo on all your monitored Linux servers, both
https://yum.centreon.com/standard/22.10/el8/stable/noarch/RPMS/centreon-plugin-Operatingsystems-Linux-Local-20230117-074217.el8.noarch.rpm
andhttps://yum.centreon.com/standard/22.10/el8/stable/x86_64/RPMS/centreon-nrpe3-plugin-4.0.3-0.el8.x86_64.rpm
(current version at the time this document is written) can be installed directly but this installation mode won't allow the packages to be updated withyum update
command, so it is not recommended.
yum install -y yum-utils
yum-config-manager --add-repo https://packages.centreon.com/rpm-standard/22.10/el7/centreon-22.10.repo
yum install centreon-nrpe3-daemon.x86_64 centreon-plugin-Operatingsystems-Linux-Local.noarch
NB: To avoid installing the Centreon Yum repo on all your monitored Linux servers, both
https://yum.centreon.com/standard/22.10/el7/stable/noarch/RPMS/centreon-plugin-Operatingsystems-Linux-Local-20230117-074217.el7.centos.noarch.rpm
andhttps://yum.centreon.com/standard/22.10/el7/stable/x86_64/RPMS/centreon-nrpe3-daemon-4.0.3-0.el7.centos.x86_64.rpm
(current version at the time this document is written) can be installed directly but this installation mode won't allow the packages to be updated withyum update
command, so it is not recommended.
# Add centreon-engine user
useradd --create-home centreon-engine
# Install gpg
apt install gpg
# Add Centreon repo
wget -qO- https://packages.centreon.com/api/security/keypair/Debian/public | gpg --dearmor > /etc/apt/trusted.gpg.d/centreon.gpg
echo "deb https://packages.centreon.com/artifactory/apt-plugins-stable/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/centreon-plugins.list
apt update
# Install centreon-nrpe3-daemon
apt install centreon-nrpe3-daemon centreon-plugin-operatingsystems-linux-local
# Create directory for the plugin cache
mkdir -p /var/lib/centreon/centplugins/
chown centreon-engine: /var/lib/centreon/centplugins/
NB: To avoid installing the Centreon Yum repo on all your monitored Linux servers, both
https://packages.centreon.com/artifactory/apt-plugins-stable/pool/nrpe/centreon-nrpe3-plugin_4.1.0-150207_amd64.deb
andhttps://packages.centreon.com/artifactory/apt-plugins-stable/pool/nrpe/centreon-nrpe3-daemon_4.1.0-150207_amd64.deb
(current version at the time this document is written) can be installed directly but this installation mode won't allow the packages to be updated withapt update
command, so it is not recommended.
NRPE daemon configuration​
The value of the allowed_hosts
parameter in /etc/nrpe/centreon-nrpe3.cfg
must be changed to include the pollers IP addresses:
[...]
# ALLOWED HOST ADDRESSES
# This is an optional comma-delimited list of IP address or hostnames
# that are allowed to talk to the NRPE daemon. Network addresses with a bit mask
# (i.e. 192.168.1.0/24) are also supported. Hostname wildcards are not currently
# supported.
allowed_hosts=127.0.0.1,::1
[...]
And the service must be restarted:
systemctl restart centreon-nrpe3.service
Installation​
Monitoring Connector​
The Monitoring Connector installation concerns only the central server and the procedure depends on the type of license.
- IMP/EPP Online License & IT-100 Editions
- IMP/EPP Offline License
Install the "Linux NRPE3" Monitoring Connector from Configuration > Monitoring Connector Managerin the WUI.
- Install the Monitoring Connector's RPM on the central server.
yum install centreon-pack-operatingsystems-linux-nrpe3
- Install the "Linux NRPE3" Monitoring Connector from Configuration > Monitoring Connector Managerin the WUI.
Centreon NRPE3 Plugin​
Install this plugin on each poller:
yum install centreon-nrpe3-plugin
Prerequisites and installation validation​
If everything is fine, this command:
/usr/lib64/nagios/plugins/check_centreon_nrpe3 -H monitored_host_ip -p 5666
should produce this output:
NRPE v4.0.3
Otherwise please refer to the troubleshooting section.
Centreon Configuration​
Create a host using the appropriate template​
Go to Configuration > Hosts and click Add. Then, fill the form as shown by the following table:
Once the template has been applied, the following macros can be customized:
Mandatory | Name | Description |
---|---|---|
X | NRPECLIENT | Name of the plugin to use to dialog with the NRPE3 daemon (default: check_centreon_nrpe3 ) |
X | NRPEPORT | TCP port the NRPE3 daemon is listening to (default: 5666) |
X | NRPETIMEOUT | Command timeout (default: 5s) |
NRPEEXTRAOPTIONS | Any extra option (default: -u to return an UNKNOWN state in case of a connection issue) |
FAQ​
How does it work?​
Here is a command monitors the Cpu usage of the Linux Server having the IP address x.x.x.x
:
/usr/lib64/nagios/plugins/check_centreon_nrpe3 \
-H x.x.x.x \
-p 5666 -t 5 -u \
-c check_centreon_plugins \
-a 'os::linux::local::plugin' 'cpu' ' --statefile-dir=/var/log/nrpe/centplugins'
It should return this:
OK: CPU(s) average usage is: 1.16% | 'cpu0'=1.64%;;;0;100 'cpu1'=0.98%;;;0;100 'cpu2'=1.09%;;;0;100 'cpu3'=0.94%;;;0;100 'total_cpu_avg'=1.16%;;;0;100
What happened:
- The
check_centreon_nrpe3
executable asked the daemon to run the "check_centreon_plugins" command with "os::linux::local::plugin" "cpu" and " --statefile-dir=/var/log/nrpe/centplugins" as arguments - The NRPE daemon puts together the command (that is defined in the NRPE configuration file) with its arguments, forming this local command line:
/usr/lib/centreon/plugins/centreon_linux_local.pl --plugin=os::linux::local::plugin --mode=cpu --statefile-dir=/var/log/nrpe/centplugins
- The NRPE daemon runs this command and sends its results (return code and standard output) back to the
check_centreon_nrpe3
executable, that was waiting for the answer.
Troubleshooting​
Let's detail the most common errors.
connect to address x.x.x.x port 5666: Connection refused
​
If the output of the command is:
connect to address x.x.x.x port 5666: Connection refused
It probably means that the IP address from which the request was sent is not allowed to dialog with the NRPE daemon.
The allowed_hosts
parameter, in the /etc/nrpe/centreon-nrpe3.cfg
configuration file (see above).
Then restart the service.
systemctl restart centreon-nrpe3.service
CHECK_NRPE STATE CRITICAL: Socket timeout after 10 seconds
​
If the output of the command is:
CHECK_NRPE STATE CRITICAL: Socket timeout after 10 seconds.
Then the following points must be checked:
- the
centreon-nrpe3
is effectively started
systemctl status centreon-nrpe3.service
- the TCP port that is used by the plugin (
-p 5666
for example) is the same as the one configured for the daemon - there is no local firewall blocking the NRPE port (
iptables -L
) - there is no firewall device filtering this port on the network
NRPE: Command 'my_command' not defined
​
If the output of the command is:
NRPE: Command 'my_command' not defined
This means that the daemon is asked to run a command it doesn't know about.
For a command to be recognized, it has to be defined using the right syntax:
[my_command]=/full/path/to/command --argument --other-argument
And restart the daemon:
systemctl restart centreon-nrpe3.service