How to install the nrpe (nagios client) for centos
How to install the nrpe (nagios client) for centos
Step 1
Install Nagios Client on centos
First, enter the terminal, open the server, and run the following command to install
sudo yum update sudo yum install epel-release
sudo yum install nrpe nagios-plugins-all
Here nagios-nrpe-server package installs service on the system and nagios-plugins provide monitoring scripts, which are called with the NRPE client on request of the Nagios server.
Step 2
Configure Nagios Client
In NRPE configuration, first, we need to configure to which Nagios servers it accepts requests, For example, your Nagios server IP is 69.30.214.227, then add this IP to the allowed host's list. Edit NRPE configuration file /etc/nagios/nrpe.cfg and make the necessary changes like below:
vi /etc/nagios/nrpe.cfg allowed_hosts=127.0.0.1, nagois IP
Next, restart the NRPE service. Now it is ready to listen to requests from the Nagios server
systemctl restart nrpe
Step 3
Update Command Definitions for NRPE
You must have defined all the commands to be used by the Nagios server. Some of them are pre-configured with the installation. You may be required to change the command as per your system’s configuration. Also, you can add more customized commands to monitor your server.
Edit the /etc/nagios/nrpe.cfg configuration file and search for COMMAND DEFINITIONS sections. Here you can define or update check commands.
vi /etc/nagios/nrpe.cfg
Go to inside nrpe.cfg edit this type
command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10 command[check_load]=/usr/lib/nagios/plugins/check_load -r -w 15,10,9 -c 30,20,18 command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1 command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200 command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p / command[check_mem]=/usr/lib/nagios/plugins/check_mem -f -w 5 -c 2
Save the configuration file and restart the NRPE daemon to apply changes:
systemctl restart nrpe
check nrpe status
systemctl status nrpe
Step 4
Allowing nrpe port
We need to allow the port below commands
ufw status ufw allow 5666