nload

nload
用途: 用来即时监看网路状态和各ip所使用的频宽(很废话了)
nload默认的是eth0网卡,如果你想监测eth1网卡的流量

1
nload eth1

nload默认分为上下两块:上半部分是:Incoming也就是进入网卡的流量,下半部分是:Outgoing,也就是从这块网卡出去的流量,每 部分都有当前流量(Curr),平均流量(Avg),最小流量(Min),最大流量(Max),总和流量(Ttl)这几个部分,看起来还是蛮直观的.
另外,你也可以自己定义流量数值显示的单位
#nload –help
就可以看到具体的相关参数了.

查看网络平均流量

下面的脚本可以很好的监控你的网络的平均流量,你可以提定时间

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
#!/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"

 

原文地址:https://www.cnblogs.com/lexus/p/2568668.html