check_oracle_health not working for Linux env

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Amit_Alone
Posts: 89
Joined: Fri May 08, 2020 11:47 am

Re: check_oracle_health not working for Linux env

Post by Amit_Alone »

As requested, I have attach the requested file and also please refer the o/p of the shared cmd.

Code: Select all

[root@avgdlnxvp126 ~]# ls -laR /usr/lib/oracle > /tmp/oracle
[root@avgdlnxvp126 ~]# echo $ORACLE_HOME

[root@avgdlnxvp126 ~]# echo $LD_LIBRARY_PATH

[root@avgdlnxvp126 ~]# uname -a
Linux avgdlnxvp126.avantgard.corp 3.10.0-693.11.6.el7.x86_64 #1 SMP Thu Dec 28 14:23:39 EST 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@avgdlnxvp126 ~]# cat /etc/*release
NAME="Red Hat Enterprise Linux Server"
VERSION="7.4 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.4"
PRETTY_NAME="Red Hat Enterprise Linux"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.4: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.4
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.4"
Red Hat Enterprise Linux Server release 7.4 (Maipo)
Red Hat Enterprise Linux Server release 7.4 (Maipo)
[root@avgdlnxvp126 ~]#
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_oracle_health not working for Linux env

Post by lmiltchev »

The files that you have under /usr/lib/oracle are the same as the ones I have, so I don't see any issues here. However, you are running a 64-bit system, and the paths that you are using in the /usr/local/nagiosxi/etc/configwizards/oracle/oracle file are for a 32 bit architecture...

Change this:

Code: Select all

export ORACLE_HOME=/usr/lib/oracle/12.2/client
export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client/lib
to this:

Code: Select all

export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib
export ORACLE_HOME=/usr/lib/oracle/12.2/client64
Next. let's try to install the DBD::Oracle module via cpan one more time. Run the following commands:

Code: Select all

export ORACLE_HOME=/usr/lib/oracle/12.2/client64
export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib
cpan -i DBD::Oracle
If you were not able to install the DBD:Oracle perl module by following the above instructions, you could try:

Code: Select all

cd /tmp
wget http://www.cpan.org/modules/by-module/DBD/DBD-Oracle-1.74.tar.gz
tar zxvf DBD-Oracle-1.74.tar.gz
cd DBD-Oracle-1.74
perl Makefile.PL -l
make && make test
make install
Be sure to check out our Knowledgebase for helpful articles and solutions!
Amit_Alone
Posts: 89
Joined: Fri May 08, 2020 11:47 am

Re: check_oracle_health not working for Linux env

Post by Amit_Alone »

As suggested, I have made the changes in the oracle file. After that I tried to install the DBD:Oracle perl module and this time I received new error.
Then as suggested I tried perl Makefile.PL -l cmd and observed the same below error.

Code: Select all

[root@avgdlnxvp126 DBD-Oracle-1.74]# perl Makefile.PL -l
Using DBI 1.627 (for perl 5.016003 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/vendor_perl/auto/DBI/

Configuring DBD::Oracle for perl 5.016003 on linux (x86_64-linux-thread-multi)

Remember to actually *READ* the README file! Especially if you have any problems.

  The ORACLE_HOME environment variable value (/usr/lib/oracle/12.2/client64) is not valid.
  It must be set to hold the path to an Oracle installation directory
  on this machine (or a machine with a compatible architecture).
  For an Instant Client install, the directory should include an sdk subdirectory.
  See the appropriate README file for your OS for more information.
  ABORTED!
[root@avgdlnxvp126 DBD-Oracle-1.74]#
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_oracle_health not working for Linux env

Post by lmiltchev »

Try to reinstall the Oracle client and plugins, using our official documentation:

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

If this doesn't solve your issue, open a ticket via our Support Center here:

https://support.nagios.com/tickets/

We may need to schedule a remote session to further troubleshoot this issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_oracle_health not working for Linux env

Post by tgriep »

There was an error on the previous post. You have Oracle Instant Client version 12.1 installed but the commands used 12.2 which caused the environment error.
Run the following to install the DBD::Oracle perl module.

Code: Select all

export ORACLE_HOME=/usr/lib/oracle/12.1/client64
export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
cpan -i DBD::Oracle
Also, you will have to login to the Core Config Manager > Commands menu and verify the paths are correct for The Oracle Commmands.
And, edit the following file on the Nagios server and update the paths as well.

Code: Select all

/usr/local/nagiosxi/etc/configwizards/oracle/oracle
Sorry about that.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_oracle_health not working for Linux env

Post by lmiltchev »

@Amit_Alone, I am sorry for the "12.2" typo! My bad. :oops:

Thanks @tgriep!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Amit_Alone
Posts: 89
Joined: Fri May 08, 2020 11:47 am

Re: check_oracle_health not working for Linux env

Post by Amit_Alone »

Thanks @tgriep

I followed the shared steps and this time cpan -i DBD::Oracle was got installed successfully. However, after running the plugin I observed new error.

Code: Select all

[root@avgdlnxvp126 libexec]# ./check_oracle_health --connect '10.183.XX.XXX:1525/PAAXXX' --username 'nagios' --password 'XXXXXXXXXXX' --mode tablespace-usage --warning 90 --critical 98 -t 120
UNKNOWN - check_oracle_health timed out after 120 seconds
Is it possible to schedule a remote session and get it sort out.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_oracle_health not working for Linux env

Post by tgriep »

Glad the module is installed now.

One thing, when you run the plugin from the command line, you need to specify the environment that the plugin needs.
The following is an example of how you need to run the plugin. I added the -v to the command to get the verbose output when it runs so you can see what sort of errors are generated.

Code: Select all

/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib ORACLE_HOME=/usr/lib/oracle/12.1/client64 /usr/local/nagios/libexec/check_oracle_health --connect '10.183.XX.XXX:1525/PAAXXX' --username 'nagios' --password 'XXXXXXXXXXX' --mode tablespace-usage --warning 90 --critical 98 -t 120 -v
Couple of things, make sure that port 1525 is open and that the nagios server can access it.

Also, you may need to add an entry to the following file that describes how to connect to your Oracle server. If it does not exist, create it.

Code: Select all

/usr/lib/oracle/12.1/client64/network/admin/tnsnames.ora 
An example entry is as follows. Adjust the settings for the PAAXXX and the 10.183.XX.XXX option to valid data.

Code: Select all

PAAXXX =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.183.XX.XXX)(PORT = 1525))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PAAXXX)
    )
  )
