随笔 - 0, 文章 - 264, 评论 - 170, 引用 - 0
数据加载中……

linux下监控cpu、memo、io、swap性能数据

直接贴脚本:
1、cpu
#!/bin/bash
CurrentDate
=`date -d today '+%Y%m%d'`
CurrentTime
=`date -d today '+%Y%m%d%H%M'`
mytext
="$CurrentTime\t`top -b -n 1 | grep Cpu\(s\)`"
echo 
-e $mytext >> /home/www/monitor/log/cpu$CurrentDate.log
2、memo
#!/bin/bash
CurrentDate
=`date -d today '+%Y%m%d'`
CurrentTime
=`date -d today '+%Y%m%d%H%M'`
mytext
="$CurrentTime\t`top -b -n 1 | grep Mem:`"
echo 
-e $mytext >> /home/www/monitor/log/memo$CurrentDate.log
3、io
#!/bin/bash
CurrentDate
=`date -d today '+%Y%m%d'`
CurrentTime
=`date -d today '+%Y%m%d%H%M'`
mytext
="$CurrentTime\t`iostat -p sda | grep -w sda`"
echo 
-e $mytext >> /home/www/monitor/log/io$CurrentDate.log
4、swap
#!/bin/bash
CurrentDate
=`date -d today '+%Y%m%d'`
CurrentTime
=`date -d today '+%Y%m%d%H%M'`
mytext
="$CurrentTime\t`top -b -n 1 | grep Swap:`"
echo 
-e $mytext >> /home/www/monitor/log/swap$CurrentDate.log


posted on 2010-11-05 15:13 小一败涂地 阅读(1446) 评论(0)  编辑  收藏 所属分类: linux相关


只有注册用户登录后才能发表评论。


网站导航: