This commit is contained in:
Bouke van der Bijl 2025-08-19 16:53:19 +02:00 committed by GitHub
commit 2cba8c59b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 58 additions and 10 deletions

View file

@ -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
@ -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 hasnt been fully acquired before use
# TYPE node_xfrm_acquire_error_packets_total counter
node_xfrm_acquire_error_packets_total 24532

View file

@ -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
@ -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 hasnt been fully acquired before use
# TYPE node_xfrm_acquire_error_packets_total counter
node_xfrm_acquire_error_packets_total 24532

View file

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