put all port data in one place

This commit is contained in:
davidnewhall2 2020-06-14 01:26:29 -07:00
parent 0a9385924f
commit ffbdbdbfd5
3 changed files with 5 additions and 5 deletions

View File

@ -35,7 +35,7 @@ func (u *InfluxUnifi) batchUAP(r report, s *unifi.UAP) {
r.send(&metric{Table: "uap", Tags: tags, Fields: fields}) r.send(&metric{Table: "uap", Tags: tags, Fields: fields})
u.processRadTable(r, tags, s.RadioTable, s.RadioTableStats) u.processRadTable(r, tags, s.RadioTable, s.RadioTableStats)
u.processVAPTable(r, tags, s.VapTable) u.processVAPTable(r, tags, s.VapTable)
u.batchPortTable(r, tags, "uap", s.PortTable) u.batchPortTable(r, tags, s.PortTable)
} }
func (u *InfluxUnifi) processUAPstats(ap *unifi.Ap) map[string]interface{} { func (u *InfluxUnifi) processUAPstats(ap *unifi.Ap) map[string]interface{} {

View File

@ -109,7 +109,7 @@ func (u *InfluxUnifi) batchUDM(r report, s *unifi.UDM) { // nolint: funlen
}) })
r.send(&metric{Table: "usw", Tags: tags, Fields: fields}) r.send(&metric{Table: "usw", Tags: tags, Fields: fields})
u.batchPortTable(r, tags, "usw", s.PortTable) // udm has a usw in it. u.batchPortTable(r, tags, s.PortTable) // udm has a usw in it.
if s.Stat.Ap == nil { if s.Stat.Ap == nil {
return // we're done now. the following code process UDM (non-pro) UAP data. return // we're done now. the following code process UDM (non-pro) UAP data.

View File

@ -39,7 +39,7 @@ func (u *InfluxUnifi) batchUSW(r report, s *unifi.USW) {
}) })
r.send(&metric{Table: "usw", Tags: tags, Fields: fields}) r.send(&metric{Table: "usw", Tags: tags, Fields: fields})
u.batchPortTable(r, tags, "usw", s.PortTable) u.batchPortTable(r, tags, s.PortTable)
} }
func (u *InfluxUnifi) batchUSWstat(sw *unifi.Sw) map[string]interface{} { func (u *InfluxUnifi) batchUSWstat(sw *unifi.Sw) map[string]interface{} {
@ -63,7 +63,7 @@ func (u *InfluxUnifi) batchUSWstat(sw *unifi.Sw) map[string]interface{} {
} }
} }
func (u *InfluxUnifi) batchPortTable(r report, t map[string]string, dev string, pt []unifi.Port) { func (u *InfluxUnifi) batchPortTable(r report, t map[string]string, pt []unifi.Port) {
for _, p := range pt { for _, p := range pt {
if !p.Up.Val || !p.Enable.Val { if !p.Up.Val || !p.Enable.Val {
continue // only record UP ports. continue // only record UP ports.
@ -109,6 +109,6 @@ func (u *InfluxUnifi) batchPortTable(r report, t map[string]string, dev string,
fields["poe_voltage"] = p.PoeVoltage.Val fields["poe_voltage"] = p.PoeVoltage.Val
} }
r.send(&metric{Table: dev + "_ports", Tags: tags, Fields: fields}) r.send(&metric{Table: "usw_ports", Tags: tags, Fields: fields})
} }
} }