Add wlan station and interface metrics collection. (#14)
* Fix newlines. * Added wlan metrics. * Fix WlanSTA collector - return on errors.
This commit is contained in:
committed by
Steve Brunton
parent
f6b4764691
commit
25911b4e60
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user