NRPE and Remote Checks
1. Introduction
The Nagios Remote Plugin Executor (NRPE) allows Nagios to execute plugins on remote Linux/Unix machines. This capability is essential for monitoring services that can't be checked via standard network connections, such as local performance metrics.
2. Key Concepts
2.1 What is NRPE?
NRPE is a daemon that runs on a remote host and allows Nagios to execute checks on that host. It is primarily used for monitoring local resources, such as CPU load, disk usage, and memory consumption.
2.2 Remote Checks
Remote checks are executed by the NRPE daemon on a remote machine in response to a request from the Nagios monitoring server. This allows for real-time monitoring of system metrics that are specific to that machine.
3. Installation
To install NRPE, follow these steps:
- Install NRPE on the remote host:
- Edit the NRPE configuration file:
- Allow the Nagios server's IP address in the configuration:
- Restart NRPE service:
sudo apt-get install nagios-nrpe-server nagios-plugins
sudo nano /etc/nagios/nrpe.cfg
allowed_hosts=127.0.0.1,
sudo systemctl restart nagios-nrpe.service
4. Configuration
NRPE needs to be configured to define what checks will be available for Nagios to run. This is done in the `nrpe.cfg` file.
4.1 Adding Commands
Commands can be added to the `nrpe.cfg` file to define the checks:
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
In this example, the command checks disk usage and warns if it's above 20% and critical at 10%.
5. Best Practices
- Keep NRPE updated to the latest version.
- Limit the number of allowed hosts to only those necessary.
- Use secure methods (e.g., SSL) for communication between Nagios and NRPE.
- Regularly review and update the commands configured in `nrpe.cfg`.
- Monitor the NRPE service health regularly to ensure it is running as expected.
6. FAQ
What protocols does NRPE use?
NRPE typically uses TCP for communication, defaulting to port 5666.
Can NRPE be used to monitor Windows servers?
No, NRPE is designed for Linux/Unix environments. Windows servers can be monitored using NSClient++.
Is NRPE secure?
By default, NRPE is not secure. However, you can secure NRPE by using SSL.