Installing Nagios and NRPE
Procedure
- Use PuTTY to log in to the server as the root user.
- Run the following commands to download the dependencies from the external network:
wget http://www.rpmfind.net/linux/fedora/linux/releases/32/Everything/aarch64/os/Packages/q/qstat-2.15-11.20200131gitd1469ab.fc32.aarch64.rpm
wget http://www.rpmfind.net/linux/epel/7/aarch64/Packages/f/fping-3.10-4.el7.aarch64.rpm
wget http://www.rpmfind.net/linux/epel/7/ppc64/Packages/p/python2-mock-1.0.1-10.el7.noarch.rpm
- Install the dependencies.
yum install qstat-2.15-7.20150619gita60436.fc29.aarch64.rpm fping-3.10-4.el7.aarch64.rpm python2-mock-1.0.1-10.el7.noarch.rp
- Install Nagios on the management node.
yum install ohpc-nagios -y
- Install NRPE on the compute node.
yum install nagios-plugins-all-ohpc nrpe-ohpc -y
- Enable and configure NRPE on the compute node.
systemctl enable nrpe
perl -pi -e "s/^allowed_hosts=/# allowed_hosts=/" /etc/nagios/nrpe.cfg
echo "nrpe 5666/tcp # NRPE" >> /etc/services
echo "nrpe : 192.168.47.111 : ALLOW" >> /etc/hosts.allow
echo "nrpe : ALL : DENY" >> /etc/hosts.allow
/usr/sbin/useradd -c "NRPE user for the NRPE service" -d /var/run/nrpe -r -g nrpe -s /sbin/nologin nrpe
/usr/sbin/groupadd -r nrpe
In the command, 192.168.47.111 is the IP address of the Nagios server.
- Configure remote services on the compute node.
mv /etc/nagios/conf.d/services.cfg.example /etc/nagios/conf.d/services.cfg
- Configure the compute node on the server.
mv /etc/nagios/conf.d/hosts.cfg.example /etc/nagios/conf.d/hosts.cfg
- Update the alarm email notification information on the server.
perl -pi -e "s/ \/bin\/mail/ \/usr\/bin\/mailx/g" /etc/nagios/objects/commands.cfg
perl -pi -e "s/nagios\@localhost/root\@${sms_name}/" /etc/nagios/objects/contacts.cfg
- Set the password of the web service user on the server.
htpasswd -bc /etc/nagios/passwd nagiosadmin huawei
- Start the processes on the server.
systemctl enable nagios.service
systemctl start nagios.service
chmod u+s `which ping`
systemctl start httpd
systemctl enable httpd