From 6aaca0f135d87c0593b78d9c9b7c0cff1bec3be9 Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Wed, 2 Jul 2003 16:21:46 +0000 Subject: Check for ORA- errors for tablespace and cache (patch 755456 - Sven Meyer) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/branches/release-1.3.0@581 f882894a-f735-0410-b71e-b25c423dba1c diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh index 3064db9..6bdafcf 100755 --- a/plugins-scripts/check_oracle.sh +++ b/plugins-scripts/check_oracle.sh @@ -210,15 +210,29 @@ select (1-(pr.value/(dbg.value+cg.value)))*100 \ from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg \ where pr.name = 'physical reads' \ and dbg.name='db block gets' \ - and cg.name='consistent gets'; ` + and cg.name='consistent gets'; +EOF` + + if [ -n "`echo $result | grep ORA-`" ] ; then + error=` echo "$result" | grep "ORA-" | head -1` + echo "CRITICAL - $error" + exit $STATE_CRITICAL + fi buf_hr=`echo $result | awk '{print int($1)}'` result=`sqlplus -s ${2}/${3}@${4} << EOF set pagesize 0 select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 \ -from v\\$librarycache lc ; ` +from v\\$librarycache lc; +EOF` + if [ -n "`echo $result | grep ORA-`" ] ; then + error=` echo "$result" | grep "ORA-" | head -1` + echo "CRITICAL - $error" + exit $STATE_CRITICAL + fi + lib_hr=`echo $result | awk '{print int($1)}'` if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then @@ -247,7 +261,14 @@ select tablespace_name,sum(bytes)/1024/1024 total \ from dba_data_files group by tablespace_name) A, \ ( select tablespace_name,sum(bytes)/1024/1024 free \ from dba_Free_space group by tablespace_name) B \ -where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}'; ` +where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}'; +EOF` + + if [ -n "`echo $result | grep ORA-`" ] ; then + error=` echo "$result" | grep "ORA-" | head -1` + echo "CRITICAL - $error" + exit $STATE_CRITICAL + fi ts_free=`echo $result | awk '{print int($1)}'` ts_total=`echo $result | awk '{print int($2)}'` -- cgit v0.10-9-g596f