Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions collector/fixtures/e2e-64k-page-output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3356,6 +3356,10 @@ node_wifi_station_receive_bits_per_second{device="wlan0",mac_address="aa:bb:cc:d
# TYPE node_wifi_station_receive_bytes_total counter
node_wifi_station_receive_bytes_total{device="wlan0",mac_address="01:02:03:04:05:06"} 0
node_wifi_station_receive_bytes_total{device="wlan0",mac_address="aa:bb:cc:dd:ee:ff"} 0
# HELP node_wifi_station_received_packets_total The total number of packets received by a station.
# TYPE node_wifi_station_received_packets_total counter
node_wifi_station_received_packets_total{device="wlan0",mac_address="01:02:03:04:05:06"} 0
node_wifi_station_received_packets_total{device="wlan0",mac_address="aa:bb:cc:dd:ee:ff"} 0
# HELP node_wifi_station_signal_dbm The current WiFi signal strength, in decibel-milliwatts (dBm).
# TYPE node_wifi_station_signal_dbm gauge
node_wifi_station_signal_dbm{device="wlan0",mac_address="01:02:03:04:05:06"} -26
Expand All @@ -3376,6 +3380,10 @@ node_wifi_station_transmit_failed_total{device="wlan0",mac_address="aa:bb:cc:dd:
# TYPE node_wifi_station_transmit_retries_total counter
node_wifi_station_transmit_retries_total{device="wlan0",mac_address="01:02:03:04:05:06"} 20
node_wifi_station_transmit_retries_total{device="wlan0",mac_address="aa:bb:cc:dd:ee:ff"} 10
# HELP node_wifi_station_transmitted_packets_total The total number of packets transmitted by a station.
# TYPE node_wifi_station_transmitted_packets_total counter
node_wifi_station_transmitted_packets_total{device="wlan0",mac_address="01:02:03:04:05:06"} 0
node_wifi_station_transmitted_packets_total{device="wlan0",mac_address="aa:bb:cc:dd:ee:ff"} 0
# HELP node_xfrm_acquire_error_packets_total State hasn’t been fully acquired before use
# TYPE node_xfrm_acquire_error_packets_total counter
node_xfrm_acquire_error_packets_total 24532
Expand Down
8 changes: 8 additions & 0 deletions collector/fixtures/e2e-output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3378,6 +3378,10 @@ node_wifi_station_receive_bits_per_second{device="wlan0",mac_address="aa:bb:cc:d
# TYPE node_wifi_station_receive_bytes_total counter
node_wifi_station_receive_bytes_total{device="wlan0",mac_address="01:02:03:04:05:06"} 0
node_wifi_station_receive_bytes_total{device="wlan0",mac_address="aa:bb:cc:dd:ee:ff"} 0
# HELP node_wifi_station_received_packets_total The total number of packets received by a station.
# TYPE node_wifi_station_received_packets_total counter
node_wifi_station_received_packets_total{device="wlan0",mac_address="01:02:03:04:05:06"} 0
node_wifi_station_received_packets_total{device="wlan0",mac_address="aa:bb:cc:dd:ee:ff"} 0
# HELP node_wifi_station_signal_dbm The current WiFi signal strength, in decibel-milliwatts (dBm).
# TYPE node_wifi_station_signal_dbm gauge
node_wifi_station_signal_dbm{device="wlan0",mac_address="01:02:03:04:05:06"} -26
Expand All @@ -3398,6 +3402,10 @@ node_wifi_station_transmit_failed_total{device="wlan0",mac_address="aa:bb:cc:dd:
# TYPE node_wifi_station_transmit_retries_total counter
node_wifi_station_transmit_retries_total{device="wlan0",mac_address="01:02:03:04:05:06"} 20
node_wifi_station_transmit_retries_total{device="wlan0",mac_address="aa:bb:cc:dd:ee:ff"} 10
# HELP node_wifi_station_transmitted_packets_total The total number of packets transmitted by a station.
# TYPE node_wifi_station_transmitted_packets_total counter
node_wifi_station_transmitted_packets_total{device="wlan0",mac_address="01:02:03:04:05:06"} 0
node_wifi_station_transmitted_packets_total{device="wlan0",mac_address="aa:bb:cc:dd:ee:ff"} 0
# HELP node_xfrm_acquire_error_packets_total State hasn’t been fully acquired before use
# TYPE node_xfrm_acquire_error_packets_total counter
node_xfrm_acquire_error_packets_total 24532
Expand Down
52 changes: 42 additions & 10 deletions collector/wifi_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,18 @@ type wifiCollector struct {
interfaceFrequencyHertz *prometheus.Desc
stationInfo *prometheus.Desc

stationConnectedSecondsTotal *prometheus.Desc
stationInactiveSeconds *prometheus.Desc
stationReceiveBitsPerSecond *prometheus.Desc
stationTransmitBitsPerSecond *prometheus.Desc
stationReceiveBytesTotal *prometheus.Desc
stationTransmitBytesTotal *prometheus.Desc
stationSignalDBM *prometheus.Desc
stationTransmitRetriesTotal *prometheus.Desc
stationTransmitFailedTotal *prometheus.Desc
stationBeaconLossTotal *prometheus.Desc
stationConnectedSecondsTotal *prometheus.Desc
stationInactiveSeconds *prometheus.Desc
stationReceiveBitsPerSecond *prometheus.Desc
stationTransmitBitsPerSecond *prometheus.Desc
stationReceiveBytesTotal *prometheus.Desc
stationTransmitBytesTotal *prometheus.Desc
stationSignalDBM *prometheus.Desc
stationTransmitRetriesTotal *prometheus.Desc
stationTransmitFailedTotal *prometheus.Desc
stationBeaconLossTotal *prometheus.Desc
stationTransmittedPacketsTotal *prometheus.Desc
stationReceivedPacketsTotal *prometheus.Desc

logger *slog.Logger
}
Expand Down Expand Up @@ -159,6 +161,20 @@ func NewWifiCollector(logger *slog.Logger) (Collector, error) {
labels,
nil,
),

stationTransmittedPacketsTotal: prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "station_transmitted_packets_total"),
"The total number of packets transmitted by a station.",
labels,
nil,
),

stationReceivedPacketsTotal: prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "station_received_packets_total"),
"The total number of packets received by a station.",
labels,
nil,
),
logger: logger,
}, nil
}
Expand Down Expand Up @@ -325,6 +341,22 @@ func (c *wifiCollector) updateStationStats(ch chan<- prometheus.Metric, device s
device,
info.HardwareAddr.String(),
)

ch <- prometheus.MustNewConstMetric(
c.stationTransmittedPacketsTotal,
prometheus.CounterValue,
float64(info.TransmittedPackets),
device,
info.HardwareAddr.String(),
)

ch <- prometheus.MustNewConstMetric(
c.stationReceivedPacketsTotal,
prometheus.CounterValue,
float64(info.ReceivedPackets),
device,
info.HardwareAddr.String(),
)
}

func mHzToHz(mHz int) float64 {
Expand Down