summaryrefslogtreecommitdiffstats
path: root/web/attachments/32813-check_oracle.patch
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/32813-check_oracle.patch')
-rw-r--r--web/attachments/32813-check_oracle.patch79
1 files changed, 79 insertions, 0 deletions
diff --git a/web/attachments/32813-check_oracle.patch b/web/attachments/32813-check_oracle.patch
new file mode 100644
index 0000000..a2bd429
--- /dev/null
+++ b/web/attachments/32813-check_oracle.patch
@@ -0,0 +1,79 @@
138a39,40
2> echo " $PROGNAME --cache <USER> <PASS> <INST> <CRITICAL> <WARNING>"
3> echo " $PROGNAME --tablespace <USER> <PASS> <INST> <TABLESPACE> <CRITICAL> <WARNING>"
455a58,65
5> echo "--cache"
6> echo " Check local database for library and buffer cache hit ratios"
7> echo " ---> Requires Oracle user/password and SID specified."
8> echo " ---> Requires select on v_$sysstat and v_$librarycache"
9> echo "--tablespace"
10> echo " Check local database for tablespace capacity in ORACLE_SID"
11> echo " ---> Requires Oracle user/password specified."
12> echo " ---> Requires select on dba_data_fiels and dba_free_Space"
13157a168,233
14> ;;
15> --cache)
16> if [ ${5} -gt ${6} ] ; then
17> echo "UNKNOWN - Warning level is less then Crit"
18> exit $STATE_UNKNOWN
19> fi
20> result=`sqlplus -s ${2}/${3}@${4} << EOF
21> set pagesize 0
22>
23> select (1-(pr.value/(dbg.value+cg.value)))*100 \
24> from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg \
25> where pr.name = 'physical reads' \
26> and dbg.name='db block gets' \
27> and cg.name='consistent gets'; `
28>
29>
30> buf_hr=`echo $result | awk '{print int($1)}'`
31> result=`sqlplus -s ${2}/${3}@${4} << EOF
32> set pagesize 0
33>
34> select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 \
35> from v\\$librarycache lc ; `
36>
37> lib_hr=`echo $result | awk '{print int($1)}'`
38>
39> if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then
40> echo "${3} : ${4} CRITICAL - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff"
41> exit $STATE_CRITICAL
42> fi
43> if [ $buf_hr -le ${6} -o $lib_hr -le ${6} ] ; then
44> echo "${3} : ${4} WARNING - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff"
45> exit $STATE_WARNING
46> fi
47> echo "${3} : ${4} OK - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff"
48>
49> exit $STATE_OK
50> ;;
51> --tablespace)
52> if [ ${6} -lt ${7} ] ; then
53> echo "UNKNOWN - Warning level is more then Crit"
54> exit $STATE_UNKNOWN
55> fi
56> result=`sqlplus -s ${2}/${3}@${4} << EOF
57> set pagesize 0
58>
59> select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc \
60> from ( \
61> select tablespace_name,sum(bytes)/1024/1024 total \
62> from dba_data_files group by tablespace_name) A, \
63> ( select tablespace_name,sum(bytes)/1024/1024 free \
64> from dba_Free_space group by tablespace_name) B \
65> where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}'; `
66>
67> ts_free=`echo $result | awk '{print int($1)}'`
68> ts_total=`echo $result | awk '{print int($2)}'`
69> ts_pct=`echo $result | awk '{print int($3)}'`
70> if [ $ts_pct -ge ${6} ] ; then
71> echo "${4} : ${5} CRITICAL - $ts_pct% used [ $ts_free / $ts_total MB available ]"
72> exit $STATE_CRITICAL
73> fi
74> if [ $ts_pct -ge ${7} ] ; then
75> echo "${4} : ${5} WARNING - $ts_pct% used [ $ts_free / $ts_total MB available ]"
76> exit $STATE_WARNING
77> fi
78> echo "${4} : ${5} OK - $ts_pct% used [ $ts_free / $ts_total MB available ]"
79> exit $STATE_OK