This page looks plain and unstyled because you're using a non-standard compliant browser. To see it in its best form, please upgrade to a browser that supports web standards. It's free and painless.
联系方式
最近回复
我的链接
琴瑟友之 待阅颜如玉
藏书黄金屋
|
查看网卡流量的脚本calfen | 03 三月, 2009 11:59 (1298 Reads)
几点说明 :
#!/bin/bash #monitor streams of LTS channels #Write by calfen 20090227 timeOld=`date +%s` eth0=`cat /proc/net/dev | grep eth0 | sed 's=^.*:==' ` eth1=`cat /proc/net/dev | grep eth1 | sed 's=^.*:==' ` eth0InOld=$(echo $eth0 | awk '{ print $1 }') eth0OutOld=$(echo $eth0 | awk '{ print $9 }') eth1InOld=$(echo $eth1 | awk '{ print $1 }') eth1OutOld=$(echo $eth1 | awk '{ print $9 }') while true do sleep ${1} eth0=`cat /proc/net/dev | grep eth0 | sed 's=^.*:==' ` eth1=`cat /proc/net/dev | grep eth1 | sed 's=^.*:==' ` timeNew=`date +%s` eth0InNew=$(echo $eth0 | awk '{ print $1 }') eth0OutNew=$(echo $eth0 | awk '{ print $9 }') eth1InNew=$(echo $eth1 | awk '{ print $1 }') eth1OutNew=$(echo $eth1 | awk '{ print $9 }') eth0DiffIn=$((eth0InNew-eth0InOld)) eth1DiffIn=$((eth1InNew-eth1InOld)) eth0DiffOut=$((eth0OutNew-eth0OutOld)) eth1DiffOut=$((eth1OutNew-eth1OutOld)) timeDiff=$((timeNew-timeOld)) echo "eht0-In: $((eth0DiffIn*8/1024/timeDiff)) kbps eth0-Out: $((eth0DiffOut*8/1024/timeDiff)) kbps eht1-IN: $((eth1D iffIn*8/1024/timeDiff)) kbps eth1-Out: $((eth1DiffOut*8/1024/timeDiff)) kbps" eth0InOld=${eth0InNew} eth1InOld=${eth1Inew} eth0OutOld=${eth0OutNew} eth1OutOld=${eth1OutNew} timeOld=${timeNew} done
你是半年出一次文?
文章真實引用網址:http://blog.luluchina.com/blog/trackback.php?id=162 发表评论 |
搜索文章归档
六月 2010 订阅我的blog咀嚼千钟黍
訪客統計
|