How to Install Nagios Plugins and NRPE agents on CentOS 7

From PheonixSolutions
Jump to navigation Jump to search

How to Install Nagios Plugins and NRPE agents on CentOS 7

[edit]

Step 1

Install EPEL repositories

 $yum install epel-release -y

Step 2

Installing NRPE on CentOS 7

 $yum install nrpe -y

You can verify the version of the installed NRPE as shown below;

 $nrpe -V

Step 3

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, to u 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

Step 4

Configure NRPE Agent

 $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 t he file

Step 5

Allow NRPE on Firewall

If firewall is running, allow NRPE through it;

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

Step 6

Start and Enable NRPE to run on system boot

 $systemctl start nrpe
 $systemctl enable nrpe

Step 7

Verify the NRPE port is open and listening;

 $ss -altn | grep 5666

Step 8

Verify that your Plugins are working as expected.

Check Running Processes :

[edit]
  $/usr/lib64/nagios/plugins/check_nrpe -H 127.0.0.1 -c check_total_procs

Check Load :

[edit]
  $/usr/lib64/nagios/plugins/check_nrpe -H 127.0.0.1 -c check_load

Check Swap Memory :

[edit]
  $/usr/lib64/nagios/plugins/check_nrpe -H 127.0.0.1 -c check_swap

Check Logged in Users :

[edit]
  $/usr/lib64/nagios/plugins/check_nrpe -H 127.0.0.1 -c check_users

Check Disk Space :

[edit]
  $/usr/lib64/nagios/plugins/check_nrpe -H 127.0.0.1 -c check_disk

Check Memory :

[edit]
  $/usr/lib64/nagios/plugins/check_nrpe -H 127.0.0.1 -c check_mem