计算网络带宽利用率:
$$
\mathrm{Utilization} = \frac{\mathrm{Receive + Transmit}}{\mathrm{Speed}}
$$
查看网卡带宽:
1 | cat /sys/class/net/<NIC>/speed |
查看网卡的流量:
1 | cat /proc/net/dev |
脚本:
1 | cat /proc/net/dev | grep "ens5p0" | awk '{printf "%s %s %s\n", '`date +x%s`', $2, $10}' >> net.txt |