497
中電雲集
Linux下檢測網卡流量的兩款軟件nload iftop
Linux下檢測網卡流量的兩款軟件,
其一是:nload,
另外一個就是:iftop
這兩個軟件的安裝方法都很簡單,從以上網址下載下來後,
安裝nload:
./configure –prefix=/usr/local/nload && make && make install
安裝iftop:
./configure –prefix=/usr/local/iftop && make && make install
這樣就好了,然後你就可以執行如下命令來監測網卡流量了:
nload是:
#/usr/local/nload/bin/nload
iftop是:
#/usr/local/iftop/sbin/iftop
一般的服務器都會有內網和外網兩塊網卡,nload默認的是eth0網卡,如果你想監測eth1網卡的流量:
那麼
#/usr/local/nload/bin/nload eth1
這樣即可。
nload默認分為上下兩塊:上半部分是:Incoming也就是進入網卡的流量,下半部分是:Outgoing,也就是從這塊網卡出去的流量,每部分都有當前流量(Curr),平均流量(Avg),最小流量(Min),最大流量(Max),總和流量(Ttl)這幾個部分,看起來還是蠻直觀的。
另外,你也可以自己定義流量數值顯示的單位 #/usr/local/nload/bin/nload –help
就可以看到具體的相關參數了。
下麵再來說下iftop
iftop默認也是監測eth0網卡的流量,如果你想要監測eth1這塊網卡,則需要加-i+eth1來指定網卡,也就是這樣:
#/usr/local/iftop/sbin/iftop -i eth1
iftop顯示的也很直觀,樣子和操作有些像top命令。
在iftop的圖表中最後有三列流量的數值顯示,
其中第一列的意思是:在之前兩秒鍾的平均流量
第二列的意思是:在之前10秒鍾一共的流量
最後一列的意思是:在之前的40秒鍾五分之一的流量數值
大約是這個意思,具體的限於本人英文不好,下麵貼出man page的英文:
Display:
When running, iftop uses the whole screen to display network usage. At the top of the display is a logarithmic scale for the bar graph which gives a visual indication of traffic.
The main part of the display lists, for each pair of hosts, the rate at which data has been sent and received over the preceding 2, 10 and 40 second intervals. The direction of data flow is indicated by arrows, <= and =>. For instance,
foo.example.com => bar.example.com 1Kb 500b 100b
<= 2Mb 2Mb 2Mb
shows, on the first line, traffic from foo.example.com to bar.example.com; in the preceding 2 seconds, this averaged 1Kbit/s, around half that amount over the preceding 10s, and a fifth of that over the whole of the last 40s. During each of those intervals, the data sent in the other direction was about 2Mbit/s. On the actual display, part of each line is inverted to give a visual indication of the 10s average of traffic. You might expect to see something like this where host foo is making repeated HTTP requests to bar, which is sending data back which saturates a 2Mbit/s link.
By default, the pairs of hosts responsible for the most traffic (10 second average) are displayed at the top of the list.
At the bottom of the display, various totals are shown, including peak traffic over the last 40s, total traffic transferred (after filtering), and total transfer rates averaged over 2s, 10s and 40s.
要監測網卡流量,基本以上的dd就夠用了吧?
本文來自CSDN博客,轉載請標明出處:https://blog.csdn.net/chinalinuxzend/archive/2009/03/26/4026662.aspx
最後更新:2017-01-04 22:34:34