mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-05-28 04:35:40 -04:00
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/branches/release-1.3.0@865 f882894a-f735-0410-b71e-b25c423dba1c
This commit is contained in:
parent
7e6dc23d02
commit
d6bf5295be
1 changed files with 11 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue