CPU统计和计算(基于mpstat)
cpu收集: mpstat -P ALL 1 >>cpu.log &
输出 cat cpu.log |grep all |awk 'BEGIN{sum=0;count=0}{sum+=$NF;count+=1}{print sum/count}'
MEM内存统计和计算(基于free命令)
mem收集: free -mt -s 1 >>./mem.log &
输出 cat mem.log |grep Total | awk 'BEGIN{sum=0;count=0}{sum+=$4;count+=1}{print sum/count}' |