DBD:Oracle

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
marcielferreira
Posts: 3
Joined: Tue Sep 05, 2017 8:10 am

DBD:Oracle

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: DBD:Oracle

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
marcielferreira
Posts: 3
Joined: Tue Sep 05, 2017 8:10 am

Re: DBD:Oracle

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: DBD:Oracle

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
marcielferreira
Posts: 3
Joined: Tue Sep 05, 2017 8:10 am

Re: DBD:Oracle

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: DBD:Oracle

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked