prometheus-node-exporter-lua: check if status is nil before processing wifi device metrics interfaces

Signed-off-by: Jun Ouyang <ouyangjun1999@gmail.com>
This commit is contained in:
Jun Ouyang
2025-10-11 11:19:25 +08:00
committed by Etienne Champetier
parent 7d9cc2e95a
commit f39d51b14c
3 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=prometheus-node-exporter-lua PKG_NAME:=prometheus-node-exporter-lua
PKG_VERSION:=2026.05.09 PKG_VERSION:=2026.05.10
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com> PKG_MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
@@ -10,6 +10,10 @@ local function scrape()
local u = ubus.connect() local u = ubus.connect()
local status = u:call("network.wireless", "status", {}) local status = u:call("network.wireless", "status", {})
if not status then
return
end
for dev, dev_table in pairs(status) do for dev, dev_table in pairs(status) do
for _, intf in ipairs(dev_table['interfaces']) do for _, intf in ipairs(dev_table['interfaces']) do
local ifname = intf['ifname'] local ifname = intf['ifname']
@@ -23,6 +23,10 @@ local function scrape()
local u = ubus.connect() local u = ubus.connect()
local status = u:call("network.wireless", "status", {}) local status = u:call("network.wireless", "status", {})
if not status then
return
end
for dev, dev_table in pairs(status) do for dev, dev_table in pairs(status) do
for _, intf in ipairs(dev_table['interfaces']) do for _, intf in ipairs(dev_table['interfaces']) do
local ifname = intf['ifname'] local ifname = intf['ifname']