diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh index 6bdafcf5..f0ae33bb 100755 --- a/plugins-scripts/check_oracle.sh +++ b/plugins-scripts/check_oracle.sh @@ -205,6 +205,7 @@ case "$cmd" in fi result=`sqlplus -s ${2}/${3}@${4} << EOF set pagesize 0 + set numf '9999999.99' select (1-(pr.value/(dbg.value+cg.value)))*100 \ from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg \ @@ -219,9 +220,10 @@ EOF` exit $STATE_CRITICAL fi - buf_hr=`echo $result | awk '{print int($1)}'` + buf_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` result=`sqlplus -s ${2}/${3}@${4} << EOF set pagesize 0 + set numf '9999999.99' select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 \ from v\\$librarycache lc; @@ -233,7 +235,7 @@ EOF` exit $STATE_CRITICAL fi - lib_hr=`echo $result | awk '{print int($1)}'` + lib_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then echo "${3} : ${4} CRITICAL - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff" @@ -254,6 +256,7 @@ EOF` fi result=`sqlplus -s ${2}/${3}@${4} << EOF set pagesize 0 + set numf '9999999.99' select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc \ from ( \ @@ -270,14 +273,15 @@ EOF` exit $STATE_CRITICAL fi - ts_free=`echo $result | awk '{print int($1)}'` - ts_total=`echo $result | awk '{print int($2)}'` - ts_pct=`echo $result | awk '{print int($3)}'` - if [ $ts_pct -ge ${6} ] ; then + ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'` + ts_total=`echo "$result" | awk '/^[0-9\.\t ]+$/ {print int($2)}'` + ts_pct=`echo "$result" | awk '/^[0-9\.\t ]+$/ {print int($3)}'` + + if [ "$ts_pct" -ge ${6} ] ; then echo "${4} : ${5} CRITICAL - $ts_pct% used [ $ts_free / $ts_total MB available ]" exit $STATE_CRITICAL fi - if [ $ts_pct -ge ${7} ] ; then + if [ "$ts_pct" -ge ${7} ] ; then echo "${4} : ${5} WARNING - $ts_pct% used [ $ts_free / $ts_total MB available ]" exit $STATE_WARNING fi