CPU:
linux: vmstat 1 5 | awk '{if(NR>=3) {sum+=$15;l++}} END{printf("cpu average use %f%\n",100-sum/l)}'
aix: vmstat 1 5 | awk '{if(NR>6) {sum+=$16;l++}} END{printf("%f\n",100-sum/l)}'
内存:
linux: free | awk '{if($1~"Mem:") printf("%f\n",(1-($4+$6+$7)/$2)*100)}'
free | awk '{if($1~/Mem/) total=$2;if($2~/buffer/) used=$3} END{printf("%f%s\n", used/total*100,"%")}'
aix: svmon -G | awk '{if($1=="memory") printf("%f\n",$3/$2*100)}'
磁盘:
linux: df | awk '{if($1~"/dev") l++;sub("%","");sum+=$5;} END{printf("%f\n", sum/l)}'
df | awk -F'[ %]+' '{if($1~"/dev") l++;sum+=$5;} END{printf("%f\n",sum/l)}'
solaris: df -h | nawk '{if($1~"/dev/") l++;sub("%","");sum+=$5;} END {printf("%f\n", sum/l)}'
aix: df -k | awk -F'[ %]+' '{if(NR>1 && $1~"/dev") {sum+=$6;l++}} END{printf("%f\n",sum/l)}'
hp dl380 g5 查看硬盘RAID方式: cat /proc/driver/cciss/cciss0
阅读(1359) | 评论(0) | 转发(0) |