Add wlan station and interface metrics collection. (#14)

* Fix newlines.
* Added wlan metrics.
* Fix WlanSTA collector - return on errors.
This commit is contained in:
Robert S. Gerus
2018-09-11 05:30:13 +02:00
committed by Steve Brunton
parent f6b4764691
commit 25911b4e60
8 changed files with 391 additions and 125 deletions

View File

@@ -1,6 +1,8 @@
package collector
import (
"math"
"strconv"
"strings"
"github.com/prometheus/client_golang/prometheus"
@@ -27,3 +29,17 @@ func description(prefix, name, helpText string, labelNames []string) *prometheus
nil,
)
}
func splitStringToFloats(metric string) (float64, float64, error) {
strings := strings.Split(metric, ",")
m1, err := strconv.ParseFloat(strings[0], 64)
if err != nil {
return math.NaN(), math.NaN(), err
}
m2, err := strconv.ParseFloat(strings[1], 64)
if err != nil {
return math.NaN(), math.NaN(), err
}
return m1, m2, nil
}