mirror of
https://github.com/unpoller/unpoller.git
synced 2026-10-04 05:21:31 +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>
53 lines
1.6 KiB
Go
53 lines
1.6 KiB
Go
package datadogunifi
|
|
|
|
import (
|
|
"github.com/unpoller/unifi/v5"
|
|
)
|
|
|
|
// batchIntegrationDevStats generates integration device statistics datapoints for Datadog.
|
|
func (u *DatadogUnifi) batchIntegrationDevStats(r report, ids *unifi.IntegrationDeviceStats) {
|
|
if ids == nil {
|
|
return
|
|
}
|
|
|
|
metricName := metricNamespace("integration_device")
|
|
|
|
tags := cleanTags(map[string]string{
|
|
"device_id": ids.DeviceID,
|
|
})
|
|
|
|
tagSlice := tagMapToTags(tags)
|
|
|
|
_ = r.reportGauge(metricName("cpu_utilization_pct"), ids.CPUUtilizationPct.Val, tagSlice)
|
|
_ = r.reportGauge(metricName("memory_utilization_pct"), ids.MemoryUtilizationPct.Val, tagSlice)
|
|
_ = r.reportGauge(metricName("uptime_sec"), ids.UptimeSec.Val, tagSlice)
|
|
_ = r.reportGauge(metricName("load_average_1min"), ids.LoadAverage1Min.Val, tagSlice)
|
|
_ = r.reportGauge(metricName("load_average_5min"), ids.LoadAverage5Min.Val, tagSlice)
|
|
_ = r.reportGauge(metricName("load_average_15min"), ids.LoadAverage15Min.Val, tagSlice)
|
|
|
|
radioMetric := metricNamespace("integration_device_radio")
|
|
|
|
for i := range ids.Radios {
|
|
radio := &ids.Radios[i]
|
|
|
|
radioTags := append(tagSlice,
|
|
tag("frequency_ghz", radio.FrequencyGHz.Val),
|
|
)
|
|
|
|
_ = r.reportGauge(radioMetric("tx_retries_pct"), radio.TxRetriesPct.Val, radioTags)
|
|
}
|
|
|
|
uplinkMetric := metricNamespace("integration_device_uplink")
|
|
|
|
for i := range ids.Uplinks {
|
|
uplink := &ids.Uplinks[i]
|
|
|
|
uplinkTags := append(tagSlice,
|
|
tag("uplink_index", i),
|
|
)
|
|
|
|
_ = r.reportGauge(uplinkMetric("rx_rate_bps"), uplink.RxRateBps.Val, uplinkTags)
|
|
_ = r.reportGauge(uplinkMetric("tx_rate_bps"), uplink.TxRateBps.Val, uplinkTags)
|
|
}
|
|
}
|