add more temps for USG
This commit is contained in:
parent
16fcd2300c
commit
c5202d2b3b
|
|
@ -5,7 +5,7 @@ go 1.15
|
||||||
require (
|
require (
|
||||||
github.com/influxdata/influxdb1-client v0.0.0-20200515024757-02f0bf5dbca3
|
github.com/influxdata/influxdb1-client v0.0.0-20200515024757-02f0bf5dbca3
|
||||||
github.com/unifi-poller/poller v0.0.8
|
github.com/unifi-poller/poller v0.0.8
|
||||||
github.com/unifi-poller/unifi v0.0.7-0.20210315003727-a4802cb45269
|
github.com/unifi-poller/unifi v0.0.7-0.20210315051727-4c317f9a2b95
|
||||||
github.com/unifi-poller/webserver v0.0.0-20200628212441-340749c94743
|
github.com/unifi-poller/webserver v0.0.0-20200628212441-340749c94743
|
||||||
golift.io/cnfg v0.0.7
|
golift.io/cnfg v0.0.7
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package influxunifi
|
package influxunifi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/unifi-poller/unifi"
|
"github.com/unifi-poller/unifi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -22,7 +25,7 @@ func Combine(in ...map[string]interface{}) map[string]interface{} {
|
||||||
|
|
||||||
// batchSysStats is used by all device types.
|
// batchSysStats is used by all device types.
|
||||||
func (u *InfluxUnifi) batchSysStats(s unifi.SysStats, ss unifi.SystemStats) map[string]interface{} {
|
func (u *InfluxUnifi) batchSysStats(s unifi.SysStats, ss unifi.SystemStats) map[string]interface{} {
|
||||||
return map[string]interface{}{
|
m := map[string]interface{}{
|
||||||
"loadavg_1": s.Loadavg1.Val,
|
"loadavg_1": s.Loadavg1.Val,
|
||||||
"loadavg_5": s.Loadavg5.Val,
|
"loadavg_5": s.Loadavg5.Val,
|
||||||
"loadavg_15": s.Loadavg15.Val,
|
"loadavg_15": s.Loadavg15.Val,
|
||||||
|
|
@ -33,6 +36,17 @@ func (u *InfluxUnifi) batchSysStats(s unifi.SysStats, ss unifi.SystemStats) map[
|
||||||
"mem": ss.Mem.Val,
|
"mem": ss.Mem.Val,
|
||||||
"system_uptime": ss.Uptime.Val,
|
"system_uptime": ss.Uptime.Val,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for k, v := range ss.Temps {
|
||||||
|
temp, _ := strconv.Atoi(strings.Split(v, " ")[0])
|
||||||
|
k = strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(k, " ", "_"), ")", ""), "(", "")
|
||||||
|
|
||||||
|
if temp != 0 && k != "" {
|
||||||
|
m["temp_"+strings.ToLower(k)] = temp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *InfluxUnifi) batchUDMtemps(temps []unifi.Temperature) map[string]interface{} {
|
func (u *InfluxUnifi) batchUDMtemps(temps []unifi.Temperature) map[string]interface{} {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue