NRPE (Nagios Remote Plugin Executor) is a Nagios plugin used to remotely execute plugins and scripts on remote hosts. This allows you to monitor resources, such as disk usage, CPU load, and network activity, on remote hosts. In this article, we will show you how to install NRPE on CentOS/RHEL 9/8.
Prerequisites
Before installing NRPE, you must have the following prerequisites:
- A server running CentOS/RHEL 9/8/7.
- A user account with sudo or root privileges.
- The yum package manager must be installed on your system.
Step 1: Install NRPE Package
To install the NRPE package, run the following command as root or with sudo privileges:
sudo yum install nrpe nagios-plugins-nrpe -y
Step 2: Configure NRPE
After the installation is complete, you need to configure NRPE. The NRPE configuration file is located at /etc/nagios/nrpe.cfg. Open the file using your favorite text editor and make the following changes:
- Change the allowed_hosts directive to allow connections from your Nagios server. For example, if your Nagios server has an IP address of 192.168.1.100, you would add the following line to the configuration file:1allowed_hosts=192.168.1.100
- Define the commands that NRPE will execute. The commands are defined in the command[ ] sections of the configuration file. For example, to define a command to check the load average on the remote host, you would add the following line to the configuration file:1command[check_root_disk]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /
Step 3: Start and Enable NRPE Service
To start and enable the NRPE service, run the following commands:
sudo systemctl start nrpe
sudo systemctl enable nrpe
Step 4: Test NRPE Configuration
Finally, you can test the NRPE configuration by running the following command on your Nagios server:
/usr/lib64/nagios/plugins/check_nrpe -H
If the NRPE configuration is correct, the output should be similar to the following:
OutputNRPE v4.1.0
Conclusion
In this article, we showed you how to install NRPE on CentOS/RHEL 9/8. NRPE allows you to monitor resources on remote hosts from your Nagios server. With the steps outlined in this article, you should be able to install NRPE on your server and get started with monitoring your network.
6 Comments
service nrpe restart is not runing giving error
Authorization not available. Check if polkit service is running or see debug message for more information.
Failed to restart nrpe.service: Unit not found.
please suggest.
Hi Rahul,
Is there any nagios plugin for get client servers /root/.bash_history ‘s file details. And it should to be append further command line activities.
For adding the epel repository you give a command that calls a specific version of the rpm file. Once they update to a later version of the rpm file that current version is gone. They have a different link that will bring down the current version (no matter what version it is) and so the command works all the time. Well it is specific for like RH 6 or RH 7. That threw me for a loop for a bit when it would not run.
rpm -Uhv http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Thanks Rusty, Tutorial has been updated with latest packages.
Error please help me
Starting nrpe (via systemctl): Job for nrpe.service failed. See ‘systemctl status nrpe.service’ and ‘journalctl -xn’ for details. [FAILED]
Follow all steps and when start service return error
Tks!
Did you run”systemctl status nrpe.service” and “journalctl -xn” for details?