From f1ec49cc5873e90d7454f63844acf95c5f3844aa Mon Sep 17 00:00:00 2001 From: xinyangli Date: Wed, 26 Mar 2025 11:24:36 +0800 Subject: [PATCH] modules/monitor: show truncated alerts count --- modules/nixos/monitor/default.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/nixos/monitor/default.nix b/modules/nixos/monitor/default.nix index 5b9d31a..a8386bd 100644 --- a/modules/nixos/monitor/default.nix +++ b/modules/nixos/monitor/default.nix @@ -120,11 +120,12 @@ in webhook_configs = [ { url = "${ntfyUrl}/prometheus-alerts?tpl=yes&m=${lib.escapeURL '' - {{range .alerts}}{{ if eq .status "resolved" }}✅{{ else }}{{ if eq .status "firing" }}🔥{{end}}{{end}}{{.labels.alertname}} - {{.annotations.summary}} - {{end}}''}"; + {{ if eq .truncatedAlerts 0 }}{{ else }}{{.truncatedAlerts}} truncated + {{end}}{{range .alerts}}{{ if eq .status "resolved" }}✅{{ else }}{{ if eq .status "firing" }}🔥{{end}}{{end}}{{.labels.alertname}} + {{.annotations.summary}} + {{end}}''}"; send_resolved = true; - max_alerts = 5; + max_alerts = 10; } ]; }