Chinaunix首页 | 论坛 | 博客
  • 博客访问: 383098
  • 博文数量: 146
  • 博客积分: 7142
  • 博客等级: 少将
  • 技术积分: 975
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-03 09:43
文章分类

全部博文(146)

文章存档

2012年(1)

2011年(5)

2010年(24)

2009年(116)

我的朋友

分类:

2009-12-23 17:41:25

#!/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
阅读(857) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~