日期:2014-05-16 浏览次数:20798 次
x=0 totMem=`vmstat | grep 'mem=' | awk -F\= '{ print $3 }' | awk -F\M '{print $1 }'` totMem1=` echo "$totMem * 200 " | bc ` while true do strDate=`date +"%Y%m%d"` strTime=`date +"%Y%m%d%H"` strRun=`vmstat 1 4 | tail -1 | awk '{ print " "$3" "$14" "$15 }' ` echo $strTime" "$totMem1$strRun >> capa_$strDate.txt sleep 56 x=`expr $x + 1` if [ $x -gt 3000 ] then break fi done
if [ "$#" -ne 1 ] then echo "Usage:get_capa.sh yyyymmdd" exit 1 fi echo "Hour Mem(%) Cpu(%) " > capa_hour_$1.txt hh="00" x=0 while true do if [ x -lt 10 ] then hh="0"$x else hh=$x fi strTmp=`grep $1$hh capa_$1.txt | awk 'BEGIN{allMem=0;useMem=0;memRate=0;cpuRate=0;num=0;allCpu=0;} { allMem=allMem+$2;useMem=useMem+$3;num=num+1;allCpu=allCpu+$4+$5;} END{ if (allMem>0) { memRate=useMem*100/allMem;cpuRate=allCpu/num;} print memRate" "cpuRate}'` echo $hh" "$strTmp >> capa_hour_$1.txt x=`expr $x + 1` if [ $x -gt 23 ] then break fi done cat capa_hour_$1.txt
if [ "$#" -ne 3 ] then echo "Usage:sum_tran.sh yyyy mm dd" exit 1 fi echo "Hour Trans" > tran_hour_$1$2$3.txt hh="00" x=0 while true do if [ x -lt 10 ] then hh="0"$x else hh=$x fi num=`grep TxRunAction /usr/IBM/HTTPServer/logs/access.$1.$2.$3.log|grep $1":"$hh |wc -l` echo $hh" "$num >> tran_hour_$1$2$3.txt x=`expr $x + 1` if [ $x -gt 23 ] then break fi done cat tran_hour_$1$2$3.txt num=`cat /usr/IBM/HTTPServer/logs/access.$1.$2.$3.log | wc -l` echo "TotTrans="$num num=`grep TxRunAction /usr/IBM/HTTPServer/logs/access.$1.$2.$3.log|wc -l` echo "TxRunTrans="$num num=`grep LinkageTX /usr/IBM/HTTPServer/logs/access.$1.$2.$3.log|wc -l` echo "LinkTrans="$num
if [ "$#" -ne 1 ] then echo "Usage:db_20w.sh ddmmyyyy" exit 1 fi db2 "connect to ecap " db2 "select count(*) from ecapdb.t_tran_log where HEAD_DATE='"$1"' "