From: Martin Weinelt Date: Thu, 24 Jun 2021 15:50:01 +0000 (+0200) Subject: prometheus-node-exporter-lua: handle empty lines in all_sta output correctly X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=0a9d2b818d4c0d6c1c8df59fde9808bae6ddb72d;p=feed%2Fpackages.git 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 --- 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 9c56e586cf..39d1415cc8 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