首页 > 代码库 > 关于 NRPE: Unable to read output
关于 NRPE: Unable to read output
通过check_nrpe 来检测check_oracle_table
/usr/local/nagios/libexec/check_nrpe -H 10.10.10.10 -c check_oracle_table
报错 NRPE: Unable to read output
在本地直接执行/usr/local/nagios/libexec/check_oracle_table.py 输出结果正常
根据网上博客http://blog.chinaunix.net/uid-25266990-id-3431778.html
提示 修改 /etc/sudoers
添加一行
nagios ALL=(ALL) NOPASSWD:/usr/local/nagios/libexec/check_oracle_table.py
注释Defaults requiretty
然后在远端执行,依旧报错 NRPE: Unable to read output
根据上面博客提示 切换nagios 用户执行脚本
#usermod -s /bin/bash nagiosp
#su - nagios
-bash-4.1$ /usr/local/nagios/libexec/check_oracle_table.py
File "/usr/local/nagios/libexec/check_oracle_table.py", line 5, in <module>
import cx_Oracle,sys
ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or directory
将 root 用户的 .bash_profile 复制到 nagios 用户
再次执行
Traceback (most recent call last):
File "/usr/local/nagios/libexec/check_oracle_table.py", line 55, in <module>
conn = cx_Oracle.connect(‘test‘,‘test‘,dsn)
cx_Oracle.InterfaceError: Unable to acquire Oracle environment handle
检测发现没有给 .bash_profile 中ORACLE_HOME=/opt/oracle/product/10.2/db_1 赋权限,
我将 整个目录 赋权 755
再次执行,成功!
切换到远端
/usr/local/nagios/libexec/check_nrpe -H 10.10.10.10 -c check_oracle_table
显示正常。
本文出自 “翩若惊鸿” 博客,请务必保留此出处http://403606710.blog.51cto.com/4788570/1573046
关于 NRPE: Unable to read output