Page 1 of 1

Can't locate DBD/Oracle.pm in @INC...

Posted: Fri Nov 27, 2015 9:07 am
by giant69
Hi,

On a EL7 I installed an offline version of nagiosxi 5.2.0 - so far so good.
I also installed the check_oracle_health plugin with the neccessary oracle-instantclient-basic, -sqlplus, and devel-... rpms
and did some tests as root:
Proper environment with
$ORACLE_HOME=/usr/lib/oracle/12.1/client64/
$PATH=$PATH:$ORACLE_HOME/bin
$LD_LIBRARY_PATH=$ORACLE_HOME/lib
/usr/local/nagios/libexec/check_oracle_health --connect '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=1657))(CONNECT_DATA=(SID=lab01)))' --user monitor --password egal --mode tnsping

with the following output:
Use of qw(...) as parentheses is deprecated at /usr/local/nagios/libexec/check_oracle_health line 4162.
Use of qw(...) as parentheses is deprecated at /usr/local/nagios/libexec/check_oracle_health line 6166.
OK - connection established to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=1657))(CONNECT_DATA=(SID=lab01))).

When I tried this as user nagios, I got the following in return:
Use of qw(...) as parentheses is deprecated at /usr/local/nagios/libexec/check_oracle_health line 4162.
Use of qw(...) as parentheses is deprecated at /usr/local/nagios/libexec/check_oracle_health line 6166.
CRITICAL - cannot connect to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=1657))(CONNECT_DATA=(SID=lab01))). 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 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, mysql.
at /usr/local/nagios/libexec/check_oracle_health line 4755.

Needless to say: I set the same environment variables as I do as root.

When I doublechecked the PERL installation of DBD::Oracle I got

Reading '/root/.cpan/Metadata'
Database was generated on Fri, 27 Nov 2015 06:17:02 GMT
DBD::Oracle is up to date (1.74).


Second: If I tried to configure an Oracle plugin with the wizzard, I can enter the data (host, port, login cred., tablespacename) to check a tablespace, but after applying and a long, long time waiting, I only got the error "Reset Config Permissions Failed". I checked this forum and several sources on the internet, but I did not found a "build-perms-bin" scripts inside my xi-latest or offline packages.

So any help or a link, where I can check my permissions or howto check, what's wrong with the perl module would be nice...

Re: Can't locate DBD/Oracle.pm in @INC...

Posted: Sun Nov 29, 2015 10:46 pm
by Box293
The check_oracle_health plugin has some painstaking steps, which are outlined here:

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

Especially when you execute the plugin at the command line as the "nagios" user (not root) you will need to the entire command with the variables, example:

Code: Select all

/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib ORACLE_HOME=/usr/lib/oracle/11.2/client /usr/local/nagios/libexec/check_oracle_health --connect '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=1657))(CONNECT_DATA=(SID=lab01)))' --user monitor --password egal --mode tnsping
This plugin is not for the faint hearted :lol:

Re: Can't locate DBD/Oracle.pm in @INC...

Posted: Mon Nov 30, 2015 4:03 am
by giant69
Ah, I see - I missed to explain, that I did not see any check_xi_oracle* commands in the list of the "Core Config Manager / Commands".
What can I do? Where can I get further information about what's going wrong, when the installation of the plugin went normal and ended "ok"?

It is also very strange, that the Config File Permissions Check shows up with errors, which are in fact not true:

One or more config files have problems.
Config Scripts
The permissions on the Nagios XI configuration scripts appear to be okay.

Config Files

The following configuration files have incorrect permissions:
•/usr/local/nagios/etc/commands.cfg (OWNER=root, GROUP=root, PERMS=-rw-rw-r--)
•/usr/local/nagios/etc/contactgroups.cfg (OWNER=root, GROUP=root, PERMS=-rw-rw-r--)
•/usr/local/nagios/etc/contacts.cfg (OWNER=root, GROUP=root, PERMS=-rw-rw-r--)
•/usr/local/nagios/etc/contacttemplates.cfg (OWNER=root, GROUP=root, PERMS=-rw-rw-r--)
•/usr/local/nagios/etc/hostdependencies.cfg (OWNER=root, GROUP=root, PERMS=-rw-rw-r--)
•/usr/local/nagios/etc/hostescalations.cfg (OWNER=root, GROUP=root, PERMS=-rw-rw-r--)
•/usr/local/nagios/etc/hostextinfo.cfg (OWNER=root, GROUP=root, PERMS=-rw-rw-r--)
•/usr/local/nagios/etc/hostgroups.cfg (OWNER=root, GROUP=root, PERMS=-rw-rw-r--)
•/usr/local/nagios/etc/hosttemplates.cfg (OWNER=root, GROUP=root, PERMS=-rw-rw-r--)
•/usr/local/nagios/etc/servicedependencies.cfg (OWNER=root, GROUP=root, PERMS=-rw-rw-r--)
•/usr/local/nagios/etc/serviceescalations.cfg (OWNER=root, GROUP=root, PERMS=-rw-rw-r--)
•/usr/local/nagios/etc/serviceextinfo.cfg (OWNER=root, GROUP=root, PERMS=-rw-rw-r--)
•/usr/local/nagios/etc/servicegroups.cfg (OWNER=root, GROUP=root, PERMS=-rw-rw-r--)
•/usr/local/nagios/etc/servicetemplates.cfg (OWNER=root, GROUP=root, PERMS=-rw-rw-r--)
•/usr/local/nagios/etc/timeperiods.cfg (OWNER=root, GROUP=root, PERMS=-rw-rw-r--)

