case issues with MAC
This commit is contained in:
parent
3be1da246c
commit
8b67fc3c9d
1 changed files with 17 additions and 16 deletions
33
collector.go
33
collector.go
|
@ -141,11 +141,11 @@ var (
|
||||||
promDescWifiApStationBytes = prometheus.NewDesc(
|
promDescWifiApStationBytes = prometheus.NewDesc(
|
||||||
metricPrefix+"wifi_station_bytes",
|
metricPrefix+"wifi_station_bytes",
|
||||||
"total rx/tx bytes",
|
"total rx/tx bytes",
|
||||||
[]string{"bssid", "mac", "dir"}, nil)
|
[]string{"id", "dir"}, nil)
|
||||||
promDescWifiApStationSignal = prometheus.NewDesc(
|
promDescWifiApStationSignal = prometheus.NewDesc(
|
||||||
metricPrefix+"wifi_station_signal",
|
metricPrefix+"wifi_station_signal",
|
||||||
"signal attenuation in dB",
|
"signal attenuation in dB",
|
||||||
[]string{"bssid", "mac"}, nil)
|
[]string{"id"}, nil)
|
||||||
|
|
||||||
promDescLanHostTotal = prometheus.NewDesc(
|
promDescLanHostTotal = prometheus.NewDesc(
|
||||||
metricPrefix+"lan_host_total",
|
metricPrefix+"lan_host_total",
|
||||||
|
@ -197,7 +197,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) {
|
||||||
|
|
||||||
if m, err := c.freebox.GetMetricsSystem(); err == nil {
|
if m, err := c.freebox.GetMetricsSystem(); err == nil {
|
||||||
firmwareVersion = m.FirmwareVersion
|
firmwareVersion = m.FirmwareVersion
|
||||||
mac = m.Mac
|
mac = strings.ToLower(m.Mac)
|
||||||
serial = m.Serial
|
serial = m.Serial
|
||||||
boardName = m.BoardName
|
boardName = m.BoardName
|
||||||
boxFlavor = m.BoxFlavor
|
boxFlavor = m.BoxFlavor
|
||||||
|
@ -339,16 +339,17 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) {
|
||||||
|
|
||||||
for _, bss := range m.Bss {
|
for _, bss := range m.Bss {
|
||||||
phyID := strconv.FormatInt(bss.PhyID, 10)
|
phyID := strconv.FormatInt(bss.PhyID, 10)
|
||||||
|
bssid := strings.ToLower(bss.ID)
|
||||||
ch <- prometheus.MustNewConstMetric(promDescWifiBssInfo, prometheus.GaugeValue, 1,
|
ch <- prometheus.MustNewConstMetric(promDescWifiBssInfo, prometheus.GaugeValue, 1,
|
||||||
bss.ID,
|
bssid,
|
||||||
phyID,
|
phyID,
|
||||||
bss.Status.State,
|
bss.Status.State,
|
||||||
c.toString(bss.Config.Enabled),
|
c.toString(bss.Config.Enabled),
|
||||||
bss.Config.Ssid,
|
bss.Config.Ssid,
|
||||||
c.toString(bss.Config.HideSsid),
|
c.toString(bss.Config.HideSsid),
|
||||||
bss.Config.Encryption)
|
bss.Config.Encryption)
|
||||||
c.collectGauge(ch, bss.Status.StaCount, promDescWifiBssStationTotal, bss.ID, phyID)
|
c.collectGauge(ch, bss.Status.StaCount, promDescWifiBssStationTotal, bssid, phyID)
|
||||||
c.collectGauge(ch, bss.Status.AuthorizedStaCount, promDescWifiBssAuthorizedStationTotal, bss.ID, phyID)
|
c.collectGauge(ch, bss.Status.AuthorizedStaCount, promDescWifiBssAuthorizedStationTotal, bssid, phyID)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, ap := range m.Ap {
|
for _, ap := range m.Ap {
|
||||||
|
@ -393,6 +394,9 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) {
|
||||||
if station.Host != nil && c.toBool(station.Host.Active) {
|
if station.Host != nil && c.toBool(station.Host.Active) {
|
||||||
stationActive = 1
|
stationActive = 1
|
||||||
}
|
}
|
||||||
|
bssid := strings.ToLower(station.Bssid)
|
||||||
|
mac := strings.ToLower(station.Mac)
|
||||||
|
stationID := strings.ToLower(station.ID)
|
||||||
ssid := ""
|
ssid := ""
|
||||||
encryption := ""
|
encryption := ""
|
||||||
if station.Bss != nil {
|
if station.Bss != nil {
|
||||||
|
@ -404,25 +408,22 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) {
|
||||||
apID,
|
apID,
|
||||||
ap.Config.Band,
|
ap.Config.Band,
|
||||||
ap.Name,
|
ap.Name,
|
||||||
station.ID,
|
stationID,
|
||||||
station.Bssid,
|
bssid,
|
||||||
ssid,
|
ssid,
|
||||||
encryption,
|
encryption,
|
||||||
station.Hostname,
|
station.Hostname,
|
||||||
strings.ToLower(station.Mac))
|
mac)
|
||||||
c.collectCounter(ch, station.RxBytes, promDescWifiApStationBytes,
|
c.collectCounter(ch, station.RxBytes, promDescWifiApStationBytes,
|
||||||
station.Bssid,
|
stationID,
|
||||||
station.Mac,
|
|
||||||
"rx",
|
"rx",
|
||||||
)
|
)
|
||||||
c.collectCounter(ch, station.TxBytes, promDescWifiApStationBytes,
|
c.collectCounter(ch, station.TxBytes, promDescWifiApStationBytes,
|
||||||
station.Bssid,
|
stationID,
|
||||||
station.Mac,
|
|
||||||
"tx",
|
"tx",
|
||||||
)
|
)
|
||||||
c.collectGauge(ch, station.Signal, promDescWifiApStationSignal,
|
c.collectGauge(ch, station.Signal, promDescWifiApStationSignal,
|
||||||
station.Bssid,
|
stationID)
|
||||||
station.Mac)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -500,7 +501,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) {
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
ch <- prometheus.MustNewConstMetric(promDescInfo, prometheus.GaugeValue, 1,
|
ch <- prometheus.MustNewConstMetric(promDescInfo, prometheus.GaugeValue, 1,
|
||||||
firmwareVersion,
|
firmwareVersion,
|
||||||
strings.ToLower(mac),
|
mac,
|
||||||
serial,
|
serial,
|
||||||
boardName,
|
boardName,
|
||||||
boxFlavor,
|
boxFlavor,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue