prometheus-node-exporter-lua-hostapd_stations: fix not reporting metrics

- fix incorrect interface name mapping in hostapd_stations exporter

Signed-off-by: Balázs Urbán <szalab9@gmail.com>
This commit is contained in:
Balázs Urbán 2024-03-17 19:59:20 +01:00
parent b8e6c2d4fc
commit 5811155297
1 changed files with 4 additions and 4 deletions

View File

@ -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