summaryrefslogtreecommitdiffstats
path: root/web/attachments/40985-check_oracle.patch
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/40985-check_oracle.patch')
-rw-r--r--web/attachments/40985-check_oracle.patch104
1 files changed, 104 insertions, 0 deletions
diff --git a/web/attachments/40985-check_oracle.patch b/web/attachments/40985-check_oracle.patch
new file mode 100644
index 0000000..384d33e
--- /dev/null
+++ b/web/attachments/40985-check_oracle.patch
@@ -0,0 +1,104 @@
1--- new/check_oracle.sh Wed Jan 29 14:38:44 2003
2+++ jjm/check_oracle.sh Wed Jan 29 15:17:01 2003
3@@ -1,4 +1,4 @@
4-#!/bin/sh
5+#!/bin/bash
6 #
7 # latigid010@yahoo.com
8 # 01/06/2000
9@@ -37,6 +37,8 @@
10 echo " $PROGNAME --tns <Oracle Sid or Hostname/IP address>"
11 echo " $PROGNAME --db <ORACLE_SID>"
12 echo " $PROGNAME --login <ORACLE_SID>"
13+ echo " $PROGNAME --cache <USER> <PASS> <INST> <CRITICAL> <WARNING>"
14+ echo " $PROGNAME --tablespace <USER> <PASS> <INST> <TABLESPACE> <CRITICAL> <WARNING>"
15 echo " $PROGNAME --oranames <Hostname>"
16 echo " $PROGNAME --help"
17 echo " $PROGNAME --version"
18@@ -56,6 +58,14 @@
19 echo " filesystem for sgadefORACLE_SID.dbf"
20 echo "--login=SID"
21 echo " Attempt a dummy login and alert if not ORA-01017: invalid username/password"
22+ echo "--cache"
23+ echo " Check local database for library and buffer cache hit ratios"
24+ echo " ---> Requires Oracle user/password and SID specified."
25+ echo " ---> Requires select on v_$sysstat and v_$librarycache"
26+ echo "--tablespace"
27+ echo " Check local database for tablespace capacity in ORACLE_SID"
28+ echo " ---> Requires Oracle user/password specified."
29+ echo " ---> Requires select on dba_data_files and dba_free_space"
30 echo "--oranames=Hostname"
31 echo " Check remote Oracle Names server"
32 echo "--help"
33@@ -191,6 +201,71 @@
34 exit $STATE_CRITICAL
35 fi
36 ;;
37+--cache)
38+ if [ ${5} -gt ${6} ] ; then
39+ echo "UNKNOWN - Warning level is less then Crit"
40+ exit $STATE_UNKNOWN
41+ fi
42+ result=`sqlplus -s ${2}/${3}@${4} << EOF
43+ set pagesize 0
44+
45+select (1-(pr.value/(dbg.value+cg.value)))*100 \
46+from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg \
47+where pr.name = 'physical reads' \
48+ and dbg.name='db block gets' \
49+ and cg.name='consistent gets'; `
50+
51+ buf_hr=`echo $result | awk '{print int($1)}'`
52+ result=`sqlplus -s ${2}/${3}@${4} << EOF
53+ set pagesize 0
54+
55+select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 \
56+from v\\$librarycache lc ; `
57+
58+ lib_hr=`echo $result | awk '{print int($1)}'`
59+
60+ if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then
61+ echo "${3} : ${4} CRITICAL - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff"
62+ exit $STATE_CRITICAL
63+ fi
64+ if [ $buf_hr -le ${6} -o $lib_hr -le ${6} ] ; then
65+ echo "${3} : ${4} WARNING - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff"
66+ exit $STATE_WARNING
67+ fi
68+ echo "${3} : ${4} OK - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff"
69+
70+ exit $STATE_OK
71+ ;;
72+--tablespace)
73+ if [ ${6} -lt ${7} ] ; then
74+ echo "UNKNOWN - Warning level is more then Crit"
75+ exit $STATE_UNKNOWN
76+ fi
77+ result=`sqlplus -s ${2}/${3}@${4} << EOF
78+ set pagesize 0
79+
80+select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc \
81+from ( \
82+select tablespace_name,sum(bytes)/1024/1024 total \
83+from dba_data_files group by tablespace_name) A, \
84+( select tablespace_name,sum(bytes)/1024/1024 free \
85+from dba_Free_space group by tablespace_name) B \
86+where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}'; `
87+
88+ ts_free=`echo $result | awk '{print int($1)}'`
89+ ts_total=`echo $result | awk '{print int($2)}'`
90+ ts_pct=`echo $result | awk '{print int($3)}'`
91+ if [ $ts_pct -ge ${6} ] ; then
92+ echo "${4} : ${5} CRITICAL - $ts_pct% used [ $ts_free / $ts_total MB available ]"
93+ exit $STATE_CRITICAL
94+ fi
95+ if [ $ts_pct -ge ${7} ] ; then
96+ echo "${4} : ${5} WARNING - $ts_pct% used [ $ts_free / $ts_total MB available ]"
97+ exit $STATE_WARNING
98+ fi
99+ echo "${4} : ${5} OK - $ts_pct% used [ $ts_free / $ts_total MB available ]"
100+ exit $STATE_OK
101+ ;;
102 *)
103 print_usage
104 exit $STATE_UNKNOWN