- 域名
Linux流量监控iftop工具nload详细解析
时间:2010-12-5 17:23:32 作者:域名 来源:系统运维 查看: 评论:0
内容摘要:复制#!/bin/bash echo-n"whichnic?" readeth echo"thenicis"$eth

复制#!/bin/bash echo -n "which nic?流量监
" read eth echo "the nic is "$eth echo -n "how much seconds:" read sec echo "duration is "$sec" seconds, wait please..." infirst=$(awk /$eth/{print $1 } /proc/net/dev |sed s/$eth://) outfirst=$(awk /$eth/{print $10 } /proc/net/dev) sumfirst=$(($infirst+$outfirst)) sleep $sec"s" inend=$(awk /$eth/{print $1 } /proc/net/dev |sed s/$eth://) outend=$(awk /$eth/{print $10 } /proc/net/dev) sumend=$(($inend+$outend)) sum=$(($sumend-$sumfirst)) echo $sec" seconds total :"$sum"bytes" aver=$(($sum/$sec)) echo "avrage :"$aver"bytes/sec" 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.