nrpe被监控端运行定义命令正常,监控端运行

       #/usr/local/nagios/libexec/check_nrpe -H 117.121.9.200 -c check_oracle_tablespace

错误提示: NRPE: Unable to read output

监控端运行:#/usr/local/nagios/libexec/check_nrpe -H 117.121.9.200

可以返回nrpe版本信息,说明nrpe通信正常。

被监控端 check_oracle_tablespace 的定义: /usr/local/nagios/etc/nrpe.cfg

        command[check_oracle_tablespace]=/usr/bin/sudo /usr/local/nagios/libexec/check_tablespace.sh

脚本路径没有错,同时拥有执行权限。经过认真排查,应该编辑  /etc/sudoers文件

       #vim  /etc/sudoers

             nagios ALL=(ALL) NOPASSWD:/usr/local/nagios/libexec/check_tablespace.sh

同时得注释掉一下行,表示不需要控制终端

            #Defaults    requiretty

否则,仍然会出现:NRPE: Unable to read output 错误