We know that in Linux, the top command can see some of the resources in the server, CPU, memory, and so on, and can see who is consuming memory or CPU, but sometimes we find that the CPU and memory are not tight, but the server is still very slow, We need one more dimension to help us analyze the problem, that is, traffic statistics, today to introduce a tool iftop, I hope to help you solve this problem.
Iftop Sneak Peek:
1, Interface introduction
The interface above shows a scale range similar to that of the scale, which is used as a ruler for the bar showing the flow graph.
The <= in the middle and the two left and right arrows indicate the direction of the flow.
TX: Send Traffic
RX: Receive Traffic
Total: Overall flow
Cumm: Total traffic running iftop to current time
Peak: Traffic Peaks
Rates: Represents the average traffic for the past 2s 10s 40s, respectively
Official website: http://www.ex-parrot.com/~pdw/iftop/
Know the port, we can through the Netstat-ntlup|grep port number to see the specific process, and through the PS-EF |grep process number, to see the relevant information, so that it is easy to locate the big consumer traffic is who!
2, Prepare:
Necessary library files, need libpcap and libcurses.
Yum install-y Flex byacc libpcap ncurses ncurses-devel libpcap-devel
Specify directory: cd/usr/local/
Download: wget http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz
Decompression: Tar zvfx iftop-0.17.tar.gz
Application Configuration
CD iftop-0.17
./configure--prefix=/usr/local/iftop
compiling: Make && make install
Copy executable to Linux library: Cp/usr/local/iftop/sbin/iftop/bin
3, run Iftop
To view the network adapter name to monitor: ifconfig-a
Please be a root-level user
iftop-i Eth0-n-P
More detailed parameters can be viewed Iftop-h
Summary:
On Linux, by installing a series of plugins to expand Linux, this is the operating system, but mapping to Java, is not the same? Many places are the same, which can be categorized with a result: extensible software, also often we say to do the standard, can be replaced by the expansion, and recently read a number of the "Hacker and painter" in Java introduction is common, he is seeking unity, module, rather than custom, in the unity, the basis of the module, Liberate people, people, can be replaced, this is also a very worthy of learning philosophy!
The road of Project cultivation (7) Iftop View the flow-consuming process