0

在 Centos7 上,按照nrpe 插件安装步骤,在测试 Nagios 服务器和远程代理之间的连接时,我收到了这个错误...

/usr/local/nagios/libexec/check_nrpe -H 192.168.50.5
CHECK_NRPE: Error - Could not connect to 192.168.50.5: Connection reset by peer

在 /etc/xinetd.d/nrpe 中,我将 Nagios 服务器的 IP 地址添加到 only_from 字段。

# default: off
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
    disable         = no
    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 ::1 {server_IP}
    log_on_success  =
}

然后我重新启动了 xinetd 服务;但是,在检查服务状态时,会出现此错误日志消息...

Aug 09 09:32:21 localhost.localdomain xinetd[1448]: bind failed (Address already in use (errno = 98)). service = nrpe
Aug 09 09:32:21 localhost.localdomain xinetd[1448]: Service nrpe failed to start and is deactivated.
4

1 回答 1

1

解决方案是不仅要在 /etc/xinetd.d/nrpe 中包含服务器 IP,还要在重新启动 xinetd 服务之前停止 nrpe 服务。

systemctl stop nrpe
systemctl restart xinetd

似乎自行重新启动 xinetd 无法加载 nrpe 服务,因为它的端口与现有的 nrpe 服务冲突。

于 2021-08-09T09:58:34.263 回答