标签:test cat 提醒 bytes jar from 系统 free group by
1 . ~/.profile 2 jvcmd="/usr/java14/jre/bin/java" 3 agtjar="/tmp/ty/NotifyAgent.jar" 4 phoneNbr="-p 13300000000" 5 6 /oracle11/oracle/product/11.2.0.4/dbhome_1/bin/sqlplus / as sysdba > test1.log <<EOF 7 set heading off 8 select a.tablespace_name, round(100*(1-free/total),1) usage from 9 (select tablespace_name,sum(bytes)/(1024*1024) total from dba_data_files group by tablespace_name) a , 10 (select tablespace_name,sum(bytes)/(1024*1024) free from dba_free_space group by tablespace_name) b 11 where a.tablespace_name=b.tablespace_name(+) ; 12 exit 13 EOF 14 15 cat test1.log|grep IBA3 > test2.log 16 tbs=`cat test2.log|awk ‘{print $1}‘` 17 ratio=`cat test2.log|awk ‘{print $2}‘` 18 msg1=`hostname`": " 19 for i in $ratio 20 do 21 if [ $i -ge 95 ];then 22 tbs=`cat test2.log|grep $i|awk ‘{print $1}‘` 23 msg1=${msg1}${tbs}","${i}"%" 24 $jvcmd -jar $agtjar -a 1 $phoneNbr -c $msg1 25 else 26 continue; 27 fi 28 done 29 30 fs=`df -g|grep /ogg|awk ‘{print $4}‘|cut -d "%" -f1` 31 msg2=`hostname`": " 32 if [ $fs/1 -ge 90 ];then 33 msg2=${msg2}"/ogg "${fs}"%" 34 $jvcmd -jar $agtjar -a 1 $phoneNbr -c $msg2 35 fi
用于监控表空间和文件系统使用率,在超过阀值时,可以小短信提醒!
标签:test cat 提醒 bytes jar from 系统 free group by
原文地址:http://www.cnblogs.com/tonnytangy/p/7604665.html