prometheus, alertmanager: Adjust alert wording depending on firing or resolved status

This commit is contained in:
SebastianStork 2026-03-10 21:22:33 +01:00
parent f2258ac79c
commit ba6f0387b2
Signed by: SebastianStork
SSH key fingerprint: SHA256:tRrGdjYOwgHxpSc/wTOZQZEjxcb15P0tyXRsbAfd+2Q
2 changed files with 8 additions and 5 deletions

View file

@ -83,7 +83,10 @@ in
notification = { notification = {
topic = "splitleaf"; topic = "splitleaf";
priority = "default"; priority = "default";
templates.title = ''{{ index .Annotations "summary" }}''; templates = {
title = ''{{ if eq .Status "firing" }}{{ index .Annotations "summary" }}{{ else }}{{ index .Annotations "summary_resolved" }}{{ end }}'';
description = ".";
};
tags = [ tags = [
{ {
condition = ''status == "resolved"''; condition = ''status == "resolved"'';

View file

@ -97,7 +97,7 @@ in
labels.severity = "critical"; labels.severity = "critical";
annotations = { annotations = {
summary = "${hostName} is DOWN"; summary = "${hostName} is DOWN";
description = "${hostName} has not reported any metrics for more than 2 minutes."; summary_resolved = "${hostName} is up again";
}; };
}) })
) )
@ -108,7 +108,7 @@ in
for = "2m"; for = "2m";
annotations = { annotations = {
summary = "{{ $labels.job }} on {{ $labels.instance }} is DOWN"; summary = "{{ $labels.job }} on {{ $labels.instance }} is DOWN";
description = "{{ $labels.job }} on {{ $labels.instance }} has been down for more than 2 minutes."; summary_resolved = "{{ $labels.job }} on {{ $labels.instance }} is up again";
}; };
} }
{ {
@ -116,7 +116,7 @@ in
expr = ''comin_deployment_info{status!="done"}''; expr = ''comin_deployment_info{status!="done"}'';
annotations = { annotations = {
summary = "{{ $labels.instance }} deployment failed"; summary = "{{ $labels.instance }} deployment failed";
description = "The deployment of {{ $labels.instance }} with comin is failing."; summary_resolved = "{{ $labels.instance }} deployment recovered";
}; };
} }
{ {
@ -125,7 +125,7 @@ in
for = "10m"; for = "10m";
annotations = { annotations = {
summary = "Hosts are running different commits"; summary = "Hosts are running different commits";
description = "Not all hosts are running the same git commit, which may indicate a failed deployment and could lead to incompatible configurations."; summary_resolved = "All hosts are running the same commit again";
}; };
} }
]; ];