Merge pull request #476 from unpoller/fix-422-part-2

Fixes another NPE for UXG data missing on some replies
This commit is contained in:
Cody Lee 2022-12-20 21:39:44 -06:00 committed by GitHub
commit d90056ecec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -30,6 +30,10 @@ func (u *DatadogUnifi) batchUXG(r report, s *unifi.UXG) { // nolint: funlen
if s.Stat != nil {
gw = s.Stat.Gw
}
var sw *unifi.Sw = nil
if s.Stat != nil {
sw = s.Stat.Sw
}
data := CombineFloat64(
u.batchUDMstorage(s.Storage),
u.batchUDMtemps(s.Temperatures),
@ -70,7 +74,7 @@ func (u *DatadogUnifi) batchUXG(r report, s *unifi.UXG) { // nolint: funlen
"ip": s.IP,
})
data = CombineFloat64(
u.batchUSWstat(s.Stat.Sw),
u.batchUSWstat(sw),
map[string]float64{
"guest_num_sta": s.GuestNumSta.Val,
"bytes": s.Bytes.Val,

View File

@ -28,6 +28,10 @@ func (u *InfluxUnifi) batchUXG(r report, s *unifi.UXG) { // nolint: funlen
if s.Stat != nil {
gw = s.Stat.Gw
}
var sw *unifi.Sw = nil
if s.Stat != nil {
sw = s.Stat.Sw
}
fields := Combine(
u.batchUDMstorage(s.Storage),
u.batchUDMtemps(s.Temperatures),
@ -68,7 +72,7 @@ func (u *InfluxUnifi) batchUXG(r report, s *unifi.UXG) { // nolint: funlen
"type": s.Type,
}
fields = Combine(
u.batchUSWstat(s.Stat.Sw),
u.batchUSWstat(sw),
map[string]any{
"guest-num_sta": s.GuestNumSta.Val,
"ip": s.IP,