add alertmanager formatter

This commit is contained in:
Alex Kelly 2025-01-21 10:26:07 -05:00
parent 8e1a0894f3
commit bca1d919b2

View file

@ -0,0 +1,8 @@
def formatter(data, headers):
"""Pretty-print an alertmanager notification."""
text = ""
for alert in data['alerts']:
text += f"[{alert['status']}] - {alert['labels']['summary']}\n\n"
data["body"] = text
return data