温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

nrpe 执行命令报错NRPE: Unable to read output

发布时间:2020-08-01 06:45:12 来源:网络 阅读:824 作者:xiao987334176 栏目:移动开发

在客户端编写的一个脚本check_ssh_auto.sh


#!/bin/bash


a=`/bin/cat /etc/ssh/sshd_config | grep PasswordAuthentication | grep -v "^#" | awk '{print $2}'`

if [ "$a" = "yes" ]; then

    echo "SSH authentication: WARNING Please amend the warning SSH authentication for key authentication;"

    $(exit 1)

  else

    echo "SSH authentication: OK;"

    $(exit 0)

  fi


客户端执行正常


nagios服务器测试执行

/usr/local/nagios/libexec/check_nrpe -H 192.168.10.1 -c ssh_auth

提示NRPE: Unable to read output


解决方法

在客户端修改文件

vi /etc/sudoers


注视这行

#Defaults    requiretty

在root    ALL=(ALL)       ALL下面添加一行

nagios ALL=(ALL) NOPASSWD:/usr/local/nagios/libexec/*


修改nrpe配置文件/usr/local/nagios/etc/nrpe.cfg


command[ssh_auth]=/usr/bin/sudo /usr/local/nagios/libexec/check_ssh_auth.sh


重启nrpe


服务器端再次测试

SSH authentication: OK;

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI