不确定如何解决NRPE问题

时间:2015-11-25 03:10:44

标签: nagios nrpe

如果已经从https://github.com/liquidat/nagios-icinga-checks/blob/master/check_puppetagent

分发了Nagios的木偶支票

我的问题是,如果我通过NRPE在本地执行,我会得到不同的结果:

[root@nagios-client /]# /usr/lib64/nagios/plugins/check_puppetagent
OK: Puppet was last run 17 minutes and 9 seconds ago

VS

[root@nagios ~]# /usr/lib64/nagios/plugins/check_nrpe -H 192.168.50.121 -c check_puppetagent
WARN: Puppet has never run, no /opt/puppetlabs/puppet/cache/state/last_run_summary.yaml found.

编辑文件/usr/lib64/nagios/plugins/check_puppetagent并将行更改为: 客户端上的summary = '/opt/puppetlabs/puppet/cache/state/last_run_summaries.yaml'产生预期结果:

[root@nagios ~]# /usr/lib64/nagios/plugins/check_nrpe -H 192.168.50.121 -c check_puppetagent
WARN: Puppet has never run, no /opt/puppetlabs/puppet/cache/state/last_run_summaries.yaml found.

所以我知道正在执行正确的文件。

从远程工作中手动执行:

[root@nagios ~]# ssh 192.168.50.121 "/usr/lib64/nagios/plugins/check_puppetagent"
root@192.168.50.121's password:
OK: Puppet was last run 13 seconds ago

Antone有什么想法/建议我还可以做些什么来解决问题?

1 个答案:

答案 0 :(得分:0)

last_run_summaries.yaml似乎只能由root读取: https://projects.puppetlabs.com/issues/7106

当您从命令行运行check_puppetagent时,您表明您正在以 root 身份运行。但NRPE可能会以 nagios 用户身份运行check_puppetagent

尝试修改您的nrpe命令配置,以便在sudo之前调用check_puppetagent并修改您的/etc/sudoers文件,以便为 nagios 用户提供运行{{1}的权限} root

编辑:请务必在check_puppetagent文件中注明Defaults requiretty

/etc/sudoers