Add receive/transmit bytes total metric (wifi collector). (#1150)
Signed-off-by: Nemikolh <Nemikolh@users.noreply.github.com>
This commit is contained in:
parent
17fee8081f
commit
62f99f95f0
4 changed files with 49 additions and 0 deletions
|
|
@ -34,6 +34,8 @@ type wifiCollector struct {
|
|||
stationInactiveSeconds *prometheus.Desc
|
||||
stationReceiveBitsPerSecond *prometheus.Desc
|
||||
stationTransmitBitsPerSecond *prometheus.Desc
|
||||
stationReceiveBytesTotal *prometheus.Desc
|
||||
stationTransmitBytesTotal *prometheus.Desc
|
||||
stationSignalDBM *prometheus.Desc
|
||||
stationTransmitRetriesTotal *prometheus.Desc
|
||||
stationTransmitFailedTotal *prometheus.Desc
|
||||
|
|
@ -111,6 +113,20 @@ func NewWifiCollector() (Collector, error) {
|
|||
nil,
|
||||
),
|
||||
|
||||
stationReceiveBytesTotal: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(namespace, subsystem, "station_receive_bytes_total"),
|
||||
"The total number of bytes received by a WiFi station.",
|
||||
labels,
|
||||
nil,
|
||||
),
|
||||
|
||||
stationTransmitBytesTotal: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(namespace, subsystem, "station_transmit_bytes_total"),
|
||||
"The total number of bytes transmitted by a WiFi station.",
|
||||
labels,
|
||||
nil,
|
||||
),
|
||||
|
||||
stationSignalDBM: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(namespace, subsystem, "station_signal_dbm"),
|
||||
"The current WiFi signal strength, in decibel-milliwatts (dBm).",
|
||||
|
|
@ -256,6 +272,22 @@ func (c *wifiCollector) updateStationStats(ch chan<- prometheus.Metric, device s
|
|||
info.HardwareAddr.String(),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.stationReceiveBytesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(info.ReceivedBytes),
|
||||
device,
|
||||
info.HardwareAddr.String(),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.stationTransmitBytesTotal,
|
||||
prometheus.CounterValue,
|
||||
float64(info.TransmittedBytes),
|
||||
device,
|
||||
info.HardwareAddr.String(),
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.stationSignalDBM,
|
||||
prometheus.GaugeValue,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue