diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md index 3f62fc58f..598151dd7 100644 --- a/docs/CONFIGURATION.md +++ b/docs/CONFIGURATION.md @@ -324,6 +324,8 @@ for `warning` and blue for `info`: labels: color: custom: + "@alertmanager": + prod: "#e6e" severity: info: "#87c4e0" warning: "#ffae42" diff --git a/internal/alertmanager/models.go b/internal/alertmanager/models.go index 048613a6c..c34339d4d 100644 --- a/internal/alertmanager/models.go +++ b/internal/alertmanager/models.go @@ -322,6 +322,9 @@ func (am *Alertmanager) pullAlerts(version string) error { } transform.ColorLabel(colors, "@receiver", alert.Receiver) + for _, am := range alert.Alertmanager { + transform.ColorLabel(colors, "@alertmanager", am.Name) + } for k, v := range alert.Labels { transform.ColorLabel(colors, k, v) } diff --git a/views.go b/views.go index 97ff166eb..a1be6d90d 100644 --- a/views.go +++ b/views.go @@ -162,6 +162,17 @@ func alerts(c *gin.Context) { } } + if ck, foundKey := dedupedColors["@alertmanager"]; foundKey { + for _, am := range alert.Alertmanager { + if cv, foundVal := ck[am.Name]; foundVal { + if _, found := colors["@alertmanager"]; !found { + colors["@alertmanager"] = map[string]models.LabelColors{} + } + colors["@alertmanager"][am.Name] = cv + } + } + } + agCopy.StateCount[alert.State]++ for _, am := range alert.Alertmanager {