summaryrefslogtreecommitdiffstats
path: root/plugins-scripts/check_oracle.sh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-scripts/check_oracle.sh')
-rwxr-xr-xplugins-scripts/check_oracle.sh18
1 files changed, 11 insertions, 7 deletions
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
205 fi 205 fi
206 result=`sqlplus -s ${2}/${3}@${4} << EOF 206 result=`sqlplus -s ${2}/${3}@${4} << EOF
207 set pagesize 0 207 set pagesize 0
208 set numf '9999999.99'
208 209
209select (1-(pr.value/(dbg.value+cg.value)))*100 \ 210select (1-(pr.value/(dbg.value+cg.value)))*100 \
210from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg \ 211from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg \
@@ -219,9 +220,10 @@ EOF`
219 exit $STATE_CRITICAL 220 exit $STATE_CRITICAL
220 fi 221 fi
221 222
222 buf_hr=`echo $result | awk '{print int($1)}'` 223 buf_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'`
223 result=`sqlplus -s ${2}/${3}@${4} << EOF 224 result=`sqlplus -s ${2}/${3}@${4} << EOF
224 set pagesize 0 225 set pagesize 0
226 set numf '9999999.99'
225 227
226select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 \ 228select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 \
227from v\\$librarycache lc; 229from v\\$librarycache lc;
@@ -233,7 +235,7 @@ EOF`
233 exit $STATE_CRITICAL 235 exit $STATE_CRITICAL
234 fi 236 fi
235 237
236 lib_hr=`echo $result | awk '{print int($1)}'` 238 lib_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'`
237 239
238 if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then 240 if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then
239 echo "${3} : ${4} CRITICAL - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff" 241 echo "${3} : ${4} CRITICAL - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff"
@@ -254,6 +256,7 @@ EOF`
254 fi 256 fi
255 result=`sqlplus -s ${2}/${3}@${4} << EOF 257 result=`sqlplus -s ${2}/${3}@${4} << EOF
256 set pagesize 0 258 set pagesize 0
259 set numf '9999999.99'
257 260
258select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc \ 261select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc \
259from ( \ 262from ( \
@@ -270,14 +273,15 @@ EOF`
270 exit $STATE_CRITICAL 273 exit $STATE_CRITICAL
271 fi 274 fi
272 275
273 ts_free=`echo $result | awk '{print int($1)}'` 276 ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'`
274 ts_total=`echo $result | awk '{print int($2)}'` 277 ts_total=`echo "$result" | awk '/^[0-9\.\t ]+$/ {print int($2)}'`
275 ts_pct=`echo $result | awk '{print int($3)}'` 278 ts_pct=`echo "$result" | awk '/^[0-9\.\t ]+$/ {print int($3)}'`
276 if [ $ts_pct -ge ${6} ] ; then 279
280 if [ "$ts_pct" -ge ${6} ] ; then
277 echo "${4} : ${5} CRITICAL - $ts_pct% used [ $ts_free / $ts_total MB available ]" 281 echo "${4} : ${5} CRITICAL - $ts_pct% used [ $ts_free / $ts_total MB available ]"
278 exit $STATE_CRITICAL 282 exit $STATE_CRITICAL
279 fi 283 fi
280 if [ $ts_pct -ge ${7} ] ; then 284 if [ "$ts_pct" -ge ${7} ] ; then
281 echo "${4} : ${5} WARNING - $ts_pct% used [ $ts_free / $ts_total MB available ]" 285 echo "${4} : ${5} WARNING - $ts_pct% used [ $ts_free / $ts_total MB available ]"
282 exit $STATE_WARNING 286 exit $STATE_WARNING
283 fi 287 fi