Statistics network interface traffic status
ifstat command Just like iostat/vmstat describes other system conditions, it is a tool for statistics of network interface activity status. The ifstat tool system is not installed by default. You need to download the source code package yourself, recompile and install it. The usage process is relatively simple.
http://gael.roualland.free.fr/ifstat/ (official website)
wget http://gael.roualland.free.fr/ifstat/ifstat-1.1.tar.gz
tar -zxvf ifstat-1.1.tar.gz
cd ifstat-1.1
./configure
make
make install # By default, it will be installed in the /usr/local/bin/ directory
Note: Executing which ifstat
outputs /usr/local/bin/ifstat
-l Monitor loop network interface (lo). By default, ifstat monitors all non-loop network interfaces for activity. After use, it is found that adding the -l parameter can monitor the information of all network interfaces, instead of only monitoring the lo interface information. In other words, adding the -l parameter will have one more lo interface status information than not adding the -l parameter. .
-a Monitors the status information of all network interfaces that can be detected. After using it, I found that there is more interface information for plip0 than adding the -l parameter. After searching, I found that this is a parallel port (there is one in the network equipment called PLIP (Parallel Line Internet Protocol). It provides a parallel port...)
-z hides interfaces with no traffic, such as interfaces that are started but not used.
-i specifies the interface to be monitored, followed by the network interface name
-s is equivalent to adding the -d snmp:[comm@][#]host[/nn]] parameter to query a remote host through SNMP
-h displays a brief help message
-n turns off the display of header information that appears periodically (that is, when running ifstat without the -n parameter, the name of the network interface will appear at the top. When it cannot be displayed on one screen, the name of the interface will appear again to prompt us. The traffic information displayed is specific to which network interface. Add the -n parameter to turn off the periodic display of the interface name and only display it once)
-t adds a timestamp at the beginning of each line (can tell us the specific time)
-T reports the total bandwidth of all monitored interfaces (the last column has total, which displays the in traffic of all interfaces and the out traffic of all interfaces. Simply add the in traffic of all interfaces and the out traffic)
-w Use the specified column width instead of automatically enlarging the column width to fit the length of the interface name
-W Automatically wrap content if it is wider than the width of the terminal window
-S keeps status updated on the same line (no scrolling or line wrapping) Note: This is very convenient if you don't like screen scrolling, similar to the display method of bmon
-b displays bandwidth in kbits/s instead of kbytes/s
-q Quiet mode, warning messages do not appear
-v displays version information
-d specifies a driver to collect status information
Used by default
[root@localhost ifstat-1.1] #ifstat
eth0 eth1
KB/s in KB/s out KB/s in KB/s out
0.07 0.20 0.00 0.00
0.07 0.15 0.58 0.00
By default, ifstat does not monitor the loopback interface, and the traffic unit displayed is KB.
[root@localhost ifstat-1.1]# ifstat -tT
time eth0 eth1 eth2 eth3 Total
HH:MM:ss KB/s in KB/s out KB/s in KB/s out KB/s in KB/s out KB/s in KB/s out KB/s in KB/s out
16:53:04 0.84 0.62 1256.27 1173.05 0.12 0.18 0.00 0.00 1257.22 1173.86
16:53:05 0.57 0.40 0.57 0.76 0.00 0.00 0.00 0.00 1.14 1.17
16:53:06 1.58 0.71 0.42 0.78 0.00 0.00 0.00 0.00 2.01 1.48
16:53:07 0.57 0.40 1.91 2.61 0.00 0.00 0.00 0.00 2.48 3.01
16:53:08 0.73 0.40 924.02 1248.91 0.00 0.00 0.00 0.00 924.76 1249.31
Monitor all network interfaces
[root@localhost ifstat-1.1] # ifstat -a
lo eth0 eth1
KB/s in KB/s out KB/s in KB/s out KB/s in KB/s out
0.00 0.00 0.28 0.58 0.06 0.06
0.00 0.00 1.41 1.13 0.00 0.00
0.61 0.61 0.26 0.23 0.00 0.00