Tool 1 SAR
The SAR command is included in the sysstat toolkit and provides numerous statistics about the system. Its commands vary in different systems. Here we only talk about its network data monitoring parameters.
Sar-N [Dev | EDEV | sock] interval CNT
The SAR provided by some systems supports statistics based on network interfaces. This command can view the number and traffic of packets sent and received per second on the device.
Sar-n udp | TCP | sock interval CNT
SAR provided by some systems supports protocol-based data statistics. This command allows you to view packets sent and received and error data for specific protocols.
Sar-T | u interval CNT
Similar to the preceding command, the parameter format and output format are different.
Download and install wget plugin
Tool 2 vnstat
The vnstat command reads/proc/NET/dev data and saves historical data in a specific database. It also provides data formatting to display historical or real-time traffic information.
Vnstat-l-I eth0 supports real-time display of network traffic and packets
Download and install wget http://humdi.net/vnstat/vnstat-1.10.tar.gz, decompress it, and install it as instructed.
Tool 3 ifconfig
Ifconfig itself provides the current real-time traffic information of an interface, which can be dynamically updated using the watch command.
Watch-N 1 "ifconfig eth0"
Tool 4 netstat
Netstat supports real-time statistical analysis of data of specific protocols, and can also be dynamically updated using the watch command
Watch-N 1 "netstat-S-u | T"