[Nagiosplug-checkins] CVS: nagiosplug/plugins-scripts check_oracle.sh,1.9,1.10

Ton Voon tonvoon at users.sourceforge.net
Thu Apr 8 04:19:08 CEST 2004


Update of /cvsroot/nagiosplug/nagiosplug/plugins-scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13523

Modified Files:
	check_oracle.sh 
Log Message:
Cleaner calls to awk and support if Oracle has different national
language settings (Torsten Werner)


Index: check_oracle.sh
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins-scripts/check_oracle.sh,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** check_oracle.sh	17 Jul 2003 12:14:32 -0000	1.9
--- check_oracle.sh	8 Apr 2004 11:05:11 -0000	1.10
***************
*** 193,196 ****
--- 193,197 ----
      result=`sqlplus -s ${3}/${4}@${2} << EOF
  set pagesize 0
+ set numf '9999999.99'
  select (1-(pr.value/(dbg.value+cg.value)))*100
  from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg
***************
*** 206,212 ****
      fi
  
!     buf_hr=`echo $result | awk '{print int($1)}'` 
      result=`sqlplus -s ${3}/${4}@${2} << EOF
  set pagesize 0
  select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100
  from v\\$librarycache lc;
--- 207,214 ----
      fi
  
!     buf_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` 
      result=`sqlplus -s ${3}/${4}@${2} << EOF
  set pagesize 0
+ set numf '9999999.99'
  select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100
  from v\\$librarycache lc;
***************
*** 219,223 ****
      fi
  
!     lib_hr=`echo $result | awk '{print int($1)}'`
  
      if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then
--- 221,225 ----
      fi
  
!     lib_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'`
  
      if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then
***************
*** 240,243 ****
--- 242,246 ----
      result=`sqlplus -s ${3}/${4}@${2} << EOF
  set pagesize 0
+ set numf '9999999.99'
  select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc
  from (
***************
*** 255,270 ****
      fi
  
!     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_free -eq 0 -a $ts_total -eq 0 -a $ts_pct -eq 0 ] ; then
          echo "No data returned by Oracle - tablespace $5 not found?"
          exit $STATE_UNKNOWN
      fi
!     if [ $ts_pct -ge ${6} ] ; then
    	echo "${2} : ${5} CRITICAL - $ts_pct% used [ $ts_free / $ts_total MB available ]"
  	exit $STATE_CRITICAL
      fi
!     if [ $ts_pct -ge ${7} ] ; then
    	echo "${2} : ${5} WARNING  - $ts_pct% used [ $ts_free / $ts_total MB available ]"
  	exit $STATE_WARNING
--- 258,273 ----
      fi
  
!     ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'` 
!     ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'` 
!     ts_pct=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` 
!     if [ "$ts_free" -eq 0 -a "$ts_total" -eq 0 -a "$ts_pct" -eq 0 ] ; then
          echo "No data returned by Oracle - tablespace $5 not found?"
          exit $STATE_UNKNOWN
      fi
!     if [ "$ts_pct" -ge ${6} ] ; then
    	echo "${2} : ${5} CRITICAL - $ts_pct% used [ $ts_free / $ts_total MB available ]"
  	exit $STATE_CRITICAL
      fi
!     if [ "$ts_pct" -ge ${7} ] ; then
    	echo "${2} : ${5} WARNING  - $ts_pct% used [ $ts_free / $ts_total MB available ]"
  	exit $STATE_WARNING





More information about the Commits mailing list