mirror of
https://github.com/unpoller/unpoller.git
synced 2026-10-08 23:41:21 +02:00
Adds 21 new data types from unifi v5.26.0 across all metric output plugins (InfluxDB, Prometheus, DataDog). Per-site Integration/v1 calls are gated on API key configuration and only run for user-configured sites; ErrEndpointNotFound is handled gracefully so older firmware continues to work without log spam. Also migrates events collection (collectAlarms, collectAnomalies, collectEvents, collectIDs, collectProtectLogs) to handle Network 10.x+ endpoint removals via ErrEndpointNotFound, with debug-level logging to avoid per-poll noise. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
36 lines
835 B
Go
36 lines
835 B
Go
package promunifi
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"github.com/unpoller/unifi/v5"
|
|
)
|
|
|
|
// upsDevice holds Prometheus descriptors for UPS device selector metrics.
|
|
// UPSDeviceSelector has no numeric fields — we emit a presence gauge so the
|
|
// device appears in Prometheus at all.
|
|
type upsDevice struct {
|
|
Presence *prometheus.Desc
|
|
}
|
|
|
|
func descUPSDevice(ns string) *upsDevice {
|
|
labels := []string{"site_name", "mac", "label"}
|
|
|
|
return &upsDevice{
|
|
Presence: prometheus.NewDesc(ns+"ups_device_present",
|
|
"UPS device detected on site (always 1 when present)",
|
|
labels, nil),
|
|
}
|
|
}
|
|
|
|
func (u *promUnifi) exportUPSDevice(r report, d *unifi.UPSDeviceSelector) {
|
|
if d == nil {
|
|
return
|
|
}
|
|
|
|
labels := []string{d.SiteName, d.MAC, d.Label}
|
|
|
|
r.send([]*metric{
|
|
{u.UPSDevice.Presence, gauge, 1.0, labels},
|
|
})
|
|
}
|