Page 2 of 2

Re: Problem with Check_Oracle_Health plugin

Posted: Tue Jun 10, 2014 9:35 am
by allanhillier
Here is a brief update on the issue I'm having with getting the check_oracle_health plugin to work:

I couldn't get the command to run as the nagios user so after lots of searching and reading in online forums I found a suggestion to ad the nagios user to group oinstall, once I did this I finally got the command below to run as the nagios user.

[nagios@tle-ora ~]$ /usr/local/nagios/libexec/check_oracle_health --connect TESTDB --user system --password oracle11 --mode tnsping
OK - connection established to TESTDB.

I figured I was now done with this issue but the web interface still gives the following error and I'm stumped:

CRITICAL - cannot connect to TESTDB. ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc.

I tried to do this through NRPE and here are the commands from my nrpe.cfg file

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
command[check_ping]=/usr/local/nagios/libexec/check_ping -H pc_dev1 -w 200,20% -c 300,30% -p 5
command[check_tnsping]=/usr/local/nagios/libexec/check_oracle_health --connect TESTDB --user system --password oracle11 --mode tnsping

When I run the command below i get the same error I get in the web interface.

[nagios@tle-ora ~]$ /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_tnsping
CRITICAL - cannot connect to TESTDB. ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc.

I wanted to try one of the other commands to make sure nrpe is functioning properly and the others work as expected.

[nagios@tle-ora ~]$ /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -c check_ping
PING OK - Packet loss = 0%, RTA = 0.19 ms|rta=0.186000ms;200.000000;300.000000;0.000000 pl=0%;20;30;0

I am totally at a loss as to why this command below works at the command line but not through nagios!

/usr/local/nagios/libexec/check_oracle_health --connect TESTDB --user system --password oracle11 --mode tnsping


Below are my environment variables.

[nagios@tle-ora ~]$ echo $ORACLE_HOME
/usr/app/oracle/oracle/product/10.2.0/db_1

[nagios@tle-ora ~]$ echo $ORACLE_BASE
/usr/app/oracle

[nagios@tle-ora ~]$ echo $LD_LIBRARY_PATH
/usr/app/oracle/oracle/product/10.2.0/db_1/lib

[nagios@tle-ora ~]$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/nagios/bin:/usr/app/oracle/oracle/product/10.2.0/db_1/bin

If anyone has a solution to this issue could you please let me know.

Thanks,
Allan

Re: Problem with Check_Oracle_Health plugin

Posted: Tue Jun 10, 2014 4:49 pm
by sreinhardt
nagios and nrpe do not generally provide the full environment variables to executed plugins. You probably need to include a --environment flag with your command. I would suggest trying it via cli first to make sure its right then adding to nrpe.cfg as you have! Try this one:

Code: Select all

/usr/local/nagios/libexec/check_oracle_health --connect TESTDB --user system --password oracle11 --environment ORACLE_HOME=/usr/app/oracle/oracle/product/10.2.0/db_1 --mode tnsping

Re: Problem with Check_Oracle_Health plugin

Posted: Wed Jun 11, 2014 8:11 am
by allanhillier
Thank you so much for the reply, this has worked for me.


Allan