Page 1 of 1

DBD:Oracle

Posted: Tue Sep 05, 2017 1:41 pm
by marcielferreira
Hi, my server is CentOS Linux release 7.3.1611 (Core) and i have NagiosĀ® Coreā„¢ 4.2.0. I have install the plugin check_oracle_health with no problem.
I am execute the command with the both users (root and nagios), and works:

[root@srvmonitor libexec]# /usr/local/nagios/libexec/check_oracle_health --connect=ORCLDSV --username=nagios --password=oradbmon --mode=tnsping
OK - connection established to ORCLDSV.
[nagios@srvmonitor ~]$ /usr/local/nagios/libexec/check_oracle_health --connect=ORCLDSV --username=nagios --password=oradbmon --mode=tnsping
OK - connection established to ORCLDSV.

But, monitor web show me:

CRITICAL - cannot connect to ORCLDSV. install_driver(Oracle) failed: Can't locate DBD/Oracle.pm in @INC (@INC contains: /usr/local/nagios/libexec /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 14) line 3.

Maybe, the user nagios, not load variables to connect Oracle. The commands for execute as nagios from root:

[root@srvmonitor libexec]# sudo -S -u nagios -i /bin/bash -c '/usr/local/nagios/libexec/check_oracle_health --connect=ORCLDSV --username=nagios --password=oradbmon --mode=tnsping'
OK - connection established to ORCLDSV.

[root@srvmonitor libexec]# sudo -S -u nagios /bin/bash -c '/usr/local/nagios/libexec/check_oracle_health --connect=ORCLDSV --username=nagios --password=oradbmon --mode=tnsping'
CRITICAL - cannot connect to ORCLDSV. install_driver(Oracle) failed: Can't locate DBD/Oracle.pm in @INC (@INC contains: /usr/local/nagios/libexec /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 14) 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 /usr/local/nagios/libexec/check_oracle_health line 6155.

See the parameter -i, send me variables, but without, no. I export the variables into all locations, bash_profile, bashrc, profile, etc. Not work. Anybody tell me what are wrong?

Re: DBD:Oracle

Posted: Wed Sep 06, 2017 9:02 am
by scottwilkerson
The document I am going to send is for Nagios XI, but page 6 outlines your scenario and how to remedy it

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Re: DBD:Oracle

Posted: Mon Sep 11, 2017 6:56 am
by marcielferreira
scottwilkerson wrote:The document I am going to send is for Nagios XI, but page 6 outlines your scenario and how to remedy it

https://assets.nagios.com/downloads/nag ... ios-XI.pdf
It's work with user nagios, but the web application, the error continue. So, i don't any idea how to resolve this problem, because user nagios can execute the command without no erro.

[nagios@srvmonitor ~]$ /usr/local/nagios/libexec/check_oracle_health --connect=ORCLDSV --username=nagios --password=oradbmon --mode=tnsping
OK - connection established to ORCLDSV.

Re: DBD:Oracle

Posted: Mon Sep 11, 2017 10:50 am
by scottwilkerson
When nagios executes the check it does not have the full nagios users environment, which if you look at page 4 of the document I send you you will see the commands are prefixed with some required env settings like so:

Code: Select all

/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib ORACLE_HOME=/usr/lib/oracle/11.2/client $USER1$/check_oracle_health $ARG1$
Of course you would need to change the Oracle path to match yours.

If this doesn't work for some reason can you post both your command configuration as well as your service configuration from nagios for this check.

Thanks

Re: DBD:Oracle

Posted: Mon Sep 11, 2017 1:11 pm
by marcielferreira
scottwilkerson wrote:When nagios executes the check it does not have the full nagios users environment, which if you look at page 4 of the document I send you you will see the commands are prefixed with some required env settings like so:

Code: Select all

/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib ORACLE_HOME=/usr/lib/oracle/11.2/client $USER1$/check_oracle_health $ARG1$
Of course you would need to change the Oracle path to match yours.

If this doesn't work for some reason can you post both your command configuration as well as your service configuration from nagios for this check.

Thanks
Thanks for your help! For me, the command works with (LD_LIBRARY_PATH, ORACLE_HOME, TNS_ADMIN and PERL5LIB):

Code: Select all

/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib ORACLE_HOME=/usr/lib/oracle/12.2/client64 TNS_ADMIN=/usr/lib/oracle/12.2/client64/admin/network PERL5LIB=/home/nagios/perl5/lib/perl5 /usr/local/nagios/libexec/check_oracle_health --connect=ORCLDSV --username=nagios --password=oradbmon --mode=tnsping

Re: DBD:Oracle

Posted: Mon Sep 11, 2017 4:26 pm
by scottwilkerson
marcielferreira wrote:Thanks for your help! For me, the command works with (LD_LIBRARY_PATH, ORACLE_HOME, TNS_ADMIN and PERL5LIB):
Excellent! Glad to be of assistance