带宽统计信息/ sys / class / net / eth0 / statistics / rx_bytes有多可靠?

我在https://github.com/Cosmologist/collectd-network-bandwidth-usagefind了这个脚本。

<Plugin exec> Exec user "/tmp/exec-network-bandwidth-usage.sh" "eth0" </Plugin> 

它运行一个bash脚本来检查/ sys / class / net / eth0 / statistics / rx_bytes和tx_bytes。

 #!/bin/bash HOSTNAME="${COLLECTD_HOSTNAME:-`hostname -f`}" INTERVAL="${COLLECTD_INTERVAL:-60}" while sleep "$INTERVAL"; do RX=`cat /sys/class/net/$1/statistics/rx_bytes` TX=`cat /sys/class/net/$1/statistics/tx_bytes` echo "PUTVAL $HOSTNAME/network-bandwidth-usage/if_octets interval=$INTERVAL N:$RX:$TX" done 

我的目标是查看在一个时间段内有多lessMB的stream量被转移。 使用/ sys / class / net / eth0 / statistics / rx_bytes这样的数据来确定我们整个服务器场产生的stream量有多可靠?

我安装了很多我的linux服务器来监视我的通信接口vnstat命令。 这是很容易安装,你得到这个大量的信息。 https://www.howtoforge.com/tutorial/vnstat-network-monitoring-ubuntu/

我想/ sys / class / net / eth0 / statistics是可靠的,但必须存储在监控应用程序中才能提取有用的信息…在我们的系统中安装vnstat时,当系统需要时本身。

我希望它可以是有用的

亲切的问候