Check_oracle_health problem

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
junqian1992
Posts: 41
Joined: Wed Nov 15, 2017 4:57 am

Re: Check_oracle_health problem

Post by junqian1992 »

Hi scottwilkerson,
Yes, I already configure the command check_oracle_health since Inside the nrpe.cfg i set it:
# INCLUDE CONFIG DIRECTORY
# This directive allows you to include definitions from config files (with a
# .cfg extension) in one or more directories (with recursion).

#include_dir=<somedirectory>
include_dir=/usr/local/nagios/etc/nrpe

All then command we put it on the /usr/local/nagios/etc/nrpe/… in different file like :

common.cfg
command[check_load]=/usr/local/nagios/libexec/check_load $ARG1$
command[check_swap]=/usr/local/nagios/libexec/check_swap $ARG1$
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats.sh $ARG1$
command[check_mem]=/usr/local/nagios/libexec/custom_check_mem $ARG1$

oracle.cfg
command[check_oracle_health]=/usr/bin/perl /usr/local/nagios/libexec/check_oracle_health --environment PATH=$PATH:$ORACLE_HOME/bin --environment LD_LIBRARY_PATH=$ORACLE_HOME/lib --username=xxxxxxx --password="xxxxxxxxx" --connect=$ARG1$ --mode $ARG2$ $ARG3$
Regards,
JQ
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Check_oracle_health problem

Post by scottwilkerson »

I've never seen it configured like this. You are referencing $ORACLE_HOME when that has likely not been set, per the doc I referenced See page 3-4 of
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
and youneed to set it like this before the plugin is call

Code: Select all

/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib ORACLE_HOME=/usr/lib/oracle/11.2/client 
So you should have something like this (replacing your actual paths)

Code: Select all

command[check_oracle_health]=/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib ORACLE_HOME=/usr/lib/oracle/11.2/client/usr/bin/perl /usr/local/nagios/libexec/check_oracle_health --environment PATH=$PATH:$ORACLE_HOME/bin --environment LD_LIBRARY_PATH=$ORACLE_HOME/lib --username=xxxxxxx --password="xxxxxxxxx" --connect=$ARG1$ --mode $ARG2$ $ARG3$
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
junqian1992
Posts: 41
Joined: Wed Nov 15, 2017 4:57 am

Re: Check_oracle_health problem

Post by junqian1992 »

Hi scottwilkerson,
Sorry for the late reply, the configuration is compare with my other oracle server, since my other oracle server without any problem when running the check_oracle_health, but the configuration is not configured by me, is configured from onsite nagios support last time.


after i solve the below problem:

Code: Select all

Use of qw(...) as parentheses is deprecated at ./check_oracle_health line 4162.
Use of qw(...) as parentheses is deprecated at ./check_oracle_health line 6166.
Now the cehck_oracle_health is come out as below:

Code: Select all

[nagios@l28xxxxxracle01 libexec]$ ./check_oracle_health -t 60 --connect=xxxxx --username=xxxxx --password="xxxxxxx" --mode=tablespace-usage --tablespace=xxxxx_TBS
CRITICAL - connection could not be established within 60 seconds
I use the command as your provided still cannot:

Code: Select all

[nagios@l28xxxxxxracle01 libexec]$ /usr/bin/env LD_LIBRARY_PATH=/oracle/product/12.2.0.1/lib ORACLE_HOME=/oracle/product/12.2.0.1 /usr/local/nagios/libexec/check_oracle_health --environment PATH=$PATH:$ORACLE_HOME/bin --environment LD_LIBRARY_PATH=$ORACLE_HOME/lib --username=xxxxx --password="xxxxxx" --connect=xxxx --mode=tablespace-usage --tablespace=xxxxx_TBS
CRITICAL - connection could not be established within 60 seconds
this error seem like no successfully installed the DBD oracle, but i already re-install few times, i very confusing now. :? :?
Regards,
JQ
junqian1992
Posts: 41
Joined: Wed Nov 15, 2017 4:57 am

Re: Check_oracle_health problem

Post by junqian1992 »

Hi scottwilkerson,
Just now i re-install all the DBD and DBI on the server, now can run the command locally, but i still cannot get result from nagios XI

remote server run the command :

Code: Select all

[nagios@l28xxxxxxacle01 12.2.0.1]$ /usr/bin/perl /usr/local/nagios/libexec/check_oracle_health --environment PATH=$PATH:$ORACLE_HOME/bin --environment LD_LIBRARY_PATH=$ORACLE_HOME/lib --username=xxxxxx --password="xxxxxxx" --connect=xxxx --mode=tablespace-usage --tablespace=xxxxx_SIT
OK - tbs xxxx_SIT usage is 0.90% | 'tbs_xxxx_sit_usage_pct'=0.90%;90;98 'tbs_xxxx_sit_usage'=277MB;27648;30105;0;30720 'tbs_xxxxx_sit_alloc'=30720MB;;;0;30720
Nagios XI result as below:

Code: Select all

[nagios@Nagios.Huawei ~]$ /usr/local/nagios/libexec/check_nrpe -H xxxxxxxxxxx -t 30 -c check_oracle_health -a xxxx tablespace-usage "--tablespace xxxx_SIT"
CRITICAL - cannot connect to xxxxx. install_driver(Oracle) failed: Can&apos;t load &apos;/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so&apos; 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&apos;t installed where expected
at /usr/local/nagios/libexec/check_oracle_health line 4755.
Regards,
JQ
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Check_oracle_health problem

Post by scottwilkerson »

Please show me your command in the NRPE configuration. Did you take this post into consideration?
scottwilkerson wrote:I've never seen it configured like this. You are referencing $ORACLE_HOME when that has likely not been set, per the doc I referenced See page 3-4 of
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
and youneed to set it like this before the plugin is call

