prometheus-node-exporter-lua: an unavaliable wifi interface may have stopped the scraper from functioning

Signed-off-by: Zoltan Haindrich <kirk@rxd.hu>
(cherry picked from commit 7bec619f53)
This commit is contained in:
Zoltan Haindrich 2019-10-04 15:43:50 +00:00 committed by Etienne Champetier
parent 0e69b14733
commit 928915f4a6
2 changed files with 58 additions and 54 deletions

View file

@ -13,6 +13,7 @@ local function scrape()
for dev, dev_table in pairs(status) do
for _, intf in ipairs(dev_table['interfaces']) do
local ifname = intf['ifname']
if ifname ~= nil then
local iw = iwinfo[iwinfo.type(ifname)]
local labels = {
channel = iw.channel(ifname),
@ -38,6 +39,7 @@ local function scrape()
metric_wifi_network_signal(labels, iw.signal(ifname) or -255)
end
end
end
end
return { scrape = scrape }

View file

@ -26,6 +26,7 @@ local function scrape()
for dev, dev_table in pairs(status) do
for _, intf in ipairs(dev_table['interfaces']) do
local ifname = intf['ifname']
if ifname ~= nil then
local iw = iwinfo[iwinfo.type(ifname)]
local count = 0
@ -64,6 +65,7 @@ local function scrape()
metric_wifi_stations({ifname = ifname}, count)
end
end
end
end
return { scrape = scrape }