From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- web/attachments/32813-check_oracle.patch | 79 ++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 web/attachments/32813-check_oracle.patch (limited to 'web/attachments/32813-check_oracle.patch') 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 @@ +38a39,40 +> echo " $PROGNAME --cache " +> echo " $PROGNAME --tablespace " +55a58,65 +> echo "--cache" +> echo " Check local database for library and buffer cache hit ratios" +> echo " ---> Requires Oracle user/password and SID specified." +> echo " ---> Requires select on v_$sysstat and v_$librarycache" +> echo "--tablespace" +> echo " Check local database for tablespace capacity in ORACLE_SID" +> echo " ---> Requires Oracle user/password specified." +> echo " ---> Requires select on dba_data_fiels and dba_free_Space" +157a168,233 +> ;; +> --cache) +> if [ ${5} -gt ${6} ] ; then +> echo "UNKNOWN - Warning level is less then Crit" +> exit $STATE_UNKNOWN +> fi +> result=`sqlplus -s ${2}/${3}@${4} << EOF +> set pagesize 0 +> +> 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'; ` +> +> +> 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 ; ` +> +> lib_hr=`echo $result | awk '{print int($1)}'` +> +> if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then +> echo "${3} : ${4} CRITICAL - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff" +> exit $STATE_CRITICAL +> fi +> if [ $buf_hr -le ${6} -o $lib_hr -le ${6} ] ; then +> echo "${3} : ${4} WARNING - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff" +> exit $STATE_WARNING +> fi +> echo "${3} : ${4} OK - Cache Hit Rates: $lib_hr % Lib -- $buf_hr % Buff" +> +> exit $STATE_OK +> ;; +> --tablespace) +> if [ ${6} -lt ${7} ] ; then +> echo "UNKNOWN - Warning level is more then Crit" +> exit $STATE_UNKNOWN +> fi +> result=`sqlplus -s ${2}/${3}@${4} << EOF +> set pagesize 0 +> +> select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc \ +> from ( \ +> 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}'; ` +> +> ts_free=`echo $result | awk '{print int($1)}'` +> ts_total=`echo $result | awk '{print int($2)}'` +> ts_pct=`echo $result | awk '{print int($3)}'` +> if [ $ts_pct -ge ${6} ] ; then +> echo "${4} : ${5} CRITICAL - $ts_pct% used [ $ts_free / $ts_total MB available ]" +> exit $STATE_CRITICAL +> fi +> if [ $ts_pct -ge ${7} ] ; then +> echo "${4} : ${5} WARNING - $ts_pct% used [ $ts_free / $ts_total MB available ]" +> exit $STATE_WARNING +> fi +> echo "${4} : ${5} OK - $ts_pct% used [ $ts_free / $ts_total MB available ]" +> exit $STATE_OK -- cgit v1.2.3-74-g34f1