diff --git a/templates/rocketchat-bot.py.j2 b/templates/rocketchat-bot.py.j2 index 1e7bb0d..cd2353b 100755 --- a/templates/rocketchat-bot.py.j2 +++ b/templates/rocketchat-bot.py.j2 @@ -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"