首页 > 其他 > 详细

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

时间:2016-04-19 20:19:53      阅读:762      评论:0      收藏:0      [点我收藏+]

在客户端编写的一个脚本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:/kuaibao/server/nagios/libexec/*


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


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


重启nrpe


服务器端再次测试

SSH authentication: OK;

本文出自 “陨落星空” 博客,请务必保留此出处http://xiao987334176.blog.51cto.com/2202382/1765397

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

原文:http://xiao987334176.blog.51cto.com/2202382/1765397

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!