restructure template
This commit is contained in:
parent
4dc103886d
commit
846db89950
1 changed files with 8 additions and 5 deletions
|
|
@ -27,10 +27,15 @@ def postAlertmanager(chatName):
|
||||||
for alert in content['alerts']:
|
for alert in content['alerts']:
|
||||||
message = ""
|
message = ""
|
||||||
if alert['status'] == "firing":
|
if alert['status'] == "firing":
|
||||||
message += ":warning: @here\n"
|
message += ":warning: "
|
||||||
else:
|
else:
|
||||||
message += ":white_check_mark:\n"
|
message += ":white_check_mark: "
|
||||||
message += "Status: **"+alert['status']+"**\n"
|
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']:
|
if 'name' in alert['labels']:
|
||||||
message += "Instance: "+alert['labels'].get('instance', 'unknown')+"("+alert['labels']['name']+")\n"
|
message += "Instance: "+alert['labels'].get('instance', 'unknown')+"("+alert['labels']['name']+")\n"
|
||||||
else:
|
else:
|
||||||
|
|
@ -39,8 +44,6 @@ def postAlertmanager(chatName):
|
||||||
message += "Info: "+alert['annotations']['info']+"\n"
|
message += "Info: "+alert['annotations']['info']+"\n"
|
||||||
if 'summary' in alert['annotations']:
|
if 'summary' in alert['annotations']:
|
||||||
message += "Summary: "+alert['annotations']['summary']+"\n"
|
message += "Summary: "+alert['annotations']['summary']+"\n"
|
||||||
if 'description' in alert['annotations']:
|
|
||||||
message += "Description: "+alert['annotations']['description']+"\n"
|
|
||||||
if alert['status'] == "resolved":
|
if alert['status'] == "resolved":
|
||||||
correctDate = parser.parse(alert['endsAt']).strftime('%Y-%m-%d %H:%M:%S')
|
correctDate = parser.parse(alert['endsAt']).strftime('%Y-%m-%d %H:%M:%S')
|
||||||
message += "Resolved: "+correctDate+"\n"
|
message += "Resolved: "+correctDate+"\n"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue