diff options
| author | Ton Voon <tonvoon@users.sourceforge.net> | 2003-07-02 16:21:46 +0000 |
|---|---|---|
| committer | Ton Voon <tonvoon@users.sourceforge.net> | 2003-07-02 16:21:46 +0000 |
| commit | 6aaca0f135d87c0593b78d9c9b7c0cff1bec3be9 (patch) | |
| tree | bfd2258295cc5b6e45f631d9dc728a791839ca6c | |
| parent | 620a792dc0eb6cbe095de0bf5b4c588849e21cd9 (diff) | |
| download | monitoring-plugins-6aaca0f135d87c0593b78d9c9b7c0cff1bec3be9.tar.gz | |
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
| -rwxr-xr-x | plugins-scripts/check_oracle.sh | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh index 3064db90..6bdafcf5 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 \ | |||
| 210 | from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg \ | 210 | from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg \ |
| 211 | where pr.name = 'physical reads' \ | 211 | where pr.name = 'physical reads' \ |
| 212 | and dbg.name='db block gets' \ | 212 | and dbg.name='db block gets' \ |
| 213 | and cg.name='consistent gets'; ` | 213 | and cg.name='consistent gets'; |
| 214 | EOF` | ||
| 215 | |||
| 216 | if [ -n "`echo $result | grep ORA-`" ] ; then | ||
| 217 | error=` echo "$result" | grep "ORA-" | head -1` | ||
| 218 | echo "CRITICAL - $error" | ||
| 219 | exit $STATE_CRITICAL | ||
| 220 | fi | ||
| 214 | 221 | ||
| 215 | buf_hr=`echo $result | awk '{print int($1)}'` | 222 | buf_hr=`echo $result | awk '{print int($1)}'` |
| 216 | result=`sqlplus -s ${2}/${3}@${4} << EOF | 223 | result=`sqlplus -s ${2}/${3}@${4} << EOF |
| 217 | set pagesize 0 | 224 | set pagesize 0 |
| 218 | 225 | ||
| 219 | select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 \ | 226 | select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 \ |
| 220 | from v\\$librarycache lc ; ` | 227 | from v\\$librarycache lc; |
| 228 | EOF` | ||
| 221 | 229 | ||
| 230 | if [ -n "`echo $result | grep ORA-`" ] ; then | ||
| 231 | error=` echo "$result" | grep "ORA-" | head -1` | ||
| 232 | echo "CRITICAL - $error" | ||
| 233 | exit $STATE_CRITICAL | ||
| 234 | fi | ||
| 235 | |||
| 222 | lib_hr=`echo $result | awk '{print int($1)}'` | 236 | lib_hr=`echo $result | awk '{print int($1)}'` |
| 223 | 237 | ||
| 224 | if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then | 238 | if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then |
| @@ -247,7 +261,14 @@ select tablespace_name,sum(bytes)/1024/1024 total \ | |||
| 247 | from dba_data_files group by tablespace_name) A, \ | 261 | from dba_data_files group by tablespace_name) A, \ |
| 248 | ( select tablespace_name,sum(bytes)/1024/1024 free \ | 262 | ( select tablespace_name,sum(bytes)/1024/1024 free \ |
| 249 | from dba_Free_space group by tablespace_name) B \ | 263 | from dba_Free_space group by tablespace_name) B \ |
| 250 | where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}'; ` | 264 | where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}'; |
| 265 | EOF` | ||
| 266 | |||
| 267 | if [ -n "`echo $result | grep ORA-`" ] ; then | ||
| 268 | error=` echo "$result" | grep "ORA-" | head -1` | ||
| 269 | echo "CRITICAL - $error" | ||
| 270 | exit $STATE_CRITICAL | ||
| 271 | fi | ||
| 251 | 272 | ||
| 252 | ts_free=`echo $result | awk '{print int($1)}'` | 273 | ts_free=`echo $result | awk '{print int($1)}'` |
| 253 | ts_total=`echo $result | awk '{print int($2)}'` | 274 | ts_total=`echo $result | awk '{print int($2)}'` |
