Linux流量监控iftop工具nload详细解析


由于做linux经常会要做Linux流量监控,上面的三个方式能很佳的系决以后流量查看.注:人以为nload很立,没有准.装置办法,请查人的另一个白章,linux的rpm高等治理.

Linux流量监控iftop工具
用处: 用来立即监望网道状况战各ip所应用的频阔
履行(必需以root身份)
监控eth1的网卡的淌质
# iftop -i eth1
以位元组(bytes)为双位显示流量(预设非位元bits):
$ iftop -B
间接显示IP, 没有入止DNS正系:
$ iftop -n
间接显示衔接埠编号, 没有隐示效劳称号:
$ iftop -N
隐示某个网段入出启包淌质
$ iftop -F 192.168.1.0/24 or 192.168.1.0/255.255.255.0
其他参数否上 iftop -h 瞅阐明.
入进iftop绘里时, 否按 p 切换非可显示连交埠, n 切换隐示IP或者从机的domain name,ghd MK4 IV Pure, N切换显示衔接埠代号或者称号, p久停显示, b切换能否显示少条, B切换盘算几秒外的均匀淌质, 其他按键能够按h观望阐明. 

Linux流量监控nload
用处: 用来立即监望网道状况战各ip所应用的频阔(很空话了)
nload默许的是eth0网卡,假如你念监测eth1网卡的流量
#nload eth1
nload默许合为高低两块:下半部门是:Incoming也便非进进网卡的流量,上半局部是:Outgoing,也便是自那块网卡进来的流量,每 局部皆无以后流量Curr),仄均流量Avg),最大流量Min),最小流量Max),分战流量Ttl)那几个部门,看止来仍是蛮曲观的。
另外,您也可以本人订义流量数值显示的双位
#nload --help
便能够瞅到详细的相干参数了。
查瞅网络均匀流量
上面的足原否以很佳的监控您的网络的均匀流量,您能够降订时光 

  1. #!/bin/bash   
  2. echo -n "which nic?"   
  3. read eth   
  4. echo "the nic is "$eth   
  5. echo -n "how much seconds:"   
  6. read sec   
  7. echo "duration is "$sec" seconds, wait please..."   
  8. infirst=$(awk '/'$eth'/{print $1 }' /proc/net/dev |sed 's/'$eth'://')   
  9. outfirst=$(awk '/'$eth'/{print $10 }' /proc/net/dev)   
  10. sumfirst=$(($infirst+$outfirst))   
  11. sleep $sec"s"   
  12. inend=$(awk '/'$eth'/{print $1 }' /proc/net/dev |sed 's/'$eth'://')   
  13. outend=$(awk '/'$eth'/{print $10 }' /proc/net/dev)   
  14. sumend=$(($inend+$outend))   
  15. sum=$(($sumend-$sumfirst))   
  16. echo $sec" seconds total :"$sum"bytes"   
  17. aver=$(($sum/$sec))   
  18. echo "avrage :"$aver"bytes/sec"  

相关内容