Yuhang Zheng

Linux系统查看网口收发包统计的一些命令

N 人看过

下文中是归纳了一些在linux控制台查看网口收发包统计的一些信息

root@localhost:~# for i in /sys/class/net/fm1-mac9/statistics/*;do ls $i;cat  $i;done
/sys/class/net/fm1-mac9/statistics/collisions
0
/sys/class/net/fm1-mac9/statistics/multicast
0
/sys/class/net/fm1-mac9/statistics/rx_bytes
350488051841
/sys/class/net/fm1-mac9/statistics/rx_compressed
0
/sys/class/net/fm1-mac9/statistics/rx_crc_errors
0
/sys/class/net/fm1-mac9/statistics/rx_dropped
0
/sys/class/net/fm1-mac9/statistics/rx_errors
13
/sys/class/net/fm1-mac9/statistics/rx_fifo_errors
0
/sys/class/net/fm1-mac9/statistics/rx_frame_errors
0
/sys/class/net/fm1-mac9/statistics/rx_length_errors
0
/sys/class/net/fm1-mac9/statistics/rx_missed_errors
0
/sys/class/net/fm1-mac9/statistics/rx_nohandler
0
/sys/class/net/fm1-mac9/statistics/rx_over_errors
0
/sys/class/net/fm1-mac9/statistics/rx_packets
234586118
/sys/class/net/fm1-mac9/statistics/tx_aborted_errors
0
/sys/class/net/fm1-mac9/statistics/tx_bytes
10558881367
/sys/class/net/fm1-mac9/statistics/tx_carrier_errors
0
/sys/class/net/fm1-mac9/statistics/tx_compressed
0
/sys/class/net/fm1-mac9/statistics/tx_dropped
0
/sys/class/net/fm1-mac9/statistics/tx_errors
0
/sys/class/net/fm1-mac9/statistics/tx_fifo_errors
0
/sys/class/net/fm1-mac9/statistics/tx_heartbeat_errors
0
/sys/class/net/fm1-mac9/statistics/tx_packets
11094047
/sys/class/net/fm1-mac9/statistics/tx_window_errors
0
root@localhost:~# cat /proc/net/dev | column  -t
Inter-|      Receive       |          Transmit
face         |bytes        packets    errs      drop  fifo  frame  compressed  multicast|bytes  packets      errs      drop  fifo  colls  carrier  compressed
fm1-mac10:   0             0          0         0     0     0      0           0                0            0         0     0     0      0        0           0
lxcbr0:      0             0          0         0     0     0      0           0                0            0         0     0     0      0        0           0
virbr0:      0             0          0         0     0     0      0           0                0            0         0     0     0      0        0           0
fm1-mac9:    350488051841  234586118  13        0     0     0      0           0                10558881367  11094047  0     0     0      0        0           0
fm1-mac4:    0             0          0         0     0     0      0           0                0            0         0     0     0      0        0           0
virbr0-nic:  0             0          0         0     0     0      0           0                0            0         0     0     0      0        0           0
sit0:        0             0          0         0     0     0      0           0                0            0         0     0     0      0        0           0
lo:          1526          26         0         0     0     0      0           0                1526         26        0     0     0      0        0           0
fm1-mac6:    0             0          0         0     0     0      0           0                0            0         0     0     0      0        0           0
fm1-mac1:    0             0          0         0     0     0      0           0                0            0         0     0     0      0        0           0
fm1-mac5:    0             0          0         0     0     0      0           0                0            0         0     0     0      0        0           0
fm1-mac3:    0             0          0         0     0     0      0           0                0            0         0     0     0      0        0           0
root@localhost:~# ifconfig fm1-mac9
fm1-mac9: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.137.232  netmask 255.255.255.0  broadcast 192.168.137.255
        inet6 fe80::b0a6:c0ff:fe40:c856  prefixlen 64  scopeid 0x20<link>
        ether b2:a6:c0:40:c8:56  txqueuelen 1000  (Ethernet)
        RX packets 234586128  bytes 350488052874 (350.4 GB)
        RX errors 13  dropped 0  overruns 0  frame 0
        TX packets 11094047  bytes 10558881367 (10.5 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0x1af0000-1af0fff
root@localhost:~# ethtool -S fm1-mac9
NIC statistics:
     interrupts [CPU 0]: 1539885
     interrupts [CPU 1]: 5906456
     interrupts [CPU 2]: 1967002
     interrupts [CPU 3]: 1482796
     interrupts [TOTAL]: 10896139
     rx packets [CPU 0]: 237646
     rx packets [CPU 1]: 211403121
     rx packets [CPU 2]: 22928202
     rx packets [CPU 3]: 17159
     rx packets [TOTAL]: 234586128
     tx packets [CPU 0]: 4745910
     tx packets [CPU 1]: 5864233
     tx packets [CPU 2]: 449432
     tx packets [CPU 3]: 34472
     tx packets [TOTAL]: 11094047
     tx recycled [CPU 0]: 0
     tx recycled [CPU 1]: 0
     tx recycled [CPU 2]: 0
     tx recycled [CPU 3]: 0
     tx recycled [TOTAL]: 0
     tx confirm [CPU 0]: 2959898
     tx confirm [CPU 1]: 1984642
     tx confirm [CPU 2]: 3012846
     tx confirm [CPU 3]: 3136661
     tx confirm [TOTAL]: 11094047
     tx S/G [CPU 0]: 4740665
     tx S/G [CPU 1]: 2030983
     tx S/G [CPU 2]: 18979
     tx S/G [CPU 3]: 30953
     tx S/G [TOTAL]: 6821580
     rx S/G [CPU 0]: 0
     rx S/G [CPU 1]: 0
     rx S/G [CPU 2]: 0
     rx S/G [CPU 3]: 0
     rx S/G [TOTAL]: 0
     tx error [CPU 0]: 0
     tx error [CPU 1]: 0
     tx error [CPU 2]: 0
     tx error [CPU 3]: 0
     tx error [TOTAL]: 0
     rx error [CPU 0]: 8
     rx error [CPU 1]: 0
     rx error [CPU 2]: 0
     rx error [CPU 3]: 5
     rx error [TOTAL]: 13
     bp count [CPU 0]: 90
     bp count [CPU 1]: 87
     bp count [CPU 2]: 118
     bp count [CPU 3]: 121
     bp count [TOTAL]: 416
     rx dma error: 0
     rx frame physical error: 13
     rx frame size error: 0
     rx header error: 0
     rx csum error: 0
     qman cg_tdrop: 0
     qman wred: 0
     qman error cond: 0
     qman early window: 0
     qman late window: 0
     qman fq tdrop: 0
     qman fq retired: 0
     qman orp disabled: 0
     congestion time (ms): 0
     entered congestion: 0
     congested (0/1): 0