Try running the plugin again to see if it work.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Amit_Alone
Posts: 89
Joined: Fri May 08, 2020 11:47 am

Re: check_oracle_health not working for Linux env

Post by Amit_Alone »

Thanks I followed the steps but still I can see the same starting error.

Code: Select all

[root@avgdlnxvp126 network]# telnet 10.183.XX.XXX 1525
Trying 10.183.XX.XXX...
Connected to 10.183.XX.XXX.
Escape character is '^]'.
^Z^CConnection closed by foreign host.
[root@avgdlnxvp126 network]# cat /usr/lib/oracle/12.1/client64/network/admin/tnsnames.ora
PAAXXX =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.183.XX.XXX)(PORT = 1525))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PAAXXX)
    )
  )
[root@avgdlnxvp126 network]#
[root@avgdlnxvp126 network]# /usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib ORACLE_HOME=/usr/lib/oracle/12.1/client64
XDG_SESSION_ID=298560
HOSTNAME=avgdlnxvp126.avantgard.corp
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
SSH_CLIENT=10.110.15.87 53184 22
SSH_TTY=/dev/pts/0
USER=root
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:
MAIL=/var/spool/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
PWD=/usr/lib/oracle/12.1/client64/network
LANG=en_GB.UTF-8
HISTCONTROL=ignoredups
SHLVL=1
HOME=/root
LOGNAME=root
XDG_DATA_DIRS=/root/.local/share/flatpak/exports/share/:/var/lib/flatpak/exports/share/:/usr/local/share/:/usr/share/
SSH_CONNECTION=10.110.15.87 53184 10.110.143.26 22
LESSOPEN=||/usr/bin/lesspipe.sh %s
XDG_RUNTIME_DIR=/run/user/0
_=/usr/bin/env
OLDPWD=/usr/lib/oracle/12.1/client64
LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
ORACLE_HOME=/usr/lib/oracle/12.1/client64
[root@avgdlnxvp126 network]#
[root@avgdlnxvp126 network]#
[root@avgdlnxvp126 network]# /usr/local/nagios/libexec/check_oracle_health --connect '10.183.XX.XXX:1525/PAAXXX' --username 'nagios' --password 'XXXXXXXX' --mode tablespace-usage --warning 90 --critical 98 -t 120 -v
CRITICAL - cannot connect to 10.183.XX.XXX:1525/PAAXXX. install_driver(Oracle) failed: Can't load '/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.12.1: cannot open shared object file: No such file or directory at /usr/lib64/perl5/DynaLoader.pm line 190.
 at (eval 13) line 3.
Compilation failed in require at (eval 13) line 3.
Perhaps a required shared library or dll isn't installed where expected
 at /usr/local/nagios/libexec/check_oracle_health line 6155.

Tue Jun 30 15:11:10 2020: disconnecting DBD without handle
[root@avgdlnxvp126 network]#
Is it possible to schedule the remote session
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: check_oracle_health not working for Linux env

Post by tgriep »

OK, I see what happened. You mistakenly thought this was 2 separate commands but they are not, you need to run all of this as one command.

Code: Select all

/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib ORACLE_HOME=/usr/lib/oracle/12.1/client64 /usr/local/nagios/libexec/check_oracle_health --connect '10.183.XX.XXX:1525/PAAXXX' --username 'nagios' --password 'XXXXXXXXXXX' --mode tablespace-usage --warning 90 --critical 98 -t 120 -v
Just copy the data in the code block (Click on the Select All link) and paste it in the shell to see it run.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked