ethtool 能否提供 NIC 上的当前传入比特率
Can ethtool provide the current incoming bitrate on a NIC
linux 的 ethtool 命令中是否有一个选项可以直接从 NIC 检索当前传入比特率或每秒数据包数?
不是按每秒数据包,而是总体 RX/TX。
你可以围绕它写一个脚本:
ethtool -S <interface>
例如,目前我的 wifi 不错:
[user@host ~]$ ethtool -S wlo1
NIC statistics:
rx_packets: 992535
rx_bytes: 1010899932
rx_duplicates: 3206
rx_fragments: 878057
rx_dropped: 4367
tx_packets: 363876
tx_bytes: 49823636
tx_filtered: 1
tx_retry_failed: 6567
tx_retries: 160017
sta_state: 4
txrate: 40500000
rxrate: 54000000
signal: 181
channel: 0
noise: 18446744073709551615
ch_time: 18446744073709551615
ch_time_busy: 18446744073709551615
ch_time_ext_busy: 18446744073709551615
ch_time_rx: 18446744073709551615
ch_time_tx: 18446744073709551615
可以从中提取相同的信息:
- /sys/class/net//statistics/rx_packets: number of packets received
- /sys/class/net//statistics/tx_packets: number of packets transmitted
- /sys/class/net//statistics/rx_bytes: number of bytes received
- /sys/class/net//statistics/tx_bytes: number of bytes transmitted
- /sys/class/net//statistics/rx_dropped: number of packets dropped while received
- /sys/class/net//statistics/tx_dropped: number of packets dropped while transmitted
有关特定的实时解决方案,另请参阅 superuser.com。
linux 的 ethtool 命令中是否有一个选项可以直接从 NIC 检索当前传入比特率或每秒数据包数?
不是按每秒数据包,而是总体 RX/TX。 你可以围绕它写一个脚本:
ethtool -S <interface>
例如,目前我的 wifi 不错:
[user@host ~]$ ethtool -S wlo1
NIC statistics:
rx_packets: 992535
rx_bytes: 1010899932
rx_duplicates: 3206
rx_fragments: 878057
rx_dropped: 4367
tx_packets: 363876
tx_bytes: 49823636
tx_filtered: 1
tx_retry_failed: 6567
tx_retries: 160017
sta_state: 4
txrate: 40500000
rxrate: 54000000
signal: 181
channel: 0
noise: 18446744073709551615
ch_time: 18446744073709551615
ch_time_busy: 18446744073709551615
ch_time_ext_busy: 18446744073709551615
ch_time_rx: 18446744073709551615
ch_time_tx: 18446744073709551615
可以从中提取相同的信息:
- /sys/class/net//statistics/rx_packets: number of packets received
- /sys/class/net//statistics/tx_packets: number of packets transmitted
- /sys/class/net//statistics/rx_bytes: number of bytes received
- /sys/class/net//statistics/tx_bytes: number of bytes transmitted
- /sys/class/net//statistics/rx_dropped: number of packets dropped while received
- /sys/class/net//statistics/tx_dropped: number of packets dropped while transmitted
有关特定的实时解决方案,另请参阅 superuser.com。