检查 NFS 时如何调试 Nagios“NRPE:无法读取输出”?

San*_*dra 3 linux ubuntu centos nagios

我有一个可用的 Nagios 设置,例如,出于安全原因,我通过 NRPE 守护程序监视磁盘使用情况,而不通过 NRPE 解析参数。所以我知道 NRPE 有效。

现在我想使用check_mountpoints插件检查 NFS,但我得到

NRPE: Unable to read output 
Run Code Online (Sandbox Code Playgroud)

在 Nagios Monitor 主机上我设置了

define command {
  command_name check_mountpoints
  command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c check_mountpoints 
}

define service {
  use                     generic-service
  name                    check_mountpoints
  host_name               example.com
  service_description     Check_mountpoints for nfs cifs davfs
  check_command           check_nrpe!check_mountpoints
  contact_groups          linux-admins
}
Run Code Online (Sandbox Code Playgroud)

我在远程主机上设置了

command[check_mountpoints]=/usr/lib/nagios/plugins/check_mountpoints.sh /nas1/home
Run Code Online (Sandbox Code Playgroud)

为了验证是否给出了正确的参数,命令输出如下

[root@nas ~]# /usr/lib/nagios/plugins/check_mountpoints.sh /nas1/home
OK: all mounts were found ( /nas1/home)
[root@nas ~]# 
Run Code Online (Sandbox Code Playgroud)

Nagios 监控主机和远程主机都运行着一个正在运行的 NRPE 守护进程。

问题

我该如何调试这样的东西?

erc*_*cpe 5

根据我的经验,这个错误是由于缺少权限引起的。您尝试以 root 身份执行 nrpe 客户端脚本。尝试以 nrpe 守护程序运行的用户身份执行它。这应该会给您提示原因。如果这没有帮助,请尝试运行

strace usr/lib/nagios/plugins/check_mountpoints.sh /nas1/home
Run Code Online (Sandbox Code Playgroud)

作为 nrpe 用户。