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>
This commit is contained in:
Martin Weinelt 2021-06-24 17:50:01 +02:00 committed by Etienne Champetier
parent 6d85547f24
commit 0a9d2b818d
1 changed files with 3 additions and 1 deletions

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