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:
parent
6d85547f24
commit
0a9d2b818d
1 changed files with 3 additions and 1 deletions
|
@ -129,9 +129,11 @@ local function scrape()
|
||||||
current_station_values = {}
|
current_station_values = {}
|
||||||
else
|
else
|
||||||
local name, value = string.match(line, "(.+)=(.+)")
|
local name, value = string.match(line, "(.+)=(.+)")
|
||||||
|
if name ~= nil then
|
||||||
current_station_values[name] = value
|
current_station_values[name] = value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
labels.station = current_station
|
labels.station = current_station
|
||||||
evaluate_metrics(labels, current_station_values)
|
evaluate_metrics(labels, current_station_values)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue