Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oracle::plugin - Cannot connect: (no error string) - Work on shell with centreon-engine #2483

Closed
DelphTom opened this issue Jan 6, 2021 · 11 comments
Labels

Comments

@DelphTom
Copy link

DelphTom commented Jan 6, 2021

Hello everyone,

I'm looking for a solution to my problem since several days. I thought i found the solution ine the issue #1787 but it didn't solve my problem.

When I'm checking an oracle DB in centreon web I still have this error:
UNKNOWN: Cannot connect: (no error string)

When i'm trying in shell, directly in the /usr/lib/centreon/plugins directory with the command:
./centreon_plugins.pl --plugin=database::oracle::plugin --mode=tnsping --hostname=xxx.xx.x.x --sid=XX

It works with root user and centreon-engine too (it didn't before i applied the solution about DBD::Oracle in the 1787 issue.

The configuration in centreon web is:
$CENTREONPLUGINS$/centreon_plugins.pl --plugin=database::oracle::plugin --mode=tnsping --hostname=%HOSTADDRESS% --sid=$_SERVICESID$

I moved the content of centreon-plugins directly in /centreon/plugins that's why i'm using $CENTREONPLUGINS$ in path.
I don't have any idea now... I've read a lot a documentation and threads without sucess.

Thanks for your help!

@garnier-quentin
Copy link
Contributor

I think perl DBD Oracle is installed in root directory i think.

@DelphTom
Copy link
Author

DelphTom commented Jan 7, 2021

I think perl DBD Oracle is installed in root directory i think.

Thanks. I already followed your advices in the 1787 issue and it allowed me to use the plugin in shell with centreon-engine but still not working in centreon web interface.

I've commented PERL variables in .bashrc, checked in printenv, downloaded DBD::Oracle, unzip, then:

perl Makefile.PL
make install

Should I uncomment and modify the PERL variables next to this installation? I had those:

#PATH="/root/perl5/bin${PATH:+:${PATH}}"; export PATH;
#PERL5LIB="/root/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
#PERL_LOCAL_LIB_ROOT="/root/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
#PERL_MB_OPT="--install_base \"/root/perl5\""; export PERL_MB_OPT;
#PERL_MM_OPT="INSTALL_BASE=/root/perl5"; export PERL_MM_OPT;

I can't find /perl5/lib anywhere else than in /root... I think I missed something.

Thanks again.

@garnier-quentin
Copy link
Contributor

That's the issue. I think there is a problem with your oracle db install.

@DelphTom
Copy link
Author

DelphTom commented Jan 7, 2021

That's the issue. I think there is a problem with your oracle db install.

Maybe yes. I installed Oracle Client 19 with the package I download directly on oracle website, I left the default path which is /home/oracle/... My variables about oracle home, ld library are well defines.
I had no choice to give the rights to centreon-engine on /home/oracle/ to get the plugin working in shell with this user.

Can you tell me if "oracle instantclient" we can found in .rpm is enough to use centreon oracle plugin? I've downloaded and installed the oracle client manually because it was mentionned in the documentation I used for my installation.

@garnier-quentin
Copy link
Contributor

you can use rpm instantclient. But you need to compile DBD::Oracle Perl

@DelphTom
Copy link
Author

DelphTom commented Jan 8, 2021

I was a bit lost yesterday with all my tries, so let's make a summary of my current situation and what i'm doing, it's quite short:

  • Define variables in root&centreon-engine .bash_profile and source it:
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export TNS_ADMIN=/usr/lib/oracle/11.2/client64/network/admin
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
  • Yum install those packages:
    oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
    oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
    oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm
    oracle-instantclient11.2-tools-11.2.0.4.0-1.x86_64.rpm

  • Copy the sdk folder from instantclient-sdk-linux.x64-11.2.0.4.0.zip in /usr/lib/oracle/11.2/client64

  • Creating /network/admin folder and put inside my sqlnet.ora and TNSNAMES.ora

  • Downloading the DBD::Oracle and compiling like that:
    wget http://www.cpan.org/modules/by-module/DBD/DBD-Oracle-1.80.tar.gz
    tar xzf DBD-Oracle-1.80.tar.gz
    perl Makefile.PL
    make install

  • At this point I can see in the logs of make install that it's using my Oracle path:
    gcc -c -I/usr/lib/oracle/11.2/client64/sdk/include -I/usr/lib64/perl5/vendor_perl/auto/DBI -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -DVERSION=\"1.80\" -DXS_VERSION=\"1.80\" -fPIC "-I/usr/lib64/perl5/CORE" -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION=\"11.2.0.4\" -DORA_OCI_102 -DORA_OCI_112 Oracle.c

  • If I try with centreon-engine user in shell, the plugin is working:
    [root@server DBD-Oracle-1.80]# su centreon-engine
    bash-4.2$ cd /usr/lib/centreon/plugins/centreon-plugins/
    bash-4.2$ ./centreon_plugins.pl --plugin=database::oracle::plugin --mode=tnsping --hostname=172.23.9.27 --sid=XE
    OK: Connection established to listener 'XE'. |

  • In centreon web is still not working: UNKNOWN: Cannot connect: (no error string)

I hope someone can help with those informations!

@garnier-quentin
Copy link
Contributor

Where is installed DBD/Oracle ? (use locate command)
Could you look the environment of your centreon-engine user also ? because it should be different (less variable with centengine process).

@DelphTom
Copy link
Author

DelphTom commented Jan 8, 2021

Where is installed DBD/Oracle ? (use locate command)
Could you look the environment of your centreon-engine user also ? because it should be different (less variable with centengine process).

Thanks Quentin.

I used find command on Oracle.pm and i got this:
/usr/local/lib64/perl5/DBD/Oracle.pm

My env on centreon-engine user:

[root@server /]# su centreon-engine
bash-4.2$ printenv
XDG_SESSION_ID=39
HOSTNAME=server
SHELL=/bin/bash
TERM=xterm
HISTSIZE=1000
SSH_CLIENT=ip 60002 22
QTDIR=/usr/lib64/qt-3.3
QTINC=/usr/lib64/qt-3.3/include
SSH_TTY=/dev/pts/2
QT_GRAPHICSSYSTEM_CHECKED=1
USER=centreon-engine
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:
LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
MAIL=/var/spool/mail/root
TNS_ADMIN=/usr/lib/oracle/11.2/client64/network/admin
_=/usr/bin/printenv
PWD=/
LANG=fr_FR.UTF-8
HISTCONTROL=ignoredups
HOME=/var/lib/centreon-engine
SHLVL=2
LOGNAME=centreon-engine
QTLIB=/usr/lib64/qt-3.3/lib
SSH_CONNECTION=ip
LESSOPEN=||/usr/bin/lesspipe.sh %s
XDG_RUNTIME_DIR=/run/user/0
ORACLE_HOME=/usr/lib/oracle/11.2/client64

@garnier-quentin
Copy link
Contributor

It comes from the LD_LIBRARY_PATH. You need to create file /etc/ld.so.conf.d/oracle.conf with:

/usr/lib/oracle/11.2/client64/lib

And execute /sbin/ldconfig

@DelphTom
Copy link
Author

DelphTom commented Jan 8, 2021

It comes from the LD_LIBRARY_PATH. You need to create file /etc/ld.so.conf.d/oracle.conf with:

/usr/lib/oracle/11.2/client64/lib

And execute /sbin/ldconfig

Perfect! It works! Thanks a lot for your support!

| OK | 6m 12s ago | 6m 12s ago | 2m 12s ago | 1/5 (H) | OK: All tablespaces are OK Tablespace 'sysaux' Tot

@DelphTom DelphTom closed this as completed Jan 8, 2021
@garnier-quentin
Copy link
Contributor

Thanks for the feedback. You're welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants