accesspoints: expose airtime information
parent
23dba0c340
commit
01c9fa2317
|
@ -7,6 +7,9 @@ local function scrape()
|
|||
local metric_wifi_network_noise = metric("wifi_network_noise_dbm","gauge")
|
||||
local metric_wifi_network_signal = metric("wifi_network_signal_dbm","gauge")
|
||||
local metric_wifi_clients = metric("wifi_network_clients", "gauge")
|
||||
local metric_wifi_airtime_total = metric("wifi_network_airtime_total", "gauge")
|
||||
local metric_wifi_airtime_busy = metric("wifi_network_airtime_busy", "gauge")
|
||||
local metric_wifi_airtime_utilization = metric("wifi_network_airtime_utilization", "gauge")
|
||||
|
||||
local u = ubus.connect()
|
||||
local status = u:call("network.wireless", "status", {})
|
||||
|
@ -19,7 +22,7 @@ local function scrape()
|
|||
local labels = {
|
||||
channel = iw.channel(ifname),
|
||||
ssid = iw.ssid(ifname),
|
||||
bssid = iw.bssid(ifname),
|
||||
bssid = string.lower(iw.bssid(ifname)),
|
||||
mode = iw.mode(ifname),
|
||||
ifname = ifname,
|
||||
country = iw.country(ifname),
|
||||
|
@ -37,11 +40,16 @@ local function scrape()
|
|||
local wifi_clients = 0
|
||||
for _ in pairs(iw.assoclist(ifname)) do wifi_clients = wifi_clients +1 end
|
||||
|
||||
local hostapd_status = u:call("hostapd." .. ifname, "get_status", {})
|
||||
|
||||
metric_wifi_network_quality(labels, quality)
|
||||
metric_wifi_network_noise(labels, iw.noise(ifname) or 0)
|
||||
metric_wifi_network_bitrate(labels, iw.bitrate(ifname) or 0)
|
||||
metric_wifi_network_signal(labels, iw.signal(ifname) or -255)
|
||||
metric_wifi_clients(labels, wifi_clients)
|
||||
metric_wifi_airtime_total(labels, hostapd_status.airtime.time)
|
||||
metric_wifi_airtime_busy(labels, hostapd_status.airtime.time_busy)
|
||||
metric_wifi_airtime_utilization(labels, hostapd_status.airtime.utilization)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,6 +12,16 @@
|
|||
notify:
|
||||
- "reload {{ item | basename }}"
|
||||
|
||||
- name: distribute custom wifi.lua
|
||||
copy:
|
||||
src: files/wifi.lua
|
||||
dest: /usr/lib/lua/prometheus-collectors/wifi.lua
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0744
|
||||
notify:
|
||||
- restart prometheus-node-exporter-lua
|
||||
|
||||
handlers:
|
||||
- name: reload network
|
||||
service:
|
||||
|
@ -32,3 +42,8 @@
|
|||
service:
|
||||
name: lldpd
|
||||
state: reloaded
|
||||
|
||||
- name: restart prometheus-node-exporter-lua
|
||||
service:
|
||||
name: prometheus-node-exporter-lua
|
||||
state: restarted
|
||||
|
|
Loading…
Reference in New Issue