Quellcode durchsuchen

gluon-mesh-batman-adv: use lua-ethtool-stats instead of ethtool

Matthias Schiffer vor 10 Jahren
Ursprung
Commit
4795fc4a50

+ 1 - 1
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
 

+ 2 - 5
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