Unexport wifiCollector metrics
This commit is contained in:
parent
edf1630f93
commit
42c8a20545
|
@ -27,17 +27,17 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type wifiCollector struct {
|
type wifiCollector struct {
|
||||||
InterfaceFrequencyHertz *prometheus.Desc
|
interfaceFrequencyHertz *prometheus.Desc
|
||||||
StationInfo *prometheus.Desc
|
stationInfo *prometheus.Desc
|
||||||
|
|
||||||
StationConnectedSecondsTotal *prometheus.Desc
|
stationConnectedSecondsTotal *prometheus.Desc
|
||||||
StationInactiveSeconds *prometheus.Desc
|
stationInactiveSeconds *prometheus.Desc
|
||||||
StationReceiveBitsPerSecond *prometheus.Desc
|
stationReceiveBitsPerSecond *prometheus.Desc
|
||||||
StationTransmitBitsPerSecond *prometheus.Desc
|
stationTransmitBitsPerSecond *prometheus.Desc
|
||||||
StationSignalDBM *prometheus.Desc
|
stationSignalDBM *prometheus.Desc
|
||||||
StationTransmitRetriesTotal *prometheus.Desc
|
stationTransmitRetriesTotal *prometheus.Desc
|
||||||
StationTransmitFailedTotal *prometheus.Desc
|
stationTransmitFailedTotal *prometheus.Desc
|
||||||
StationBeaconLossTotal *prometheus.Desc
|
stationBeaconLossTotal *prometheus.Desc
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -69,70 +69,70 @@ func NewWifiCollector() (Collector, error) {
|
||||||
)
|
)
|
||||||
|
|
||||||
return &wifiCollector{
|
return &wifiCollector{
|
||||||
InterfaceFrequencyHertz: prometheus.NewDesc(
|
interfaceFrequencyHertz: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "interface_frequency_hertz"),
|
prometheus.BuildFQName(Namespace, subsystem, "interface_frequency_hertz"),
|
||||||
"The current frequency a WiFi interface is operating at, in hertz.",
|
"The current frequency a WiFi interface is operating at, in hertz.",
|
||||||
labels,
|
labels,
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
|
|
||||||
StationInfo: prometheus.NewDesc(
|
stationInfo: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "station_info"),
|
prometheus.BuildFQName(Namespace, subsystem, "station_info"),
|
||||||
"Labeled WiFi interface station information as provided by the operating system.",
|
"Labeled WiFi interface station information as provided by the operating system.",
|
||||||
[]string{"device", "bssid", "ssid", "mode"},
|
[]string{"device", "bssid", "ssid", "mode"},
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
|
|
||||||
StationConnectedSecondsTotal: prometheus.NewDesc(
|
stationConnectedSecondsTotal: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "station_connected_seconds_total"),
|
prometheus.BuildFQName(Namespace, subsystem, "station_connected_seconds_total"),
|
||||||
"The total number of seconds a station has been connected to an access point.",
|
"The total number of seconds a station has been connected to an access point.",
|
||||||
labels,
|
labels,
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
|
|
||||||
StationInactiveSeconds: prometheus.NewDesc(
|
stationInactiveSeconds: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "station_inactive_seconds"),
|
prometheus.BuildFQName(Namespace, subsystem, "station_inactive_seconds"),
|
||||||
"The number of seconds since any wireless activity has occurred on a station.",
|
"The number of seconds since any wireless activity has occurred on a station.",
|
||||||
labels,
|
labels,
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
|
|
||||||
StationReceiveBitsPerSecond: prometheus.NewDesc(
|
stationReceiveBitsPerSecond: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "station_receive_bits_per_second"),
|
prometheus.BuildFQName(Namespace, subsystem, "station_receive_bits_per_second"),
|
||||||
"The current WiFi receive bitrate of a station, in bits per second.",
|
"The current WiFi receive bitrate of a station, in bits per second.",
|
||||||
labels,
|
labels,
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
|
|
||||||
StationTransmitBitsPerSecond: prometheus.NewDesc(
|
stationTransmitBitsPerSecond: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "station_transmit_bits_per_second"),
|
prometheus.BuildFQName(Namespace, subsystem, "station_transmit_bits_per_second"),
|
||||||
"The current WiFi transmit bitrate of a station, in bits per second.",
|
"The current WiFi transmit bitrate of a station, in bits per second.",
|
||||||
labels,
|
labels,
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
|
|
||||||
StationSignalDBM: prometheus.NewDesc(
|
stationSignalDBM: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "station_signal_dbm"),
|
prometheus.BuildFQName(Namespace, subsystem, "station_signal_dbm"),
|
||||||
"The current WiFi signal strength, in decibel-milliwatts (dBm).",
|
"The current WiFi signal strength, in decibel-milliwatts (dBm).",
|
||||||
labels,
|
labels,
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
|
|
||||||
StationTransmitRetriesTotal: prometheus.NewDesc(
|
stationTransmitRetriesTotal: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "station_transmit_retries_total"),
|
prometheus.BuildFQName(Namespace, subsystem, "station_transmit_retries_total"),
|
||||||
"The total number of times a station has had to retry while sending a packet.",
|
"The total number of times a station has had to retry while sending a packet.",
|
||||||
labels,
|
labels,
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
|
|
||||||
StationTransmitFailedTotal: prometheus.NewDesc(
|
stationTransmitFailedTotal: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "station_transmit_failed_total"),
|
prometheus.BuildFQName(Namespace, subsystem, "station_transmit_failed_total"),
|
||||||
"The total number of times a station has failed to send a packet.",
|
"The total number of times a station has failed to send a packet.",
|
||||||
labels,
|
labels,
|
||||||
nil,
|
nil,
|
||||||
),
|
),
|
||||||
|
|
||||||
StationBeaconLossTotal: prometheus.NewDesc(
|
stationBeaconLossTotal: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(Namespace, subsystem, "station_beacon_loss_total"),
|
prometheus.BuildFQName(Namespace, subsystem, "station_beacon_loss_total"),
|
||||||
"The total number of times a station has detected a beacon loss.",
|
"The total number of times a station has detected a beacon loss.",
|
||||||
labels,
|
labels,
|
||||||
|
@ -166,7 +166,7 @@ func (c *wifiCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.InterfaceFrequencyHertz,
|
c.interfaceFrequencyHertz,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
mHzToHz(ifi.Frequency),
|
mHzToHz(ifi.Frequency),
|
||||||
ifi.Name,
|
ifi.Name,
|
||||||
|
@ -184,7 +184,7 @@ func (c *wifiCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
|
|
||||||
// Synthetic metric which provides WiFi station info, such as SSID, BSSID, etc.
|
// Synthetic metric which provides WiFi station info, such as SSID, BSSID, etc.
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.StationInfo,
|
c.stationInfo,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
1,
|
1,
|
||||||
ifi.Name,
|
ifi.Name,
|
||||||
|
@ -211,56 +211,56 @@ func (c *wifiCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
|
|
||||||
func (c *wifiCollector) updateStationStats(ch chan<- prometheus.Metric, device string, info *wifi.StationInfo) {
|
func (c *wifiCollector) updateStationStats(ch chan<- prometheus.Metric, device string, info *wifi.StationInfo) {
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.StationConnectedSecondsTotal,
|
c.stationConnectedSecondsTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
info.Connected.Seconds(),
|
info.Connected.Seconds(),
|
||||||
device,
|
device,
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.StationInactiveSeconds,
|
c.stationInactiveSeconds,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
info.Inactive.Seconds(),
|
info.Inactive.Seconds(),
|
||||||
device,
|
device,
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.StationReceiveBitsPerSecond,
|
c.stationReceiveBitsPerSecond,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(info.ReceiveBitrate),
|
float64(info.ReceiveBitrate),
|
||||||
device,
|
device,
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.StationTransmitBitsPerSecond,
|
c.stationTransmitBitsPerSecond,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(info.TransmitBitrate),
|
float64(info.TransmitBitrate),
|
||||||
device,
|
device,
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.StationSignalDBM,
|
c.stationSignalDBM,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(info.Signal),
|
float64(info.Signal),
|
||||||
device,
|
device,
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.StationTransmitRetriesTotal,
|
c.stationTransmitRetriesTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(info.TransmitRetries),
|
float64(info.TransmitRetries),
|
||||||
device,
|
device,
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.StationTransmitFailedTotal,
|
c.stationTransmitFailedTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(info.TransmitFailed),
|
float64(info.TransmitFailed),
|
||||||
device,
|
device,
|
||||||
)
|
)
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.StationBeaconLossTotal,
|
c.stationBeaconLossTotal,
|
||||||
prometheus.CounterValue,
|
prometheus.CounterValue,
|
||||||
float64(info.BeaconLoss),
|
float64(info.BeaconLoss),
|
||||||
device,
|
device,
|
||||||
|
|
Loading…
Reference in New Issue