How to Install Nagios Plugins and NRPE Agent on CentOS 7

  Dedicated Hosting

Introduction

Nagios is a powerful monitoring tool used to track system performance, services, and network resources. By installing Nagios Plugins and the NRPE (Nagios Remote Plugin Executor) agent on CentOS 7, you can monitor remote Linux servers efficiently. NRPE allows the Nagios server to execute plugins on remote hosts and collect system metrics such as CPU load, memory usage, disk space, and running processes.


Prerequisites

Before starting the installation, ensure the following:

  • A server running CentOS 7
  • Root or sudo access
  • Internet connectivity to download packages
  • EPEL repository enabled (required for NRPE and plugins)
  • Firewall access to allow NRPE port (5666)

Implementation

Step 1: Install EPEL Repository

yum install epel-release -y

Step 2: Install NRPE Agent

yum install nrpe -y

Verify installation:

nrpe -V

Step 3: Install Nagios Plugins

yum install nagios-plugins{load,http,users,procs,disk,swap,nrpe,uptime} -y

Check installed plugins:

ls /usr/lib64/nagios/plugins/

Step 4: (Optional) Install check_mem Plugin

chmod +x /usr/lib64/nagios/plugins/check_mem

Step 5: Configure NRPE

Edit configuration file:

vim /etc/nagios/nrpe.cfg

Add/verify:

command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib64/nagios/plugins/check_load -r -w 8.0,7.5,7.0 -c 11.0,10.0,9.0
command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w 15% -c 10% /
command[check_mem]=/usr/lib64/nagios/plugins/check_mem -w 75% -c 90%
command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 300 -c 400
command[check_swap]=/usr/lib64/nagios/plugins/check_swap -w 10 -c 5

Step 6: Configure Firewall

firewall-cmd --add-service=nrpe --permanent
firewall-cmd --reload

Step 7: Start and Enable NRPE

systemctl start nrpe
systemctl enable nrpe

Step 8: Verify NRPE Port

ss -altn | grep 5666

Step 9: Test NRPE Commands

Example:

/usr/lib64/nagios/plugins/check_nrpe -H 127.0.0.1 -c check_load

Conclusion

By completing the above steps, Nagios Plugins and the NRPE agent are successfully installed and configured on CentOS 7. This setup enables remote monitoring of critical system metrics such as CPU load, memory usage, disk space, and processes. With NRPE properly configured, your Nagios server can efficiently monitor and manage the health and performance of remote systems.

LEAVE A COMMENT