adds in UBB & UCI support
This commit is contained in:
parent
a30c82093d
commit
3602d8cc8f
4
go.mod
4
go.mod
|
|
@ -13,7 +13,7 @@ require (
|
||||||
github.com/prometheus/common v0.61.0
|
github.com/prometheus/common v0.61.0
|
||||||
github.com/spf13/pflag v1.0.6-0.20201009195203-85dd5c8bc61c
|
github.com/spf13/pflag v1.0.6-0.20201009195203-85dd5c8bc61c
|
||||||
github.com/stretchr/testify v1.10.0
|
github.com/stretchr/testify v1.10.0
|
||||||
github.com/unpoller/unifi/v5 v5.0.5
|
github.com/unpoller/unifi/v5 v5.0.6
|
||||||
golang.org/x/crypto v0.31.0
|
golang.org/x/crypto v0.31.0
|
||||||
golang.org/x/net v0.33.0
|
golang.org/x/net v0.33.0
|
||||||
golang.org/x/term v0.27.0
|
golang.org/x/term v0.27.0
|
||||||
|
|
@ -48,4 +48,4 @@ require (
|
||||||
)
|
)
|
||||||
|
|
||||||
// for local iterative development only
|
// for local iterative development only
|
||||||
replace github.com/unpoller/unifi/v5 => ../unifi
|
// replace github.com/unpoller/unifi/v5 => ../unifi
|
||||||
|
|
|
||||||
4
go.sum
4
go.sum
|
|
@ -75,8 +75,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
|
||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/unpoller/unifi/v5 v5.0.5 h1:4u3Dd3CrEH9t0BMCy/jjBMFN2xk67Zm3UKOT//Oq/ZQ=
|
github.com/unpoller/unifi/v5 v5.0.6 h1:nokn8k5HOnxcOhLt5d0xzotJ0tvhbKoExAesrWenLhQ=
|
||||||
github.com/unpoller/unifi/v5 v5.0.5/go.mod h1:G45KRuSH9PFrIUFmDTzWEEM/E/e7GuyXp36AVOfhm7I=
|
github.com/unpoller/unifi/v5 v5.0.6/go.mod h1:G45KRuSH9PFrIUFmDTzWEEM/E/e7GuyXp36AVOfhm7I=
|
||||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ func (u *DatadogUnifi) batchUBB(r report, s *unifi.UBB) { // nolint: funlen
|
||||||
if s.SysStats != nil {
|
if s.SysStats != nil {
|
||||||
sysStats = *s.SysStats
|
sysStats = *s.SysStats
|
||||||
}
|
}
|
||||||
|
|
||||||
systemStats := unifi.SystemStats{}
|
systemStats := unifi.SystemStats{}
|
||||||
if s.SystemStats != nil {
|
if s.SystemStats != nil {
|
||||||
systemStats = *s.SystemStats
|
systemStats = *s.SystemStats
|
||||||
|
|
@ -82,7 +83,6 @@ func (u *DatadogUnifi) batchUBB(r report, s *unifi.UBB) { // nolint: funlen
|
||||||
|
|
||||||
metricName = metricNamespace("usw")
|
metricName = metricNamespace("usw")
|
||||||
reportGaugeForFloat64Map(r, metricName, data, tags)
|
reportGaugeForFloat64Map(r, metricName, data, tags)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *DatadogUnifi) batchUBBstat(sw *unifi.Bb) map[string]float64 {
|
func (u *DatadogUnifi) batchUBBstat(sw *unifi.Bb) map[string]float64 {
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ func (u *DatadogUnifi) batchUCI(r report, s *unifi.UCI) { // nolint: funlen
|
||||||
if s.SysStats != nil {
|
if s.SysStats != nil {
|
||||||
sysStats = *s.SysStats
|
sysStats = *s.SysStats
|
||||||
}
|
}
|
||||||
|
|
||||||
systemStats := unifi.SystemStats{}
|
systemStats := unifi.SystemStats{}
|
||||||
if s.SystemStats != nil {
|
if s.SystemStats != nil {
|
||||||
systemStats = *s.SystemStats
|
systemStats = *s.SystemStats
|
||||||
|
|
@ -53,7 +54,7 @@ func (u *DatadogUnifi) batchUCI(r report, s *unifi.UCI) { // nolint: funlen
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
r.addCount(uxgT)
|
r.addCount(uciT)
|
||||||
|
|
||||||
metricName := metricNamespace("usg")
|
metricName := metricNamespace("usg")
|
||||||
reportGaugeForFloat64Map(r, metricName, data, tags)
|
reportGaugeForFloat64Map(r, metricName, data, tags)
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ func (u *InfluxUnifi) batchUBB(r report, s *unifi.UBB) { // nolint: funlen
|
||||||
"serial": s.Serial,
|
"serial": s.Serial,
|
||||||
"type": s.Type,
|
"type": s.Type,
|
||||||
}
|
}
|
||||||
|
|
||||||
var sw *unifi.Bb
|
var sw *unifi.Bb
|
||||||
if s.Stat != nil {
|
if s.Stat != nil {
|
||||||
sw = s.Stat.Bb
|
sw = s.Stat.Bb
|
||||||
|
|
@ -33,6 +34,7 @@ func (u *InfluxUnifi) batchUBB(r report, s *unifi.UBB) { // nolint: funlen
|
||||||
if s.SysStats != nil {
|
if s.SysStats != nil {
|
||||||
sysStats = *s.SysStats
|
sysStats = *s.SysStats
|
||||||
}
|
}
|
||||||
|
|
||||||
systemStats := unifi.SystemStats{}
|
systemStats := unifi.SystemStats{}
|
||||||
if s.SystemStats != nil {
|
if s.SystemStats != nil {
|
||||||
systemStats = *s.SystemStats
|
systemStats = *s.SystemStats
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ func (u *InfluxUnifi) batchUCI(r report, s *unifi.UCI) { // nolint: funlen
|
||||||
if s.SysStats != nil {
|
if s.SysStats != nil {
|
||||||
sysStats = *s.SysStats
|
sysStats = *s.SysStats
|
||||||
}
|
}
|
||||||
|
|
||||||
systemStats := unifi.SystemStats{}
|
systemStats := unifi.SystemStats{}
|
||||||
if s.SystemStats != nil {
|
if s.SystemStats != nil {
|
||||||
systemStats = *s.SystemStats
|
systemStats = *s.SystemStats
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ func (u *promUnifi) exportUBB(r report, d *unifi.UBB) {
|
||||||
infoLabels := []string{d.Version, d.Model, d.Serial, d.Mac, d.IP, d.ID}
|
infoLabels := []string{d.Version, d.Model, d.Serial, d.Mac, d.IP, d.ID}
|
||||||
// Shared data (all devices do this).
|
// Shared data (all devices do this).
|
||||||
u.exportBYTstats(r, labels, d.TxBytes, d.RxBytes)
|
u.exportBYTstats(r, labels, d.TxBytes, d.RxBytes)
|
||||||
|
|
||||||
if d.SysStats != nil && d.SystemStats != nil {
|
if d.SysStats != nil && d.SystemStats != nil {
|
||||||
u.exportSYSstats(r, labels, *d.SysStats, *d.SystemStats)
|
u.exportSYSstats(r, labels, *d.SysStats, *d.SystemStats)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,11 @@ func (u *promUnifi) exportUCI(r report, d *unifi.UCI) {
|
||||||
infoLabels := []string{d.Version, d.Model, d.Serial, d.Mac, d.IP, d.ID}
|
infoLabels := []string{d.Version, d.Model, d.Serial, d.Mac, d.IP, d.ID}
|
||||||
// Shared data (all devices do this).
|
// Shared data (all devices do this).
|
||||||
u.exportBYTstats(r, labels, d.TxBytes, d.RxBytes)
|
u.exportBYTstats(r, labels, d.TxBytes, d.RxBytes)
|
||||||
|
|
||||||
if d.SysStats != nil && d.SystemStats != nil {
|
if d.SysStats != nil && d.SystemStats != nil {
|
||||||
u.exportSYSstats(r, labels, *d.SysStats, *d.SystemStats)
|
u.exportSYSstats(r, labels, *d.SysStats, *d.SystemStats)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch Data
|
// Switch Data
|
||||||
u.exportUSWstats(r, labels, sw)
|
u.exportUSWstats(r, labels, sw)
|
||||||
// Dream Machine System Data.
|
// Dream Machine System Data.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue