Page 1 of 1

Oracle Select not working

Posted: Mon Jul 09, 2018 8:38 am
by nagiosEngie
Hello Nagios Crew,
I am facing a problem in implementing a oracle check on a specific select.

The command is:
/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib ORACLE_HOME=/usr/lib/oracle/12.2/client64 /usr/local/nagios/libexec/check_oracle_health --connect '10.211.145.33:1521/SBX' --username 'userxx' --password 'passxx' --mode sql --name="SELECT INSTANCE_NAME, STATUS, DATABASE_STATUS FROM V\$INSTANCE "
UNKNOWN - got no valid response for SELECT INSTANCE_NAME, STATUS, DATABASE_STATUS FROM V$INSTANCE

To check that I implemented all parts correctly I tested:
/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib ORACLE_HOME=/usr/lib/oracle/12.2/client64 /usr/local/nagios/libexec/check_oracle_health --connect '10.211.145.33:1521/SBX' --username 'userxx' --password 'passxx' --mode sql --name="select count(*) from v\$session"
CRITICAL - select count(*) from v$session: 40 | 'select'=40;1;5
Which works for what I can see.

Can you please help?

Thanks
Sandro

Re: Oracle Select not working

Posted: Mon Jul 09, 2018 3:28 pm
by tgriep
One thing to check is to see if the user account has sufficient rights to V$INSTANCE for it to run the select.

Also, what version of the plugin are you running?
To check that, run the check with the -V option and it will show you the version.

If you are not running the latest plugin, you can go to the following link to download the latest one.
https://labs.consol.de/nagios/check_oracle_health/

Re: Oracle Select not working

Posted: Tue Jul 10, 2018 7:23 am
by nagiosEngie
Hello tgriep,
I think I found the reason it was not working.
The command expects as an output a number, the select I am trying will give a string as a reply.
So I had to add the count (*) instruction which will count the number of times a certain string appears.

The new command is:

/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib ORACLE_HOME=/usr/lib/oracle/12.2/client64 /usr/local/nagios/libexec/check_oracle_health --connect 'XXXHOSTXXX:1521/XXINSTANCE' --username 'userxx' --password 'passxx' --mode sql --name="select count(*) from v\$INSTANCE where status = 'OPEN'"

Case closed.
Thanks
Sandro

Re: Oracle Select not working

Posted: Tue Jul 10, 2018 9:59 am
by tmcdonald
Great to hear! Did you have further (related) questions or are we good to lock this up?

Re: Oracle Select not working

Posted: Tue Jul 10, 2018 10:17 am
by nagiosEngie
Lock it up.
thanks

Sandro