【问题标题】:Using check_by_ssh in Nagios Yielding Strange Behavior (and Remote Execution Failure)在 Nagios 中使用 check_by_ssh 产生奇怪的行为(和远程执行失败)
【发布时间】:2013-08-03 01:54:36
【问题描述】:

我是 Nagios 的新手,我一直在尝试让 Nagios 处理一些简单的 check_by_ssh 命令。我现在可以成功地从命令行运行命令,如下所示:

#/usr/local/nagios/libexec/check_by_ssh -H HERP.DERP.COM -C "/home/derrp/bin/...
 check_disk -w 50 -c 10 -A"

哪些礼物

DISK OK - free space: blah blah blah

所以,这很好;它工作正常从命令行。但是,当我将它放入我的 commands.cfg 文件中(首先使用宏 $USER1$$HOSTADDRESS$,虽然文字信息产生相同的结果),并检查 Nagios 的 Web 界面进行验证,它告诉我

Remote command execution failed: ssh_askpass: exec(/usr/bin/ssh-askpass): 
No such file or directory

我已确保已安装 ssh-askpass。什么给了?

【问题讨论】:

    标签: ssh nagios remote-execution


    【解决方案1】:

    由于某种原因,添加“-E”标志修复了它。根据check_by_ssh 手册页,这是忽略STDERR 标志。现在我得到了 check_raid 的输出。

    最终命令:

    $USER1$/check_by_ssh -i ~nagios/.ssh/id_dsa -H $HOSTADDRESS$ -t 60 -l -l root -o StrictHostKeyChecking=no -o ConnectTimeout=15 -o BatchMode=yes -o ServerAliveCountMax=3 -o ServerAliveInterval=10 -C "/usr/local/libexec/nagios/check_raid" -E

    【讨论】:

      【解决方案2】:

      您必须设置 ssh 密钥,以便“nagios”用户可以 ssh 到远程主机私钥上没有密码,否则它无法使用 check_by_ssh 运行检查。

      直到你可以运行(作为 nagios 用户)这样的东西......

      ssh [nagios@]remotehost.example.com /path/to/your/plugins/check_procs
      

      ...您没有正确设置密钥。

      【讨论】:

        【解决方案3】:

        我遇到了类似的问题 - 正在运行

        sudo -u nagios check_by_ssh .... 
        

        帮助 - 我对私钥的权限有误。但是 sudo 在这里是必不可少的 - 以 root 身份运行的工作,不一定以 nagios 的身份运行。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2019-04-13
          • 1970-01-01
          • 1970-01-01
          • 2012-08-17
          • 2016-10-18
          相关资源
          最近更新 更多