|
@ -3,9 +3,22 @@ local iwinfo = require "iwinfo" |
|
|
|
|
|
|
|
|
local function scrape() |
|
|
local function scrape() |
|
|
local metric_wifi_stations = metric("wifi_stations", "gauge") |
|
|
local metric_wifi_stations = metric("wifi_stations", "gauge") |
|
|
|
|
|
|
|
|
local metric_wifi_station_signal = metric("wifi_station_signal_dbm","gauge") |
|
|
local metric_wifi_station_signal = metric("wifi_station_signal_dbm","gauge") |
|
|
local metric_wifi_station_tx_packets = metric("wifi_station_tx_packets_total","counter") |
|
|
|
|
|
local metric_wifi_station_rx_packets = metric("wifi_station_rx_packets_total","counter") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local metric_wifi_station_inactive = metric('wifi_station_inactive_milliseconds', 'gauge') |
|
|
|
|
|
|
|
|
|
|
|
local metric_wifi_station_exp_thr = metric('wifi_station_expected_throughput_kilobits_per_second', 'gauge') |
|
|
|
|
|
|
|
|
|
|
|
local metric_wifi_station_tx_bitrate = metric('wifi_station_transmit_kilobits_per_second', 'gauge') |
|
|
|
|
|
local metric_wifi_station_rx_bitrate = metric('wifi_station_receive_kilobits_per_second', 'gauge') |
|
|
|
|
|
|
|
|
|
|
|
local metric_wifi_station_tx_packets = metric("wifi_station_transmit_packets_total","counter") |
|
|
|
|
|
local metric_wifi_station_rx_packets = metric("wifi_station_receive_packets_total","counter") |
|
|
|
|
|
|
|
|
|
|
|
local metric_wifi_station_tx_bytes = metric('wifi_station_transmit_bytes_total', 'counter') |
|
|
|
|
|
local metric_wifi_station_rx_bytes = metric('wifi_station_receive_bytes_total', 'counter') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local u = ubus.connect() |
|
|
local u = ubus.connect() |
|
|
local status = u:call("network.wireless", "status", {}) |
|
|
local status = u:call("network.wireless", "status", {}) |
|
@ -22,9 +35,30 @@ local function scrape() |
|
|
ifname = ifname, |
|
|
ifname = ifname, |
|
|
mac = mac, |
|
|
mac = mac, |
|
|
} |
|
|
} |
|
|
metric_wifi_station_signal(labels, station.signal) |
|
|
|
|
|
|
|
|
if station.signal and station.signal ~= 0 then |
|
|
|
|
|
metric_wifi_station_signal(labels, station.signal) |
|
|
|
|
|
end |
|
|
|
|
|
if station.inactive then |
|
|
|
|
|
metric_wifi_station_inactive(labels, station.inactive) |
|
|
|
|
|
end |
|
|
|
|
|
if station.expected_throughput and station.expected_throughput ~= 0 then |
|
|
|
|
|
metric_wifi_station_exp_thr(labels, station.expected_throughput) |
|
|
|
|
|
end |
|
|
|
|
|
if station.tx_rate and station.tx_rate ~= 0 then |
|
|
|
|
|
metric_wifi_station_tx_bitrate(labels, station.tx_rate) |
|
|
|
|
|
end |
|
|
|
|
|
if station.rx_rate and station.rx_rate ~= 0 then |
|
|
|
|
|
metric_wifi_station_rx_bitrate(labels, station.rx_rate) |
|
|
|
|
|
end |
|
|
metric_wifi_station_tx_packets(labels, station.tx_packets) |
|
|
metric_wifi_station_tx_packets(labels, station.tx_packets) |
|
|
metric_wifi_station_rx_packets(labels, station.rx_packets) |
|
|
metric_wifi_station_rx_packets(labels, station.rx_packets) |
|
|
|
|
|
if station.tx_bytes then |
|
|
|
|
|
metric_wifi_station_tx_bytes(labels, station.tx_bytes) |
|
|
|
|
|
end |
|
|
|
|
|
if station.rx_bytes then |
|
|
|
|
|
metric_wifi_station_rx_bytes(labels, station.rx_bytes) |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
count = count + 1 |
|
|
count = count + 1 |
|
|
end |
|
|
end |
|
|
metric_wifi_stations({ifname = ifname}, count) |
|
|
metric_wifi_stations({ifname = ifname}, count) |
|
|