3.3. 配置 Nagios 核心服务器访问远程节点
为了使 Nagios Core 服务器能够访问远程机器上的 Nagios Remote Plugin Executor(NPRE),远程计算机的 xinetd 和 NRPE 配置必须使用 Nagios 核心服务器的 IP 地址更新。
先决条件
- 用户级访问 Nagios 核心服务器.
- 互联网访问.
- 访问 Nagios 远程插件执行器.
流程
使用 Nagios 服务器的 IP 地址编辑 xinetd 配置:
[user@mon]# vi /etc/xinetd.d/nrpe# default: off # description: NRPE (Nagios Remote Plugin Executor) service nrpe { disable = yes socket_type = stream port = 5666 wait = no user = nagios group = nagios server = /usr/local/nagios/bin/nrpe server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd only_from = 127.0.0.1,IP_ADDRESS_OF_NAGIOS_CORE_SERVER log_on_success = }将 Nagios Core 服务器的 IP 地址添加到
only_from选项后,重启xinetd服务:[user@mon]# systemctl restart xinetd使用 Nagios 服务器的 IP 地址编辑 NRPE 配置:
[user@mon]# vi /usr/local/nagios/etc/nrpe.cfgallowed_hosts=127.0.0.1,IP_ADDRESS_OF_NAGIOS_CORE_SERVER将 Nagios Core 服务器的 IP 地址添加到
allowed_hosts设置。然后,重启nrpe:[user@mon]# systemctl restart nrpe测试安装:
[user@host]# /usr/local/nagios/libexec/check_nrpe -H localhost该检查应回显
NRPE v3.1.0-rc1(如果工作正常)。