mirror of
https://github.com/unpoller/unpoller.git
synced 2026-04-05 08:54:09 -04:00
Fix site name override for DPI clients, anomalies, and site metrics
- Apply site name override to DPI clients (ClientsDPI) in augmentMetrics - Apply site name override to client anomalies when collecting events - Apply site name override to sites (both Name and SiteName fields) when adding to metrics - Apply site name override to DPI sites, speed tests, and country traffic - Move applySiteNameOverride call to end of augmentMetrics to ensure all metrics are processed - This ensures all Prometheus metrics use console names instead of 'Default (default)' for Cloud Gateways
This commit is contained in:
@@ -3,6 +3,7 @@ package inputunifi
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/unpoller/unifi/v5"
|
||||
@@ -83,6 +84,14 @@ func (u *InputUnifi) collectAnomalies(logs []any, sites []*unifi.Site, c *Contro
|
||||
}
|
||||
|
||||
for _, e := range events {
|
||||
// Apply site name override for anomalies if configured
|
||||
if c.DefaultSiteNameOverride != "" {
|
||||
lower := strings.ToLower(e.SiteName)
|
||||
if lower == "default" || strings.Contains(lower, "default") {
|
||||
e.SiteName = c.DefaultSiteNameOverride
|
||||
}
|
||||
}
|
||||
|
||||
logs = append(logs, e)
|
||||
|
||||
webserver.NewInputEvent(PluginName, s.ID+"_anomalies", &webserver.Event{
|
||||
|
||||
Reference in New Issue
Block a user