Skip to content

Commit 9a80414

Browse files
committed
fix: check if status is nil before processing interfaces in prometheus-node-exporter-lua
1 parent 9bfc5a2 commit 9a80414

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/wifi.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ local function scrape()
1010
local u = ubus.connect()
1111
local status = u:call("network.wireless", "status", {})
1212

13+
if not status then
14+
return
15+
end
16+
1317
for dev, dev_table in pairs(status) do
1418
for _, intf in ipairs(dev_table['interfaces']) do
1519
local ifname = intf['ifname']

utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/wifi_stations.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ local function scrape()
2323
local u = ubus.connect()
2424
local status = u:call("network.wireless", "status", {})
2525

26+
if not status then
27+
return
28+
end
29+
2630
for dev, dev_table in pairs(status) do
2731
for _, intf in ipairs(dev_table['interfaces']) do
2832
local ifname = intf['ifname']

0 commit comments

Comments
 (0)