Chinaunix首页 | 论坛 | 博客
  • 博客访问: 10492591
  • 博文数量: 2905
  • 博客积分: 20098
  • 博客等级: 上将
  • 技术积分: 36298
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-23 05:00
文章存档

2012年(1)

2011年(3)

2009年(2901)

分类: LINUX

2009-03-23 10:52:26

都赖这经济危机!!!
现在要根据老的linux机器的系统消耗来配置新的机器。
所以要写个东西记录运行时的CPU、内存等的消耗情况。
也没学太好,就又搞了个命令的集合。
呵呵。
 
#!/bin/bash
########################################################################
#rsru.sh
#record_system_resources_usage.sh
#The script used to record the use of system resources.
#by shark巨菜
########################################################################
#define
IOSTAT_FILE=./iostatus.txt
DATE=`date +%Y%m%d---%r`
CPU_USAGE=`top -b -n 1|head -n 5`
MEM_USAGE=`free -m`
HCT=`ps aux| awk '{print $5 "\t" $6 "\t" $11}' |sort -nr|head -n 10`
#setup the time of the check
echo "#######################################################" >> $IOSTAT_FILE
echo "$DATE" >> $IOSTAT_FILE
echo "-------------------------------------------------------------------------" >>$IOSTAT_FILE
#check the cpu status
echo "$CPU_USAGE" >> $IOSTAT_FILE
echo "-------------------------------------------------------------------------" >>$IOSTAT_FILE
#check the memory status
echo "$MEM_USAGE" >> $IOSTAT_FILE
echo "-------------------------------------------------------------------------" >>$IOSTAT_FILE
#check the tasks status
echo "$HCT" >> $IOSTAT_FILE
 
会生成一个iostatus.txt的文件,水平有限还不能根据这些数据给出简明扼要的提示,只能自己看使用率了。
o(╯□╰)o

阅读(2155) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~