Chinaunix首页 | 论坛 | 博客
  • 博客访问: 517870
  • 博文数量: 230
  • 博客积分: 5726
  • 博客等级: 大校
  • 技术积分: 2765
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-21 13:51
文章分类

全部博文(230)

文章存档

2011年(33)

2010年(40)

2009年(157)

分类: LINUX

2009-12-29 12:15:08

#!/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

 原文地址 http://blog.chinaunix.net/u3/93926/showart_1872498.html
阅读(1383) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~