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']:
|
||||
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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue