Nagios - NRPE:尽管一切配置似乎都正确,但无法读取输出

Nagios - NRPE:尽管一切配置似乎都正确,但无法读取输出

我有一台 Nagios 机器,它监控许多 linux\windows 服务器。大约一周前我开始在这里工作,并接到一项在 Nagios 中下订单的任务。作为订单的一部分,我必须向 Nagios 添加另外 2 个 linux 服务器。我在两台机器上都安装了 nagios-plugins 和 nrpe,此外,我已验证端口 5666 已打开并在两台服务器上监听,我可以在 ps -aux |grep nrpe 中看到 nrpe 正在运行。运行插件的用户是 root。**编辑:nrpe 配置为作为守护进程运行,因此 xinetd 在这里不起作用,此外,检查 /var/log/messages |grep nrpe 返回:

Sep 27 12:29:25 search-uk-1 nrpe[11708]: Starting up daemon
Sep 27 12:29:25 search-uk-1 nrpe[11708]: Listening for connections on port 5666
Sep 27 12:29:25 search-uk-1 nrpe[11708]: Allowing connections from: avalon.office.incredimail.com,avalon.qa.incredimail.com,lu2.int.incredimail.com,lu2.ext.incredimail.com,206.82.140.185
Sep 27 12:30:54 search-uk-1 nrpe[11753]: Error: Could not complete SSL handshake. 1
Sep 27 12:37:33 search-uk-1 nrpe[11708]: Caught SIGTERM - shutting down...
Sep 27 12:37:33 search-uk-1 nrpe[11708]: Cannot remove pidfile '/var/run/nrpe.pid' - check your privileges.
Sep 27 12:37:33 search-uk-1 nrpe[11708]: Daemon shutdown
Sep 27 12:37:33 search-uk-1 nrpe[12114]: Starting up daemon

任何通过 Nagios 正确监控的服务器上均未启用 SSL。从 Nagios 服务器本身对远程服务器运行 check_nrpe 测试返回:

[root@lu2 ~]# /usr/lib/nagios/plugins/check_nrpe -H 10.0.80.98 -p 5666
NRPE v2.12
[root@lu2 ~]#

这是/etc/nagios/nrpe.cfg的内容:

log_facility=daemon
pid_file=/var/run/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=127.0.0.1

dont_blame_nrpe=0
debug=0
command_timeout=60
connection_timeout=300
command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/mapper/VolGroup-lv_root
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200
include=/etc/nagios/command-im.cfg

我已将此文件与正在运行的 Nagios 监控主机之一的文件进行比较,未发现任何差异。手动运行命令会返回正确的值。

两台服务器上的任何服务均无法正常运行: 在此处输入图片描述

非常感谢您的帮助。

答案1

我发现一个具体问题:你的 nrpe.conf(在客户端)中的 allowed_hosts 应该设置为 nagios 监控主机的 IP 号。将其设置为本地主机意味着你的客户端和监控主机是同一台主机(即本地),这不太可能。

另一种情况是,有时远程插件没有启用加密,因此当 nagios 发出命令时,与远程 npre 的连接会失败。您可以尝试通过 check_nrpe 的 -n 开关检查有无 SSL 编码的 nrpe。

无论如何,请使用命令 /usr/lib/nagios/plugins/check_nrpe 并从 nagios 监控主服务器检查远程主机 nrpe。这样,您可以获得大量信息。

例如:/usr/lib/nagios/plugins/check_nrpe -H 主机名

如果 nrpe 没有在被监控主机上运行,​​那么你将不会得到任何返回。

答案2

在大多数情况下,这是一个权限问题...在以通常执行它们的用户身份运行的 su shell 中使用给定的参数运行插件,并检查它们在哪里失败。

相关内容