NRPE(Nagios Remote Plugin Executor)是一个 Nagios 插件,用于在远程主机上远程执行插件和脚本。这允许您监视远程主机上的资源,例如磁盘使用情况、CPU 负载和网络活动。在本文中,我们将向您展示如何在 CentOS/RHEL 9/8 上安装 NRPE。
先决条件
在安装 NRPE 之前,您必须满足以下先决条件:
- 运行 CentOS/RHEL 9/8/7 的服务器。
- 具有 sudo 或 root 权限的用户帐户。
- 您的系统上必须安装 yum 包管理器。
第1步:安装NRPE包
要安装 NRPE 软件包,请以 root 身份或使用 sudo 权限运行以下命令:
sudo yum install nrpe nagios-plugins-nrpe -y
步骤 2:配置 NRPE
安装完成后,需要配置NRPE。 NRPE 配置文件位于 /etc/nagios/nrpe.cfg。使用您喜欢的文本编辑器打开文件并进行以下更改:
- Change the allowed_hosts directive to allow connections from your Nagios server. For example, if your Nagios server has an IP address of 192.168.1.100, you would add the following line to the configuration file:
- Define the commands that NRPE will execute. The commands are defined in the command[ ] sections of the configuration file. For example, to define a command to check the load average on the remote host, you would add the following line to the configuration file:
|
command[检查根磁盘]=/usr/lib64/nagios/plugins/检查磁盘 -w 20% -c 10% -p / |
步骤 3:启动并启用 NRPE 服务
要启动并启用 NRPE 服务,请运行以下命令:
sudo systemctl start nrpe
sudo systemctl enable nrpe
步骤 4:测试 NRPE 配置
最后,您可以通过在 Nagios 服务器上运行以下命令来测试 NRPE 配置:
/usr/lib64/nagios/plugins/check_nrpe -H
如果 NRPE 配置正确,输出应类似于以下内容:
Output
NRPE v4.1.0
结论
在本文中,我们向您展示了如何在 CentOS/RHEL 9/8 上安装 NRPE。 NRPE 允许您从 Nagios 服务器监控远程主机上的资源。通过本文概述的步骤,您应该能够在服务器上安装 NRPE 并开始监控您的网络。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)