summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2004-04-08 11:05:11 (GMT)
committerTon Voon <tonvoon@users.sourceforge.net>2004-04-08 11:05:11 (GMT)
commit6a40337d8187296411de26d1b904d8c76c0cb20a (patch)
tree80a3851b415500e031c4435f6b3e15931b40f3ad
parentffa7482cb6de4e2ec2e8f99a832fc9a6425150b6 (diff)
downloadmonitoring-plugins-6a40337d8187296411de26d1b904d8c76c0cb20a.tar.gz
Cleaner calls to awk and support if Oracle has different national
language settings (Torsten Werner) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@866 f882894a-f735-0410-b71e-b25c423dba1c
-rwxr-xr-xplugins-scripts/check_oracle.sh19
1 files changed, 11 insertions, 8 deletions
diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh
index 8542555..41e9dce 100755
--- a/plugins-scripts/check_oracle.sh
+++ b/plugins-scripts/check_oracle.sh
@@ -192,6 +192,7 @@ case "$cmd" in
192 fi 192 fi
193 result=`sqlplus -s ${3}/${4}@${2} << EOF 193 result=`sqlplus -s ${3}/${4}@${2} << EOF
194set pagesize 0 194set pagesize 0
195set numf '9999999.99'
195select (1-(pr.value/(dbg.value+cg.value)))*100 196select (1-(pr.value/(dbg.value+cg.value)))*100
196from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg 197from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg
197where pr.name='physical reads' 198where pr.name='physical reads'
@@ -205,9 +206,10 @@ EOF`
205 exit $STATE_CRITICAL 206 exit $STATE_CRITICAL
206 fi 207 fi
207 208
208 buf_hr=`echo $result | awk '{print int($1)}'` 209 buf_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'`
209 result=`sqlplus -s ${3}/${4}@${2} << EOF 210 result=`sqlplus -s ${3}/${4}@${2} << EOF
210set pagesize 0 211set pagesize 0
212set numf '9999999.99'
211select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 213select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100
212from v\\$librarycache lc; 214from v\\$librarycache lc;
213EOF` 215EOF`
@@ -218,7 +220,7 @@ EOF`
218 exit $STATE_CRITICAL 220 exit $STATE_CRITICAL
219 fi 221 fi
220 222
221 lib_hr=`echo $result | awk '{print int($1)}'` 223 lib_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'`
222 224
223 if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then 225 if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then
224 echo "${2} CRITICAL - Cache Hit Rates: $lib_hr% Lib -- $buf_hr% Buff" 226 echo "${2} CRITICAL - Cache Hit Rates: $lib_hr% Lib -- $buf_hr% Buff"
@@ -239,6 +241,7 @@ EOF`
239 fi 241 fi
240 result=`sqlplus -s ${3}/${4}@${2} << EOF 242 result=`sqlplus -s ${3}/${4}@${2} << EOF
241set pagesize 0 243set pagesize 0
244set numf '9999999.99'
242select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc 245select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc
243from ( 246from (
244select tablespace_name,sum(bytes)/1024/1024 total 247select tablespace_name,sum(bytes)/1024/1024 total
@@ -254,18 +257,18 @@ EOF`
254 exit $STATE_CRITICAL 257 exit $STATE_CRITICAL
255 fi 258 fi
256 259
257 ts_free=`echo $result | awk '{print int($1)}'` 260 ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'`
258 ts_total=`echo $result | awk '{print int($2)}'` 261 ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'`
259 ts_pct=`echo $result | awk '{print int($3)}'` 262 ts_pct=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'`
260 if [ $ts_free -eq 0 -a $ts_total -eq 0 -a $ts_pct -eq 0 ] ; then 263 if [ "$ts_free" -eq 0 -a "$ts_total" -eq 0 -a "$ts_pct" -eq 0 ] ; then
261 echo "No data returned by Oracle - tablespace $5 not found?" 264 echo "No data returned by Oracle - tablespace $5 not found?"
262 exit $STATE_UNKNOWN 265 exit $STATE_UNKNOWN
263 fi 266 fi
264 if [ $ts_pct -ge ${6} ] ; then 267 if [ "$ts_pct" -ge ${6} ] ; then
265 echo "${2} : ${5} CRITICAL - $ts_pct% used [ $ts_free / $ts_total MB available ]" 268 echo "${2} : ${5} CRITICAL - $ts_pct% used [ $ts_free / $ts_total MB available ]"
266 exit $STATE_CRITICAL 269 exit $STATE_CRITICAL
267 fi 270 fi
268 if [ $ts_pct -ge ${7} ] ; then 271 if [ "$ts_pct" -ge ${7} ] ; then
269 echo "${2} : ${5} WARNING - $ts_pct% used [ $ts_free / $ts_total MB available ]" 272 echo "${2} : ${5} WARNING - $ts_pct% used [ $ts_free / $ts_total MB available ]"
270 exit $STATE_WARNING 273 exit $STATE_WARNING
271 fi 274 fi