2019独角兽企业重金招聘Python工程师标准>>>
#利用iftop查看服务器实时流量
yum install -y gcc flex byacc libpcap ncurses ncurses-devel libpcap-devel tcpdump
yum -y install iftop
#下面是源码编译安装方式
wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz
tar zxvf iftop-0.17.tar.gz
cd iftop-0.17
./configure
make && make install
/usr/local/iftop/sbin/iftop -i eth0 -B -n #就可以看到eth0网卡的流量状况
#参数说明:
#TX发送 RX接收 TOTAL总流量 cum运行iftop后的总量 peak峰值 rates分别表示过去2s 10s 40s 平均流量
iftop -help
iftop: display bandwidth usage on an interface by host
Synopsis: iftop -h | [-npblNBP] [-i interface] [-f filter code]
[-F net/mask] [-G net6/mask6]
-h display this message
-n don't do hostname lookups
-N don't convert port numbers to services
-p run in promiscuous mode (show traffic between other
hosts on the same network segment)
-b don't display a bar graph of traffic
-B Display bandwidth in bytes 按字节单位显示
-i interface listen on named interface 设置监听网卡接口,默认eth0
-f filter code use filter code to select packets to count
(default: none, but only IP packets are counted)
-F net/mask show traffic flows in/out of IPv4 network
-G net6/mask6 show traffic flows in/out of IPv6 network
-l display and count link-local IPv6 traffic (default: off)
-P show ports as well as hosts
-m limit sets the upper limit for the bandwidth scale
-c config file specifies an alternative configuration file
-t use text interface without ncurses
Sorting orders:
-o 2s Sort by first column (2s traffic average)
-o 10s Sort by second column (10s traffic average) [default]
-o 40s Sort by third column (40s traffic average)
-o source Sort by source address
-o destination Sort by destination address
The following options are only available in combination with -t
-s num print one single text output afer num seconds, then quit
-L num number of lines to print
转载于:https://my.oschina.net/godareyou/blog/505218
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)