nrpe执行命令报错NRPE:Unabletoreadoutput

在客户端编写的一个脚本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;


分享名称:nrpe执行命令报错NRPE:Unabletoreadoutput
URL地址:http://bzwzjz.com/article/pspjpj.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 网站制作 网站建设 重庆网站建设 四川成都网站制作 成都网站制作 网站制作 专业网站建设 成都网站制作 成都网站建设 成都网站建设 定制网站制作 成都网站建设 高端品牌网站建设 成都网站建设公司 移动网站建设 阿坝网站设计 成都模版网站建设 企业网站制作 盐亭网站设计 企业手机网站建设 网站建设方案 成都企业网站建设