诸如MRTG之类的工具为特定接口上的当前网络利用率提供网络吞吐量/带宽图,例如eth0。在Linux/UNIX上,如何在命令行中返回该信息?
优选地,这将不需要安装系统上作为标准可用之外的任何东西。
发布于 2009-02-27 20:45:31
您可以解析ifconfig
的输出
发布于 2009-03-23 17:29:28
iftop does for network usage what top(1) does for CPU usage
-- http://www.ex-parrot.com/~pdw/iftop/
我不知道iftop有多“标准”,但我可以在Fedora上用yum install iftop
安装它。
发布于 2010-10-28 03:04:45
找到sar了吗?如果您使用的是RHEL/CentOS,很可能是这样的。
不需要priv,愚蠢的二进制文件,hacky脚本,libpcap等。
$ sar -n DEV 1 3
Linux 2.6.18-194.el5 (localhost.localdomain) 10/27/2010
02:40:56 PM IFACE rxpck/s txpck/s rxbyt/s txbyt/s rxcmp/s txcmp/s rxmcst/s
02:40:57 PM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:40:57 PM eth0 10700.00 1705.05 15860765.66 124250.51 0.00 0.00 0.00
02:40:57 PM eth1 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:40:57 PM IFACE rxpck/s txpck/s rxbyt/s txbyt/s rxcmp/s txcmp/s rxmcst/s
02:40:58 PM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:40:58 PM eth0 8051.00 1438.00 11849206.00 105356.00 0.00 0.00 0.00
02:40:58 PM eth1 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:40:58 PM IFACE rxpck/s txpck/s rxbyt/s txbyt/s rxcmp/s txcmp/s rxmcst/s
02:40:59 PM lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:40:59 PM eth0 6093.00 1135.00 8970988.00 82942.00 0.00 0.00 0.00
02:40:59 PM eth1 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: IFACE rxpck/s txpck/s rxbyt/s txbyt/s rxcmp/s txcmp/s rxmcst/s
Average: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: eth0 8273.24 1425.08 12214833.44 104115.72 0.00 0.00 0.00
Average: eth1 0.00 0.00 0.00 0.00 0.00 0.00 0.00
https://stackoverflow.com/questions/596590
复制相似问题