mirror of
https://github.com/unpoller/unpoller.git
synced 2026-10-06 22:42:02 +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>
76 lines
2.0 KiB
Go
76 lines
2.0 KiB
Go
package datadogunifi
|
|
|
|
import (
|
|
"github.com/unpoller/unifi/v5"
|
|
)
|
|
|
|
// batchDPIApplication generates DPI application catalogue datapoints for Datadog.
|
|
// DPIApplications are global (no site scope).
|
|
func (u *DatadogUnifi) batchDPIApplication(r report, da *unifi.DPIApplication) {
|
|
if da == nil {
|
|
return
|
|
}
|
|
|
|
metricName := metricNamespace("dpi_application")
|
|
|
|
tags := cleanTags(map[string]string{
|
|
"name": da.Name,
|
|
})
|
|
|
|
_ = r.reportGauge(metricName("id"), da.ID.Val, tagMapToTags(tags))
|
|
}
|
|
|
|
// batchDPICategory generates DPI category catalogue datapoints for Datadog.
|
|
// DPICategories are global (no site scope).
|
|
func (u *DatadogUnifi) batchDPICategory(r report, dc *unifi.DPICategory) {
|
|
if dc == nil {
|
|
return
|
|
}
|
|
|
|
metricName := metricNamespace("dpi_category")
|
|
|
|
tags := cleanTags(map[string]string{
|
|
"name": dc.Name,
|
|
})
|
|
|
|
_ = r.reportGauge(metricName("id"), dc.ID.Val, tagMapToTags(tags))
|
|
}
|
|
|
|
// batchPendingDevice generates PendingDevice (adoption queue) datapoints for Datadog.
|
|
// PendingDevices are global (no site scope).
|
|
func (u *DatadogUnifi) batchPendingDevice(r report, pd *unifi.PendingDevice) {
|
|
if pd == nil {
|
|
return
|
|
}
|
|
|
|
metricName := metricNamespace("pending_device")
|
|
|
|
tags := cleanTags(map[string]string{
|
|
"mac_address": pd.MACAddress,
|
|
"ip_address": pd.IPAddress,
|
|
"model": pd.Model,
|
|
"state": pd.State,
|
|
})
|
|
|
|
_ = r.reportGauge(metricName("supported"), boolToFloat64(pd.Supported), tagMapToTags(tags))
|
|
_ = r.reportGauge(metricName("firmware_updatable"), boolToFloat64(pd.FirmwareUpdatable), tagMapToTags(tags))
|
|
}
|
|
|
|
// batchCountry generates Country datapoints for Datadog.
|
|
// Countries are global (no site scope).
|
|
func (u *DatadogUnifi) batchCountry(r report, co *unifi.Country) {
|
|
if co == nil {
|
|
return
|
|
}
|
|
|
|
metricName := metricNamespace("country")
|
|
|
|
tags := cleanTags(map[string]string{
|
|
"code": co.Code,
|
|
"name": co.Name,
|
|
})
|
|
|
|
// Emit a presence gauge (1.0 = country entry exists in the catalogue).
|
|
_ = r.reportGauge(metricName("present"), 1.0, tagMapToTags(tags))
|
|
}
|