diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2004-04-08 10:50:39 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2004-04-08 10:50:39 +0000 |
commit | d6bf5295be08ca3c227d097b45d22f8736b22bec (patch) | |
tree | 0768c04a8fec9efe0fe9edf88f9934e491537765 | |
parent | 7e6dc23d028297de5f00704c293e641f99030026 (diff) | |
download | monitoring-plugins-d6bf5295be08ca3c227d097b45d22f8736b22bec.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/branches/release-1.3.0@865 f882894a-f735-0410-b71e-b25c423dba1c
-rwxr-xr-x | plugins-scripts/check_oracle.sh | 18 |
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 | ||
209 | select (1-(pr.value/(dbg.value+cg.value)))*100 \ | 210 | select (1-(pr.value/(dbg.value+cg.value)))*100 \ |
210 | from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg \ | 211 | from 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 | ||
226 | select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 \ | 228 | select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 \ |
227 | from v\\$librarycache lc; | 229 | from 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 | ||
258 | select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc \ | 261 | select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc \ |
259 | from ( \ | 262 | from ( \ |
@@ -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 |