Each of these config files needs to be writable by the apache and nagios users. To fix this problem, follow these steps:
•Login to your Nagios XI server via SSH as the root user
•Execute the following commands:◦/usr/local/nagiosxi/scripts/reset_config_perms.sh


If I look into this directory, the files are correct set:

[root@lab01 etc]# ls -ltr /usr/local/nagios/etc/
total 140
-rw-rw-r--. 1 apache nagios 210 Oct 13 23:01 resource.cfg
-rw-rw-r--. 1 apache nagios 744 Oct 13 23:01 cgi.cfg
-rw-rw-r--. 1 apache nagios 7988 Oct 13 23:04 nrpe.cfg
-rw-rw-r--. 1 apache nagios 1627 Oct 13 23:04 send_nsca.cfg
-rw-rw-r--. 1 apache nagios 5345 Oct 13 23:04 nsca.cfg
drwxrwxr-x. 2 apache nagios 65 Oct 13 23:11 static
drwxrwxr-x. 4 apache nagios 4096 Nov 26 08:31 pnp
-rw-rw-r--. 1 apache nagios 2229 Nov 26 08:31 ndo2db.cfg
-rw-rw-r--. 1 apache nagios 4827 Nov 26 08:31 ndomod.cfg
drwxrwxr-x. 2 apache nagios 26 Nov 26 08:31 hosts
drwxrwxr-x. 2 apache nagios 26 Nov 26 08:31 services
-rw-rw-r--. 1 apache nagios 967 Nov 26 08:31 hostgroups.cfg
-rw-rw-r--. 1 apache nagios 813 Nov 26 08:31 servicegroups.cfg
-rw-rw-r--. 1 apache nagios 6278 Nov 26 08:31 hosttemplates.cfg
-rw-rw-r--. 1 apache nagios 10164 Nov 26 08:31 servicetemplates.cfg
-rw-rw-r--. 1 apache nagios 3541 Nov 26 08:31 timeperiods.cfg
-rw-rw-r--. 1 apache nagios 1367 Nov 26 08:31 contacts.cfg
-rw-rw-r--. 1 apache nagios 1106 Nov 26 08:31 contactgroups.cfg
-rw-rw-r--. 1 apache nagios 1675 Nov 26 08:31 contacttemplates.cfg
-rw-rw-r--. 1 apache nagios 823 Nov 26 08:31 servicedependencies.cfg
-rw-rw-r--. 1 apache nagios 817 Nov 26 08:31 hostdependencies.cfg
-rw-rw-r--. 1 apache nagios 825 Nov 26 08:31 serviceescalations.cfg
-rw-rw-r--. 1 apache nagios 843 Nov 26 08:31 serviceextinfo.cfg
-rw-rw-r--. 1 apache nagios 819 Nov 26 08:31 hostescalations.cfg
-rw-rw-r--. 1 apache nagios 837 Nov 26 08:31 hostextinfo.cfg
drwxrwxr-x. 2 apache nagios 6 Nov 27 14:19 import
-rw-rw-r--. 1 apache nagios 5671 Nov 30 13:36 nagios.cfg
-rw-rw-r--. 1 apache nagios 16581 Nov 30 15:59 commands.cfg


I have no idea, what is going wrong here...

Re: Can't locate DBD/Oracle.pm in @INC...

Posted: Mon Nov 30, 2015 11:26 am
by hsmith
What are the outputs of the following commands?

Code: Select all

getenforce
cat /etc/*release*
uname -a
I want to see if I can replicate the permission issue.

Re: Can't locate DBD/Oracle.pm in @INC...

Posted: Tue Dec 01, 2015 1:35 am
by giant69
getenforce
Enforcing

cat /etc/*release*
NAME="Red Hat Enterprise Linux Server"
VERSION="7.1 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="7.1"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.1 (Maipo)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.1:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.1
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.1"
Red Hat Enterprise Linux Server release 7.1 (Maipo)
Red Hat Enterprise Linux Server release 7.1 (Maipo)
cpe:/o:redhat:enterprise_linux:7.1:ga:server

uname -a
Linux lab01 3.10.0-229.11.1.el7.x86_64 #1 SMP Wed Jul 22 12:06:11 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

Re: Can't locate DBD/Oracle.pm in @INC...

Posted: Tue Dec 01, 2015 10:25 am
by hsmith
What happens if we do a setenforce 0 command and then try?

Re: Can't locate DBD/Oracle.pm in @INC...

Posted: Wed Dec 02, 2015 2:35 am
by giant69
This helps me to fix this access problem!
This SELinux slipped my mind. Thank you for your support! :)