one last awk question for tbs monitoring...

  • From: "David Green" <thump@xxxxxxxxxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Fri, 11 Jun 2004 10:40:00 -0500 (CDT)

Okay, I think I almost have this...
I actually have already coded a working solution, but my original plan of
using awk and not getting it to work is nagging me.  Any pointers are
appreciated.

Here is the code:
SID=$1
cd /m1/homes/oracle
. ./$SID

export WARNING_THRESHOLD=55
export CRITICAL_THRESHHOLD=65

export TBS_WARNING=`orastat -ts | awk '{if ($10 > WARNING_THRESHOLD) print
$10}' | grep -vi generic | grep -vi pct | grep -vi === | grep -vi listed |
grep -vi accurat`
export TBS_CRITICAL=`orastat -ts | awk '{if ($10 > CRITICAL_THRESHHOLD)
print $10}' | grep -vi generic | grep -vi pct | grep -vi === | grep -vi
listed | grep -vi accurat`

if [ $TBS_CRITICAL -gt 60 ]; then
        ./orastat -ts|mailx -s "TBS CRITICAL for $SID" dgreen-email
elif [ $TBS_WARNING -gt 50 ]; then
        ./orastat -ts|mailx -s "TBS WARNING for $SID" dgreen-email
fi

Problem is that the values returned from awk to the TBS_ cariables are all
on one row:
+ [ ----- 66.3 62.8 37.6 22.6 11.9 11.6 8.3 0.1 ----- -gt 60 ]
./check_tbs.bk[13]: 66.3: unknown test operator
+ [ ----- 66.3 62.8 37.6 22.6 11.9 11.6 8.3 0.1 ----- -gt 50 ]

Does that mean I have to setup something like a "while read line do" type
of logic?

Thanks
- David
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: