remote upgrade metrics for #433

This commit is contained in:
Cody Lee
2022-12-21 20:14:22 -06:00
parent e4c296c63d
commit 0329066fe5
12 changed files with 26 additions and 0 deletions

View File

@@ -47,3 +47,10 @@ func cleanTags(tags map[string]string) map[string]string {
return tags
}
func boolToFloat64(v bool) float64 {
if v {
return 1.0
}
return 0.0
}

View File

@@ -70,6 +70,7 @@ func (u *DatadogUnifi) batchUAP(r report, s *unifi.UAP) {
data["user_num_sta"] = s.UserNumSta.Val
data["guest_num_sta"] = s.GuestNumSta.Val
data["num_sta"] = s.NumSta.Val
data["upgradeable"] = boolToFloat64(s.Upgradable.Val)
r.addCount(uapT)

View File

@@ -125,6 +125,7 @@ func (u *DatadogUnifi) batchUDM(r report, s *unifi.UDM) { // nolint: funlen
"num_desktop": s.NumDesktop.Val,
"num_handheld": s.NumHandheld.Val,
"num_mobile": s.NumMobile.Val,
"upgradeable": boolToFloat64(s.Upgradeable.Val),
},
)
@@ -155,6 +156,7 @@ func (u *DatadogUnifi) batchUDM(r report, s *unifi.UDM) { // nolint: funlen
"rx_bytes": s.RxBytes.Val,
"tx_bytes": s.TxBytes.Val,
"uptime": s.Uptime.Val,
"upgradeable": boolToFloat64(s.Upgradeable.Val),
})
metricName = metricNamespace("usw")

View File

@@ -42,6 +42,7 @@ func (u *DatadogUnifi) batchUSG(r report, s *unifi.USG) {
"num_desktop": s.NumDesktop.Val,
"num_handheld": s.NumHandheld.Val,
"num_mobile": s.NumMobile.Val,
"upgradeable": boolToFloat64(s.Upgradable.Val),
},
)

View File

@@ -39,6 +39,7 @@ func (u *DatadogUnifi) batchUSW(r report, s *unifi.USW) {
"uptime": s.Uptime.Val,
"state": s.State.Val,
"user_num_sta": s.UserNumSta.Val,
"upgradeable": boolToFloat64(s.Upgradeable.Val),
})
r.addCount(uswT)