DBD:Oracle

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

DBD:Oracle

Postby marcielferreira » Tue Sep 05, 2017 1:41 pm

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?
marcielferreira
 
Posts: 3
Joined: Tue Sep 05, 2017 8:10 am

Re: DBD:Oracle

Postby scottwilkerson » Wed Sep 06, 2017 9:02 am

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/nagiosxi/docs/Installing-Oracle-Plugins-in-Nagios-XI.pdf
User avatar
scottwilkerson
CTO
 
Posts: 7536
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: DBD:Oracle

Postby marcielferreira » Mon Sep 11, 2017 6:56 am

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/nagiosxi/docs/Installing-Oracle-Plugins-in-Nagios-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.
marcielferreira
 
Posts: 3
Joined: Tue Sep 05, 2017 8:10 am

Re: DBD:Oracle

Postby scottwilkerson » Mon Sep 11, 2017 10:50 am

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
User avatar
scottwilkerson
CTO
 
Posts: 7536
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: DBD:Oracle

Postby marcielferreira » Mon Sep 11, 2017 1:11 pm

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
marcielferreira
 
Posts: 3
Joined: Tue Sep 05, 2017 8:10 am

Re: DBD:Oracle

Postby scottwilkerson » Mon Sep 11, 2017 4:26 pm

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
User avatar
scottwilkerson
CTO
 
Posts: 7536
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Core

Who is online

Users browsing this forum: alfre0000, Google [Bot], ishanloki and 18 guests