Code: Select all

/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib ORACLE_HOME=/usr/lib/oracle/11.2/client 
So you should have something like this (replacing your actual paths)

Code: Select all

command[check_oracle_health]=/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib ORACLE_HOME=/usr/lib/oracle/11.2/client/usr/bin/perl /usr/local/nagios/libexec/check_oracle_health --environment PATH=$PATH:$ORACLE_HOME/bin --environment LD_LIBRARY_PATH=$ORACLE_HOME/lib --username=xxxxxxx --password="xxxxxxxxx" --connect=$ARG1$ --mode $ARG2$ $ARG3$
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
junqian1992
Posts: 41
Joined: Wed Nov 15, 2017 4:57 am

Re: Check_oracle_health problem

Post by junqian1992 »

Hi,

nrpe.cfg (As your provided)

Code: Select all

command[check_oracle_health]=/usr/bin/env LD_LIBRARY_PATH=/oracle/product/12.2.0.1/lib ORACLE_HOME=/oracle/product/12.2.0.1 /usr/local/nagios/libexec/check_oracle_health --environment PATH=$PATH:$ORACLE_HOME/bin --environment LD_LIBRARY_PATH=$ORACLE_HOME/lib --username=xxxxx --password="xxxxxxx" --connect=$ARG1$ --mode $ARG2$ $ARG2$
Still unable to collect the result from Nagios XI.

Code: Select all

[nagios@Nagios.Huawei ~]$ /usr/local/nagios/libexec/check_nrpe -H xxxxxxx -t 30 -c check_oracle_health -a xxxxx tablespace-usage "--tablespace xxxxx_SIT"
CRITICAL - cannot connect to xxxxx. install_driver(Oracle) failed: Can&apos;t load &apos;/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so&apos; 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&apos;t installed where expected
at /usr/local/nagios/libexec/check_oracle_health line 4755.
================================================================================================================
My old command also can run it on remote server,

Code: Select all

[nagios@l28xxxxxxacle01 ~]$ /usr/bin/perl /usr/local/nagios/libexec/check_oracle_health --environment PATH=$PATH:$ORACLE_HOME/bin --environment LD_LIBRARY_PATH=$ORACLE_HOME/lib --username=xxxxxx --password="xxxxxxx" --connect=xxxx --mode=tablespace-usage --tablespace=xxxx_SIT
OK - tbs xxxx_SIT usage is 0.90% | 'tbs_xxxx_sit_usage_pct'=0.90%;90;98 'tbs_xxxx_sit_usage'=277MB;27648;30105;0;30720 'tbs_xxxx_sit_alloc'=30720MB;;;0;30720
i think this is not the command problem, is plugin problem.i still in checking.
Regards,
JQ
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Check_oracle_health problem

Post by scottwilkerson »

I am going to assume you restarted nrpe since making the change.

Lets try a different path if this works from the CLI as nagios

Code: Select all

/usr/bin/perl /usr/local/nagios/libexec/check_oracle_health --environment PATH=$PATH:$ORACLE_HOME/bin --environment LD_LIBRARY_PATH=$ORACLE_HOME/lib --username=xxxxxx --password="xxxxxxx" --connect=xxxx --mode=tablespace-usage --tablespace=xxxx_SIT
and this is your ORACLE_HOME
ORACLE_HOME=/oracle/product/12.2.0.1
Lets change the command to the following

Code: Select all

command[check_oracle_health]=/usr/bin/perl /usr/local/nagios/libexec/check_oracle_health --environment PATH=$PATH:/oracle/product/12.2.0.1/bin --environment LD_LIBRARY_PATH=/oracle/product/12.2.0.1/lib --username=xxxxx --password="xxxxxxx" --connect=$ARG1$ --mode $ARG2$ $ARG2$
then restart NRPE, at the point th eonly reason this shouldn't work would be if you had spaces or special chars that are getting replaced in the $ARGn$
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
junqian1992
Posts: 41
Joined: Wed Nov 15, 2017 4:57 am

Re: Check_oracle_health problem

Post by junqian1992 »

Hi scottwilkerson,
After i check the configuration on the nrpe.cfg and restart nrpe service, still get error but is different as below:

Code: Select all

[nagios@Nagios.Huawei ~]$ /usr/local/nagios/libexec/check_nrpe -H 1xxxxxxxx -t 30 -c check_oracle_health -a xxxx tablespace-usage "--tablespace UPAY_xxx"
CRITICAL - cannot connect to xxxx. ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc.
Regards,
JQ
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Check_oracle_health problem

Post by cdienger »

Is ORACLE_HOME set if you run:

echo $ORACLE_HOME

?

You man need to set it. $ORACLE_HOME would be root of the Oracle database directory.

https://docs.oracle.com/database/121/AD ... ADMQS12369
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
junqian1992
Posts: 41
Joined: Wed Nov 15, 2017 4:57 am

Re: Check_oracle_health problem

Post by junqian1992 »

Hi,
Sure, the environment i set on root and nagios user long time already.

Code: Select all

[root@l28xxxxxxxcle01 ~]# echo $ORACLE_HOME
/oracle/product/12.2.0.1
[root@l28xxxxxxxacle01 ~]# su - nagios
Last login: Mon Mar 19 16:50:23 +08 2018 on pts/0
[nagios@l28xxxxxxxacle01 ~]$
[nagios@l28xxxxxxxxacle01 ~]$
[nagios@l28xxxxxxxcle01 ~]$ echo $ORACLE_HOME
/oracle/product/12.2.0.1
Regards,
JQ
Locked