Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> one last awk question for tbs monitoring...
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
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Fri Jun 11 2004 - 10:37:00 CDT