为什么 nrpe 找不到我的文件?

Why doesn't nrpe find my file?

我有一个 nagios 检查来报告 puppet 运行 success/failures。支票 运行 在当地没问题:

$ sudo -u nrpe /usr/local/nagios/libexec/check_puppet_agent
I AM: nrpe
CRITICAL: Puppet daemon not running or something wrong with process

出于调试目的,我正在回应 whoami 的输出。然后我收到 CRITICAL 消息,因为 puppet 服务已停止,没关系。到目前为止,还不错。

然而,当我 运行 从 nagios 服务器远程检查时,我得到这个:

$ /usr/local/nagios/libexec/check_nrpe -H MY-HOST -c check_puppet_agent
I AM: nrpe

UNKNOWN: last_run_summary.yaml not found, not readable

读取文件系统似乎有问题。当 运行 远程时,NRPE 无法读取 /var/lib/puppet 目录,但 nrpe 用户可以在本地读取它。为什么是这样?什么可能导致此错误?检查应该是运行作为nrpe用户,为什么不能读取目录?

好的,显然问题出在 selinux。它阻止进程 nrpe 访问 /var/lib/puppet 目录,所以我不得不使用一些规则来设置 selinux 模块以允许 nrpe 运行 此检查。