( Nagios + check_oracle_health ), 命令行看得到, Firefox 看不到 !
本帖最后由 royleong 于 2011-09-06 17:42 编辑#########################################################################################################################################################
問題:
nagios:監控機
oracle16:被監控機
# sqlplus nagios/redhat@ABC
SQL*Plus: Release 11.2.0.2.0 Production on Tue Sep 6 17:23:25 2011
Copyright (c) 1982, 2010, Oracle.All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL>show parameter stream;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
streams_pool_size big integer 0
SQL> <===== 證明可連的
$ /usr/local/nagios/libexec/check_oracle_health --connect ABC --username nagios --password redhat --mode sga-data-buffer-hit-ratio
OK - SGA data buffer hit ratio 100.00% | sga_data_buffer_hit_ratio=100.00%;98:;95:
# /usr/local/nagios/libexec/check_oracle_health --connect ABC --username nagios --password redhat --mode sga-data-buffer-hit-ratio
OK - SGA data buffer hit ratio 100.00% | sga_data_buffer_hit_ratio=100.00%;98:;95:
命令都能查到訊息, 在 Firefox 上看不到
sga-data-buffer-hit-ratio
CRITICAL 09-06-2011 16:21:04 0d 0h 6m 38s 3/3 CRITICAL - cannot connect to ABC. ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc.
# vim /usr/local/nagios/etc/objects/10.0.0.16.cfg
define service{
use generic-service
host_name oracle16
service_description check_oracle_sga-data-buffer-hit-ratio
check_command check_oracle_health!ABC!nagios!redhat!sga-data-buffer-hit-ratio
} # ^ 把它們的 "check_nrpe!" 去掉
# service nagios reload
$ /usr/local/nagios/libexec/check_oracle_health --connect ABC --username nagios --password redhat --mode sga-data-buffer-hit-ratio
OK - SGA data buffer hit ratio 100.00% | sga_data_buffer_hit_ratio=100.00%;98:;95:
# /usr/local/nagios/libexec/check_oracle_health --connect ABC --username nagios --password redhat --mode sga-data-buffer-hit-ratio
OK - SGA data buffer hit ratio 100.00% | sga_data_buffer_hit_ratio=100.00%;98:;95:
命令都能查到訊息, 在 Firefox 上看不到
sga-data-buffer-hit-ratio
CRITICAL 09-06-2011 17:13:28 0d 0h 10m 24s 3/3 CRITICAL - cannot connect to ABC. ORA-12154: TNS:could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach)
當 "10.0.0.16.cfg" 把它的 "check_nrpe!" 去掉, Firefox 的訊息都變了, 一樣看不到訊息
請各方朋友指教
謝謝
#########################################################################################################################################################
之前論壇的某人 http://bbs.chinaunix.net/viewthread.php?tid=1930654 也有類似情況, 但好像也没解!, 小弟差這步就能監控Oracle了, 請各位指教一下
感恩 本帖最后由 royleong 于 2011-09-07 09:45 编辑
以下我為nagios加了oracle要的變量了,,還是不能執行
# more /root/.bash_profile
.........................................
export ORACLE_HOME=/root/Desktop/instantclient_11_2
export LD_LIBRARY_PATH=/root/Desktop/instantclient_11_2/lib
export TNS_ADMIN=$ORACLE_HOME
#/usr/local/nagios/libexec/check_oracle_health --connect ABC --username nagios --password redhat --mode sga-data-buffer-hit-ratio
CRITICAL - SGA data buffer hit ratio 93.71% | sga_data_buffer_hit_ratio=93.71%;98:;95:
========================================================================
以下為 nagios 用戶
# cp -R /root/Desktop/instantclient_11_2/ /home/nagios/ <===== 我只把能在 root 裡執行的 ORACLE_HOME 目錄 COPY到NAGIOS上
# chown nagios:nagios /home/nagios/instantclient_11_2/ -R <===== 我只把能在 root 裡執行的 ORACLE_HOME 目錄 COPY到NAGIOS上
.........................................
export ORACLE_HOME=/home/nagios/instantclient_11_2/ <=====
export LD_LIBRARY_PATH=/home/nagios/instantclient_11_2/lib <=====
export TNS_ADMIN=$ORACLE_HOME <===== 我只把能在 root 裡執行的 ORACLE_HOME 目錄 COPY到NAGIOS上
$ source .bash_profile
$ echo $ORACLE_HOME
/home/nagios/instantclient_11_2/
$ echo $LD_LIBRARY_PATH
/home/nagios/instantclient_11_2/lib
$ sqlplus nagios/redhat@MPEMC
SQL*Plus: Release 11.2.0.2.0 Production on Wed Sep 7 09:29:52 2011
Copyright (c) 1982, 2010, Oracle.All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> show parameter stream; <===== 都能看
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
streams_pool_size big integer 0
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
$ /usr/local/nagios/libexec/check_oracle_health --connect ABC --username nagios --password redhat --mode sga-data-buffer-hit-ratio
CRITICAL - statefilesdir /var/tmp/check_oracle_health does not exist or is not writable
$ ll /usr/local/nagios/libexec/check_oracle_health
-rwxr-xr-x 1 nagios nagios 2192769月6 16:51 /usr/local/nagios/libexec/check_oracle_health
怎麼 root 用戶能執行, nagios 用戶不能能執行 解決了上面, 現在命令行 nagios 能看了, 但Firefox 還是不能看
# chown nagios:nagios /var/tmp/check_oracle_health/ -R
# /usr/local/nagios/libexec/check_oracle_health --connect ABC --username nagios --password redhat --mode sga-data-buffer-hit-ratio
OK - SGA data buffer hit ratio 100.00% | sga_data_buffer_hit_ratio=100.00%;98:;95:
$ /usr/local/nagios/libexec/check_oracle_health --connect ABC --username nagios --password redhat --mode sga-data-buffer-hit-ratio
OK - SGA data buffer hit ratio 100.00% | sga_data_buffer_hit_ratio=100.00%;98:;95:
命令都能看了, 但Firefox還是不能看
sga-data-buffer-hit-ratio
CRITICAL 09-07-2011 09:52:27 0d 0h 1m 48s 1/3 CRITICAL - cannot connect to ABC. ORA-12154: TNS:could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach) 我在 Nagios Server 上是没有建 oracle 用戶的, 只有 root, nagios 而已 以下都是被監控端上執行的
# /usr/local/nagios/libexec/check_oracle_health --connect ABC --username nagios --password redhat --mode sga-data-buffer-hit-ratio
OK - SGA data buffer hit ratio 100.00% | sga_data_buffer_hit_ratio=100.00%;98:;95:
# su - oracle
$ /usr/local/nagios/libexec/check_oracle_health --connect ABC --username nagios --password redhat --mode sga-data-buffer-hit-ratio
OK - SGA data buffer hit ratio 100.00% | sga_data_buffer_hit_ratio=100.00%;98:;95:
# sql
sqlite3 sqlldr sqlldrO sqlplus sqlplusO
# su - nagios
$ sqlite3 <===== 而 nagios 是没有 sqlplus 命令, 難度原因在這?
$ /usr/local/nagios/libexec/check_oracle_health --connect ABC --username nagios --password redhat --mode sga-data-buffer-hit-ratio
CRITICAL - cannot connect to ABC. install_driver(Oracle) failed: Can't load '/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.10.1: cannot open shared object file: No such file or directory at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DynaLoader.pm line 230.
at (eval 13) line 3
Compilation failed in require at (eval 13) line 3.
Perhaps a required shared library or dll isn't installed where expected
at /usr/local/nagios/libexec/check_oracle_health line 4710
nagios它執行不了, 所以它在Firefox 上顯示不了 ???? 怎麼都好像我自問自答的,,,,有人幫下忙嗎? 當我把
# vim /usr/local/nagios/etc/objects/10.0.0.16.cfg
define service{
use generic-service
host_name oracle16
service_description check_oracle_sga-data-buffer-hit-ratio
check_command check_nrpe!check_oracle_health!ABC!nagios!redhat!sga-data-buffer-hit-ratio
} # ^ 把它們的 "check_nrpe!" 加回去
firefox 又會顯示
check_oracle_connected-users
CRITICAL 09-07-2011 10:15:04 0d 0h 0m 6s 1/3 CRITICAL - cannot connect to MPEXT. ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc.
那個要不要加上check_nrpe! 呢 ??? 都沒人會嗎?
:em29::em29::em29:
http://permalink.gmane.org/gmane.network.nagios.plugins.devel/6375
外國有人跟我情況一樣,但好像也沒怎樣解決方法
:em29::em29::em29: 老哥你可真有意思,一个人能盖这么高的楼。
从6楼看CRITICAL - cannot connect to ABC. install_driver(Oracle) failed: Can't load '/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.10.1: cannot open shared object file: No such file or directory at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DynaLoader.pm line 230.
at (eval 13) line 3
ll /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so 看这个文件在否,如果不在,重新安装DBD-Oracle,如果在,往下看
在root下执行check_oracle_health是正常的,但切换到nagios下就不正常了。说明环境变量还是有问的。
你可以把Oracle的相关环境变量加到check_oracle_health脚本头部,这个脚本是perl写的,设置环境变量时要按照perl的语法。
页:
[1]
2