From: Michael Tremer Date: Wed, 22 Oct 2025 17:50:29 +0000 (+0000) Subject: sources: hostapd: Migrate to new metrics submission X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cfbab8979487d588c5328d497f4dae4ad94221c4;p=telemetry.git sources: hostapd: Migrate to new metrics submission Signed-off-by: Michael Tremer --- diff --git a/src/daemon/sources/hostapd.c b/src/daemon/sources/hostapd.c index 9601f98..451b577 100644 --- a/src/daemon/sources/hostapd.c +++ b/src/daemon/sources/hostapd.c @@ -98,13 +98,24 @@ static int hostapd_submit_station(td_ctx* ctx, hostapd_station* station) { } // Submit the station - return td_source_submit(station->source, address, - "%lu:%lu:%ld:%ld:%lu:%lu:%lu:%lu:%lu:%lu:%lu:%lu:%lu:%lu:%lu:%lu", - station->connected_time, station->inactive_msec, - station->signal, station->last_ack_signal, - station->rx_packets, station->tx_packets, station->rx_bytes, station->tx_bytes, - station->rx_rate * 100 * 1024, station->rx_mcs, station->rx_vhtmcs, station->rx_vhtnss, - station->tx_rate * 100 * 1024, station->tx_mcs, station->tx_vhtmcs, station->tx_vhtnss); + return td_source_submit_values(station->source, address, VALUES( + VALUE_UINT64("connected_time", &station->connected_time), + VALUE_UINT64("inactive_msec", &station->inactive_msec), + VALUE_INT64 ("signal", &station->signal), + VALUE_INT64 ("last_ack_signal", &station->last_ack_signal), + VALUE_UINT64("rx_packets", &station->rx_packets), + VALUE_UINT64("tx_packets", &station->tx_packets), + VALUE_UINT64("rx_bytes", &station->rx_bytes), + VALUE_UINT64("tx_bytes", &station->tx_bytes), + VALUE_UINT64("rx_rate", &station->rx_rate), + VALUE_UINT64("rx_mcs", &station->rx_mcs), + VALUE_UINT64("rx_vhtmcs", &station->rx_vhtmcs), + VALUE_UINT64("rx_vhtnss", &station->rx_vhtnss), + VALUE_UINT64("tx_rate", &station->tx_rate), + VALUE_UINT64("tx_mcs", &station->tx_mcs), + VALUE_UINT64("tx_vhtmcs", &station->tx_vhtmcs), + VALUE_UINT64("tx_vhtnss", &station->tx_vhtnss) + )); } static int hostapd_parse(td_ctx* ctx, td_file* stdout, unsigned long lineno, @@ -171,6 +182,10 @@ static int hostapd_parse(td_ctx* ctx, td_file* stdout, unsigned long lineno, { NULL }, }; + // Convert the RX/TX rate to bit/s + station->rx_rate *= 100 * 1024; + station->tx_rate *= 100 * 1024; + // Try parsing the line return td_file_parse_line(stdout, parser, line, length); }