mirror of
https://github.com/unpoller/unpoller.git
synced 2026-03-31 06:24:21 -04:00
* feat(otelunifi): add OpenTelemetry output plugin Adds a new push-based output plugin that exports UniFi metrics to any OTLP-compatible backend (Grafana Alloy/Mimir, Honeycomb, Datadog via OTel, New Relic, etc.) using the Go OpenTelemetry SDK v1.42. Config (default disabled): [otel] url = "http://localhost:4318" protocol = "http" # or "grpc" interval = "30s" timeout = "10s" disable = false api_key = "" # optional Bearer auth Env var prefix: UP_OTEL_* Exported metrics: - Sites: user/guest/IoT counts, AP/GW/SW counts, latency, uptime, tx/rx rates per subsystem - Clients: uptime, rx/tx bytes & rates; signal/noise/RSSI for wireless - UAP: up, uptime, CPU/mem, load, per-radio channel/power, per-VAP station count/satisfaction/bytes - USW: up, uptime, CPU/mem, load, aggregate rx/tx bytes, per-port up/speed/bytes/packets/errors/dropped/PoE - USG: up, uptime, CPU/mem, load, per-WAN rx/tx bytes/packets/errors - UDM/UXG: up, uptime, CPU/mem, load averages Closes #933 Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * fix(otelunifi): rename unused ctx parameter to _ in recordGauge Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * fix(otelunifi): replace Disable with Enable (default false) Plugin is opt-in: set enable=true / UP_OTEL_ENABLE=true to activate. Closes part of #933. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
41 lines
862 B
Go
41 lines
862 B
Go
package main
|
|
|
|
//nolint:gci
|
|
import (
|
|
"log"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/unpoller/unpoller/pkg/poller"
|
|
// Load input plugins!
|
|
_ "github.com/unpoller/unpoller/pkg/inputunifi"
|
|
// Load output plugins!
|
|
_ "github.com/unpoller/unpoller/pkg/datadogunifi"
|
|
_ "github.com/unpoller/unpoller/pkg/influxunifi"
|
|
_ "github.com/unpoller/unpoller/pkg/lokiunifi"
|
|
_ "github.com/unpoller/unpoller/pkg/otelunifi"
|
|
_ "github.com/unpoller/unpoller/pkg/promunifi"
|
|
)
|
|
|
|
// Keep it simple.
|
|
func main() {
|
|
// Set time zone based on TZ env variable.
|
|
setTimeZone(os.Getenv("TZ"))
|
|
|
|
if err := poller.New().Start(); err != nil {
|
|
log.Fatalln("[ERROR]", err)
|
|
}
|
|
}
|
|
|
|
func setTimeZone(timezone string) {
|
|
if timezone == "" {
|
|
return
|
|
}
|
|
|
|
var err error
|
|
|
|
if time.Local, err = time.LoadLocation(timezone); err != nil {
|
|
log.Printf("[ERROR] Loading TZ Location '%s': %v\n", timezone, err)
|
|
}
|
|
}
|