cannot connect to install_driver(Oracle) failed

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
hanover23
Posts: 8
Joined: Tue Jan 09, 2018 2:01 pm

cannot connect to install_driver(Oracle) failed

Post by hanover23 »

Hello -

I'm running Nagios Core 4.3.4 and trying to get some Oracle database checks going on a Linux box.

I've seen a few other people run into a similar problem on these boards, but I can't quite seem to figure out what the missing piece here is. I am trying to use the check_oracle_health to connect to an Oracle database in tnsping mode. From the command line, I can get the following to return an OK status:

Code: Select all

/usr/lib64/nagios/plugins/custom/check_oracle_health --connect "name:port" --mode tnsping --
-user myuser --password mypass
However, from the Nagios web interface, I get the following:

Code: Select all

CRITICAL - cannot connect to <DB_NAME>. install_driver(Oracle) failed: Can't locate DBD/Oracle.pm in @INC (@INC contains: /usr/lib64/nagios/plugins/custom /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 13) 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.
at /usr/lib64/nagios/plugins/custom/check_oracle_health line 4754.
I installed the Oracle 12.2 instant client, SDK and SQLPLUS (RPM versions) and then used CPAN to install DBD::Oracle module. I set the ORACLE_HOME, LD_LIBRARY_PATH environmental variables before installing the module via CPAN. The CPAN process seemed to complete without issue. I see Oracle.pm in /root/perl5/lib/perl5/x86_64-linux-thread-multi/DBD/Oracle.pm.

This is outside the @INC locations mentioned in the failing Nagios web entry above but i can't figure out how to make Nagios aware of this additional location...or make my Oracle.pm appear in say /usr/share/perl5/vendor_perl.

I've seen the Nagios document for XI and installing Oracle checks, but I did those steps.

Any thoughts on what I'm missing? Thanks so much.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: cannot connect to install_driver(Oracle) failed

Post by mcapra »

Passing the lib paths as part of the actual command execution is recommended.

Though this documentation says "Nagios XI", the same plugin is referenced and has some configuration steps:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Former Nagios employee
https://www.mcapra.com/
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: cannot connect to install_driver(Oracle) failed

Post by dwhitfield »

Thanks @mcapra!

OP, let us know if you need any additional info.
hanover23
Posts: 8
Joined: Tue Jan 09, 2018 2:01 pm

Re: cannot connect to install_driver(Oracle) failed

Post by hanover23 »

I figured it out...ultimately it was a problem with the way I had configured CPAN.

During initial setup, CPAN gives you the choice of where CPAN will install the downloaded Perl modules: local lib (the default), sudo, or manual. I chose local lib and as a result, CPAN was created under my local user profile and Perl modules installed via CPAN were put in my local user profile....and apart from where Nagios could/would find DBD::Oracle. The module had installed just fine...but when I installed it as root user, the module was put in /root, because I had chosen local lib when I first setup CPAN itself.

I blew away my /root/.cpan directory to reconfigure CPAN. This time I selected sudo, which would put downloaded Perl modules into the system libraries for Perl. This got Oracle.pm to show up where I needed it to.../usr/lib64/perl.

I also used instmodsh to list out the perl modules my server thought were installed. This might be a quirk of RHEL7 at the time of this writing, but when I tried to install DBD::Oracle at the bash shell prompt, I got a failure when it got to the make test part of install. If I went into the cpan shell and then installed DBD::Oracle there, it worked and Nagios began acting like it could load Oracle.pm.

The last step to get fully functional was to add the /usr/bin/env ORACLE_HOME=/path/to/my/home LD_LIBRARY_PATH=/path/to/my/lib to the individual check in checkcommands.cfg .Then everything started working perfectly!

Thanks for the help.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: cannot connect to install_driver(Oracle) failed

Post by dwhitfield »

It sounds like this issue has been resolved. Is it okay if we lock this thread? Thanks for choosing the Nagios forums!
Locked