Browse Source

prometheus-node-exporter-lua: handle empty lines in all_sta output correctly

An empty line has a name and value that is nil and setting a table
index to nil breaks metrics for every vif after the first one.

Signed-off-by: Martin Weinelt <hexa@darmstadt.ccc.de>
lilik-openwrt-22.03
Martin Weinelt 4 years ago
committed by Etienne Champetier
parent
commit
0a9d2b818d
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/hostapd_stations.lua

+ 3
- 1
utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/hostapd_stations.lua View File

@ -129,7 +129,9 @@ local function scrape()
current_station_values = {}
else
local name, value = string.match(line, "(.+)=(.+)")
current_station_values[name] = value
if name ~= nil then
current_station_values[name] = value
end
end
end
labels.station = current_station


Loading…
Cancel
Save