mirror of
https://github.com/unpoller/unpoller.git
synced 2026-09-30 03:21:28 +02:00
interval=0 now turns off the Prometheus scrape cache as PR #1014 documented, and sub-15s intervals warn instead of clamping (#1083). Adopted devices stay in Prometheus, Influx, OTel, and Datadog exports while locate/identify is on (#1075). Co-authored-by: Cursor <cursoragent@cursor.com>
55 lines
1.8 KiB
Go
55 lines
1.8 KiB
Go
package promunifi
|
|
|
|
import "github.com/unpoller/unifi/v6"
|
|
|
|
// exportUDB exports metrics for UDB (UniFi Device Bridge) devices.
|
|
// The UDB range includes UDB-Switch, UDB-Pro, UDB-Pro-Sector.
|
|
// UDB-Switch is a hybrid device combining switch ports (8 PoE ports)
|
|
// with WiFi 7 wireless bridge capability (5GHz + 6GHz radios).
|
|
func (u *promUnifi) exportUDB(r report, d *unifi.UDB) {
|
|
if !d.Adopted.Val {
|
|
return
|
|
}
|
|
|
|
baseLabels := []string{d.Type, d.SiteName, d.Name, d.SourceName}
|
|
baseInfoLabels := []string{d.Version, d.Model, d.Serial, d.Mac, d.IP, d.ID}
|
|
|
|
u.exportWithTags(r, d.Tags, func(tagLabels []string) {
|
|
tag := tagLabels[0]
|
|
labels := append(baseLabels, tag)
|
|
infoLabels := append(baseInfoLabels, tag)
|
|
|
|
// Export switch stats (reuse USW functions)
|
|
u.exportUSWstats(r, labels, d.Stat.Sw)
|
|
u.exportPRTtable(r, labels, d.PortTable)
|
|
|
|
// Export wireless stats (reuse UAP functions)
|
|
u.exportVAPtable(r, labels, d.VapTable, d.Mac)
|
|
u.exportRADtable(r, labels, d.RadioTable, d.RadioTableStats, d.Mac)
|
|
|
|
// Common device stats
|
|
u.exportBYTstats(r, labels, d.TxBytes, d.RxBytes)
|
|
u.exportSYSstats(r, labels, d.SysStats, d.SystemStats)
|
|
u.exportSTAcount(r, labels, d.UserNumSta, d.GuestNumSta)
|
|
u.exportDeviceUplink(r, labels, d.Uplink)
|
|
|
|
r.send([]*metric{
|
|
{u.Device.Info, gauge, 1.0, append(baseLabels, infoLabels...)},
|
|
{u.Device.Uptime, gauge, d.Uptime, labels},
|
|
{u.Device.Upgradeable, gauge, d.Upgradable.Val, labels},
|
|
})
|
|
|
|
if d.HasTemperature.Val {
|
|
r.send([]*metric{{u.Device.Temperature, gauge, d.GeneralTemperature, append(labels, "general", "board")}})
|
|
}
|
|
|
|
if d.HasFan.Val {
|
|
r.send([]*metric{{u.Device.FanLevel, gauge, d.FanLevel, labels}})
|
|
}
|
|
|
|
if d.TotalMaxPower.Txt != "" {
|
|
r.send([]*metric{{u.Device.TotalMaxPower, gauge, d.TotalMaxPower, labels}})
|
|
}
|
|
})
|
|
}
|