add alertmanager formatter
This commit is contained in:
parent
8e1a0894f3
commit
bca1d919b2
1 changed files with 8 additions and 0 deletions
8
matrix_webhook/formatters/alertmanager.py
Normal file
8
matrix_webhook/formatters/alertmanager.py
Normal 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
|
Loading…
Add table
Reference in a new issue