您好,登錄后才能下訂單哦!
錯誤提示
./check_oracle_health --connect orcl --mode connection-time
CRITICAL - cannot connect to orcl. install_driver(Oracle) failed: Can't locate DBD/Oracle.pm in @INC (@INC contains: . /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at (eval 18) line 3.
Perhaps the DBD::Oracle perl module hasn't been fully installed,
or perhaps the capitalisation of 'Oracle' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, Sponge, mysql.
at ./check_oracle_health line 5891
解決 install_driver oracle failed can't locate dbd/oracle.pm in @inc
兩種方法,這個可以用上面的方法下截
cpan[1]:install DBD::Oracle 可能不能直接安裝原因如下:
……
Running make install
Make had some problems, won't install
Could not read '/root/.cpan/build/DBD-Oracle-1.74-Zrp_Am/META.yml'. Falling back to other methods to determine prerequisites
Failed during this command:
PYTHIAN/DBD-Oracle-1.74.tar.gz : writemakefile NO '/usr/bin/perl Makefile.PL INSTALLDIRS=site' returned status 512
但是包已經下載下來了,可以查看下載記錄
正在保存至: “/root/.cpan/sources/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.74.tar.tmp27681”
可以以find查找可得 /root/.cpan/sources/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.74.tar.gz
然后移動當前目錄 :mv /root/.cpan/sources/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.74.tar.gz ../
tar xvzf DBD-Oracle-1.74.tar.gz 注意文件夾權限
cd 后make提示:make: *** 沒有指明目標并且找不到 makefile。 停止。
查詢后得之:要先編譯:這里用perl編譯:perl Makefile.PL [.PL是perl的可執行文件,可以ll查看,其它安裝方法可以查看解壓包里的INSTALL文件說明]
因為要與oracle的目錄相關 即環境變量要加載$ORACLE_HOME 可以echo得出
[root@localhost DBD-Oracle-1.74]# export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
[root@localhost DBD-Oracle-1.74]# echo $ORACLE_HOME
然后Make&&Make install
再su - oracle用戶下執行check_oracle_health命令查看結果
[oracle@localhost libexec]$ ./check_oracle_health --connect orcl --mode connection-time --user ****** --password ******
OK - 0.08 seconds to connect as YOUGOU_CC | connection_time=0.0832;1;5
表明已經成功!
如果報以下錯誤可以檢查一下相應的目錄文件
1、CRITICAL - cannot connect to orcl. install_driver(Oracle) failed: DBD::Oracle object version 1.20 does not match bootstrap parameter 1.74 at /usr/lib64/perl5/DynaLoader.pm line 239.
Compilation failed in require at (eval 18) line 3.
at ./check_oracle_health line 5891
可能是安裝的DBD::Oracle模塊的版本問題,看一下目錄/usr/local/nagios/DBD-Oracle-1.74/blib/arch/auto/DBD/Oracle/Oracle.so 文件與安裝的Oracle版本自帶的Oracle.so不一置,這個和程序的環境變量有關看你用那一個了,最好是一置,我的是DBD-Oracle.tar.gz故執行文件也得是這個1.74的Oracle.so
一定不要cp $ORACLE_HOME/perl/lib/site_perl/5.10.0/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so
# echo $ORACLE_HOME/lib >> /etc/ld.so.conf
# ldconfig
類似
ldconfig: 文件 /home/oracle/app/product/11.2.0/dbhome_1/lib/libnmefdms.so.0 為空,未檢查。
……
ldconfig: /home/oracle/app/product/11.2.0/dbhome_1/lib/libexpat.so.1 不是符號連接
再次執行命令一般都OK了……
OK - 0.29 seconds to connect as YOUGOU_CC | connection_time=0.2922;1;5
顯示成功;
-------------------
2、Time::HiRes object version 1.9726 does not match $Time::HiRes::XS_VERSION 1.9712 at /usr/lib64/perl5/DynaLoader.pm line 239.
Compilation failed in require at ./check_oracle_health line 4746.
BEGIN failed--compilation aborted at ./check_oracle_health line 4746.
類似這樣的報錯是因為HiRes.pm模塊版本問題,要么重裝要么拷一下之前perl -MCPAN -s shell 下載來的那個文件/root/.cpan/build/Time-HiRes-1.9726-euaQ_5/HiRes.pm覆蓋目錄 /usr/local/lib64/perl5/Time/下的解決之。
3、./check_oracle_health --connect orcl --mode tnsping
DynaLoader object version 1.10 does not match $DynaLoader::VERSION 1.08 at /usr/lib64/perl5/DynaLoader.pm line 93.
Compilation failed in require at /usr/local/lib64/perl5/Time/HiRes.pm line 7.
Compilation failed in require at ./check_oracle_health line 4746.
BEGIN failed--compilation aborted at ./check_oracle_health line 4746.
表示DynaLoader索引版本不一致需要1.10的版本,當前為1.08,下載相應版本解決,或者直接替換DynaLoader.pm解決。附文件 存放或者替換目錄/usr/lib64/perl5/DynaLoader.pm即可。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。