From 4795fc4a506e59be80330061088e50fe7a0958bc Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 28 Jul 2014 00:58:07 +0200 Subject: [PATCH] gluon-mesh-batman-adv: use lua-ethtool-stats instead of ethtool --- package/gluon-announce/Makefile | 2 +- .../files/lib/gluon/announce/statistics.d/traffic | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/package/gluon-announce/Makefile b/package/gluon-announce/Makefile index 81c35dfc..3f62c889 100644 --- a/package/gluon-announce/Makefile +++ b/package/gluon-announce/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/package.mk define Package/gluon-announce SECTION:=gluon CATEGORY:=Gluon - DEPENDS:=+gluon-core +luci-lib-json +ethtool + DEPENDS:=+gluon-core +luci-lib-json +lua-ethtool-stats TITLE:=Lua scripts announcing various information endef diff --git a/package/gluon-mesh-batman-adv/files/lib/gluon/announce/statistics.d/traffic b/package/gluon-mesh-batman-adv/files/lib/gluon/announce/statistics.d/traffic index 378125e5..01f6b4ab 100644 --- a/package/gluon-mesh-batman-adv/files/lib/gluon/announce/statistics.d/traffic +++ b/package/gluon-mesh-batman-adv/files/lib/gluon/announce/statistics.d/traffic @@ -1,9 +1,6 @@ -local ethtool = util.exec('ethtool -S bat0') +local ethtool = require 'ethtool_stats' -local fields = {} -for k, v in ethtool:gmatch('([%a_]+): ([0-9]+)') do - fields[k] = tonumber(v) -end +local fields = ethtool.interface_stats('bat0') local traffic = {} for _, class in ipairs({'rx', 'tx', 'forward', 'mgmt_rx', 'mgmt_tx'}) do