Skip to content
Snippets Groups Projects
Verified Commit 846db899 authored by psy's avatar psy
Browse files

restructure template

parent 4dc10388
No related branches found
No related tags found
No related merge requests found
......@@ -27,10 +27,15 @@ def postAlertmanager(chatName):
for alert in content['alerts']:
message = ""
if alert['status'] == "firing":
message += ":warning: @here\n"
message += ":warning: "
else:
message += ":white_check_mark:\n"
message += "Status: **"+alert['status']+"**\n"
message += ":white_check_mark: "
if 'description' in alert['annotations']:
message += alert['annotations']['description']
message += " **"+alert['status']+"** "
if alert['status'] == "firing":
message += "@here"
message += "\n"
if 'name' in alert['labels']:
message += "Instance: "+alert['labels'].get('instance', 'unknown')+"("+alert['labels']['name']+")\n"
else:
......@@ -39,8 +44,6 @@ def postAlertmanager(chatName):
message += "Info: "+alert['annotations']['info']+"\n"
if 'summary' in alert['annotations']:
message += "Summary: "+alert['annotations']['summary']+"\n"
if 'description' in alert['annotations']:
message += "Description: "+alert['annotations']['description']+"\n"
if alert['status'] == "resolved":
correctDate = parser.parse(alert['endsAt']).strftime('%Y-%m-%d %H:%M:%S')
message += "Resolved: "+correctDate+"\n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment