Page 1 of 1

check_oracle_health

Posted: Thu Aug 02, 2018 9:19 am
by mcarpe
Hi I am building a new centos 7 server. I have installed Nagios core 4.4.1 and ran through the varios DBD::Oracle DBI installs via cpan etc.
I am abe to get check_oracle_health to work at a command line via the nagios user; however, when ran through Nagios it errors.

Code: Select all

check_oracle_health -t 30 --connect ORADB1 --user myuser --password mypass --mode connection-time --warning 15 --critical 25
OK - 0.38 seconds to connect as myuser | connection_time=0.3807;15;25
Via nagios core though, It errors with

Code: Select all

CRITICAL - cannot connect to ORADB1. install_driver(Oracle) failed: Can't locate loadable object for module DBD::Oracle 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.
This seems like it's a common topic when searching around the net and the forum here but I am not making any headway on what the issue is. It feels like it's just a en enviroment path issue when envoked via noninteractive shell or something. Has anyone elese experienced a similar issue with this and willing to help point me in the right direction?

instantclient base, sqlplus, sdk was installed.
I have this set in my /etc/profile.d/sh.loal,

cat /etc/profile.d/sh.local

Code: Select all

#Add any required envvar overrides to this file, it is sourced from /etc/profile
export LD_LIBRARY_PATH=/opt/oracle/instantclient_18_3
export ORACLE_HOME=/opt/oracle/instantclient_18_3
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=/opt/oracle/instantclient_18_3:$PATH

Re: check_oracle_health

Posted: Thu Aug 02, 2018 10:01 am
by scottwilkerson
you need to change your commands in core to include the paths like this

Code: Select all

/usr/bin/env LD_LIBRARY_PATH=/opt/oracle/instantclient_18_3 ORACLE_HOME=/opt/oracle/instantclient_18_3 $USER1$/check_oracle_health $ARG1$

Re: check_oracle_health

Posted: Thu Aug 02, 2018 12:53 pm
by mcarpe
thank you for the feedback. envoking the command in this way solved my issue. Appreciate your time.

Re: check_oracle_health

Posted: Thu Aug 02, 2018 4:21 pm
by scottwilkerson
mcarpe wrote:thank you for the feedback. envoking the command in this way solved my issue. Appreciate your time.
Great!

Locking