check_oracle possible bug
Posted: Mon Apr 28, 2014 3:41 am
Hi everyone.
We have some strange result from "check_oracle --tablespace" checks.
Plugin return no error when using as argument a tablespace not existing:
[nagios]:/usr/lib/nagios/plugins$ ./check_oracle --tablespace SAP_SMD user xxxx PSAPSR3702 95 90
./check_oracle: line 269: [: : integer expression expected
./check_oracle: line 273: [: : integer expression expected
./check_oracle: line 277: [: : integer expression expected
SAP_SMD : PSAPSR3702 OK - % used [ / MB available ]|PSAPSR3702=%;90;95;0;100
[nagios]:/usr/lib/nagios/plugins$ echo $?
0
Debugging the query used in plugin, it seems that sqlplus command exit with no error, but result is "no rows selected".
So, a change to plugin as by following diff seems to resolve issue:
264a265,268
> if [ $(echo "$result" | grep -c "no rows selected" ) -ne 0 ]; then
> echo "No data returned by Oracle - tablespace $5 not found?"
> exit $STATE_UNKNOWN
> fi
Issue has been replicated with oracle 10g and oracle 11g rdbms.
We have some strange result from "check_oracle --tablespace" checks.
Plugin return no error when using as argument a tablespace not existing:
[nagios]:/usr/lib/nagios/plugins$ ./check_oracle --tablespace SAP_SMD user xxxx PSAPSR3702 95 90
./check_oracle: line 269: [: : integer expression expected
./check_oracle: line 273: [: : integer expression expected
./check_oracle: line 277: [: : integer expression expected
SAP_SMD : PSAPSR3702 OK - % used [ / MB available ]|PSAPSR3702=%;90;95;0;100
[nagios]:/usr/lib/nagios/plugins$ echo $?
0
Debugging the query used in plugin, it seems that sqlplus command exit with no error, but result is "no rows selected".
So, a change to plugin as by following diff seems to resolve issue:
264a265,268
> if [ $(echo "$result" | grep -c "no rows selected" ) -ne 0 ]; then
> echo "No data returned by Oracle - tablespace $5 not found?"
> exit $STATE_UNKNOWN
> fi
Issue has been replicated with oracle 10g and oracle 11g rdbms.