From 5811155297f13d88fb6735b428ea6f93b6831cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Urb=C3=A1n?= Date: Sun, 17 Mar 2024 19:59:20 +0100 Subject: [PATCH] prometheus-node-exporter-lua-hostapd_stations: fix not reporting metrics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fix incorrect interface name mapping in hostapd_stations exporter Signed-off-by: Balázs Urbán --- .../lib/lua/prometheus-collectors/hostapd_stations.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 2b97c70523..3f886ef2c0 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 @@ -33,10 +33,10 @@ local function get_wifi_interface_labels() for _, intf in ipairs(dev_table['interfaces']) do local cfg = intf['config'] - if is_ubus_interface(ubus_interfaces, cfg['ifname']) then + if is_ubus_interface(ubus_interfaces, intf['ifname']) then -- Migrate this to ubus interface once it exposes all interesting labels - local handle = io.popen("hostapd_cli -i " .. cfg['ifname'] .." status") + local handle = io.popen("hostapd_cli -i " .. intf['ifname'] .." status") local hostapd_status = handle:read("*a") handle:close() @@ -50,7 +50,7 @@ local function get_wifi_interface_labels() hostapd["channel"] = value -- hostapd gives us all bss on the relevant phy, find the one we're interested in elseif string.match(name, "bss%[%d%]") then - if value == cfg['ifname'] then + if value == intf['ifname'] then bss_idx = tonumber(string.match(name, "bss%[(%d)%]")) end elseif bss_idx >= 0 then @@ -63,7 +63,7 @@ local function get_wifi_interface_labels() end local labels = { - vif = cfg['ifname'], + vif = intf['ifname'], ssid = hostapd['ssid'], bssid = hostapd['bssid'], encryption = cfg['encryption'], -- In a mixed scenario it would be good to know if A or B was used