fixes to rogue api saving

This commit is contained in:
David Newhall II 2021-03-21 21:34:50 -07:00
parent b1761d5393
commit cb788ec274
1 changed files with 5 additions and 1 deletions

View File

@ -9,6 +9,10 @@ const uapT = item("UAP")
// batchRogueAP generates metric points for neighboring access points. // batchRogueAP generates metric points for neighboring access points.
func (u *InfluxUnifi) batchRogueAP(r report, s *unifi.RogueAP) { func (u *InfluxUnifi) batchRogueAP(r report, s *unifi.RogueAP) {
if s.Age.Val == 0 {
return // only keep metrics for things that are recent.
}
r.send(&metric{ r.send(&metric{
Table: "rogue_ap", Table: "rogue_ap",
Tags: map[string]string{ Tags: map[string]string{
@ -21,7 +25,7 @@ func (u *InfluxUnifi) batchRogueAP(r report, s *unifi.RogueAP) {
"band": s.Band, "band": s.Band,
}, },
Fields: map[string]interface{}{ Fields: map[string]interface{}{
"age": s.Age, "age": s.Age.Val,
"bw": s.Bw.Val, "bw": s.Bw.Val,
"center_freq": s.CenterFreq.Val, "center_freq": s.CenterFreq.Val,
"channel": s.Channel, "channel": s.Channel,