From 0a9d2b818d4c0d6c1c8df59fde9808bae6ddb72d Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Thu, 24 Jun 2021 17:50:01 +0200 Subject: [PATCH] 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 --- .../usr/lib/lua/prometheus-collectors/hostapd_stations.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/hostapd_stations.lua b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/hostapd_stations.lua index 9c56e586c..39d1415cc 100644 --- a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/hostapd_stations.lua +++ b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/hostapd_stations.lua @@ -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