mirror of
https://github.com/nshttpd/mikrotik-exporter.git
synced 2025-01-07 18:38:28 +01:00
Merge pull request #79 from siretart/wifi
wlansta: Record wifi signal strength
This commit is contained in:
commit
605780990f
@ -21,7 +21,7 @@ func newWlanSTACollector() routerOSCollector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *wlanSTACollector) init() {
|
func (c *wlanSTACollector) init() {
|
||||||
c.props = []string{"interface", "mac-address", "signal-to-noise", "signal-strength-ch0", "packets", "bytes", "frames"}
|
c.props = []string{"interface", "mac-address", "signal-to-noise", "signal-strength", "packets", "bytes", "frames"}
|
||||||
labelNames := []string{"name", "address", "interface", "mac_address"}
|
labelNames := []string{"name", "address", "interface", "mac_address"}
|
||||||
c.descriptions = make(map[string]*prometheus.Desc)
|
c.descriptions = make(map[string]*prometheus.Desc)
|
||||||
for _, p := range c.props[:len(c.props)-3] {
|
for _, p := range c.props[:len(c.props)-3] {
|
||||||
@ -81,7 +81,12 @@ func (c *wlanSTACollector) collectMetricForProperty(property, iface, mac string,
|
|||||||
if re.Map[property] == "" {
|
if re.Map[property] == "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
v, err := strconv.ParseFloat(re.Map[property], 64)
|
p := re.Map[property]
|
||||||
|
i := strings.Index(p, "@")
|
||||||
|
if i > -1 {
|
||||||
|
p = p[:i]
|
||||||
|
}
|
||||||
|
v, err := strconv.ParseFloat(p, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"device": ctx.device.Name,
|
"device": ctx.device.Name,
|
||||||
|
Loading…
Reference in New Issue
Block a user