---
title: Nagios和NRPE监测软件的安装
description: "1. 使用PuTTY工具，以root用户登录服务器。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpcindapp/instg-osc/openhpc_030.html
sourcePath: /source/zh/kunpenghpcs/hpcindapp/instg-osc/openhpc_030.html
indexId: ca727002e85ae8ac94b69d30f2076a783476ab2d8ceec1d800be88c85888369859
---
# Nagios和NRPE监测软件的安装

#### 操作步骤

1. 使用PuTTY工具，以root用户登录服务器。
2. 执行以下命令在外网下载安装依赖包。

```
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
```


3. 执行以下命令安装以上安装包。

```
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
```


4. 执行以下命令在管理节点上安装Nagios。

```
yum install ohpc-nagios -y
```


5. 执行以下命令在计算节点上安装NRPE。

```
yum install nagios-plugins-all-ohpc nrpe-ohpc -y
```


6. 执行以下命令在计算节点上使能和配置NRPE。

```
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
```


  192.168.47.111是Nagios服务端的IP地址。

7. 执行以下命令在计算节点上配置Remote Services。

```
mv /etc/nagios/conf.d/services.cfg.example /etc/nagios/conf.d/services.cfg
```


8. 执行以下命令在服务端上配置计算节点的内容。

```
mv /etc/nagios/conf.d/hosts.cfg.example /etc/nagios/conf.d/hosts.cfg
```


9. 执行以下命令在服务端上更新告警的邮件通知信息。

```
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
```


10. 执行以下命令在服务端上设置webservice用户的密码。

```
htpasswd -bc /etc/nagios/passwd nagiosadmin huawei
```


11. 执行以下命令在服务端上启动相关进程。

```
systemctl enable nagios.service
systemctl start nagios.service
chmod u+s `which ping`
systemctl start httpd
systemctl enable httpd
```
