matrix-webhook/matrix_webhook/formatters/alertmanager.py

9 lines
243 B
Python
Raw Normal View History

2025-01-21 10:26:07 -05:00
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