How to Install Nagios Plugins and NRPE agent on CentOS 7

  Dedicated Hosting

How to Install Nagios Plugins and NRPE agents on CentOS 7

Date : 15-07-2020

Install EPEL repositories :

For CentOS 7, you need to install EPEL repositories by running any of the command below

yum install epel-release -y

Installing NRPE CentOS 7 :

yum install nrpe -y

You can verify the version of the installed NRPE
nrpe -V

Installing Nagios plugins on CentOS 7 :

yum list nagios-plugins*

To install specific Nagios plugins for example to check the load, http, users, processes, disk space, swap space, uptime, run the command below :

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

Once the installation is done, tou can check your plugins under /usr/lib64/nagios/plugins/

ls /usr/lib64/nagios/plugins/

If you also need to monitor physical system memory, download the check_mem Nagios plugin following plugin to the plugins directory. Once you have downloaded, make it executable :

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

Configure NRPE Agent :

The NRPE agent configuration file is located under /etc/nagios/nrpe.cfg

vim /etc/nagios/nrpe.cfg

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

Once you are done with configurations, save and quit the file

Allow NRPE on Firewall :

If firewall is running, allow NRPE through it;

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

Start and Enable NRPE to run on system boot :

systemctl start nrpe

systemctl enable nrpe

Verify the NRPE port is open and listening :

ss -altn | grep 5666

Verify that your Plugins are working as expected.

Check Running Processes

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

PROCS OK: 105 processes | procs=105;300;400;0;

Check Load

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

OK - load average: 0.04, 0.16, 0.08|load1=0.040;8.000;11.000;0; load5=0.160;7.500;10.000;0; load15=0.080;7.000;9.000;0;

Check Swap Memory

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

SWAP OK - 100% free (1023 MB out of 1023 MB) |swap=1023MB;0;0;0;1023

Check Logged in Users

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

USERS OK - 2 users currently logged in |users=2;5;10;0

Check Disk Space

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

DISK OK - free space: / 6440 MB (78.74% inode=99%);| /=1737MB;6951;7360;0;8178

Check Memory

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

DISK CRITICAL - free space: / 6438 MB (78.73% inode=99%); /boot 751 MB (82.64% inode=100%); /var/tmp 6438 MB (78.73% inode=99%);| /=1739MB;2044;817;0;8178 /boot=157MB;243;97;0;975 /var/tmp=1739MB;2044;817;0;8178

You have successfully set up install and set up Nagios Plugins and NRPE agents on CentOS 7.

LEAVE A COMMENT