added @here for alerts in rocket chat
This commit is contained in:
parent
ae12f28eb4
commit
14503ce330
1 changed files with 2 additions and 2 deletions
|
|
@ -25,7 +25,7 @@ def postAlertmanager(chatName):
|
|||
try:
|
||||
content = json.loads(request.get_data())
|
||||
for alert in content['alerts']:
|
||||
message = "Status: "+alert['status']+"\n"
|
||||
message = "@here\nStatus: "+alert['status']+"\n"
|
||||
if 'name' in alert['labels']:
|
||||
message += "Instance: "+alert['labels'].get('instance', 'unknown')+"("+alert['labels']['name']+")\n"
|
||||
else:
|
||||
|
|
@ -47,7 +47,7 @@ def postAlertmanager(chatName):
|
|||
labels = ""
|
||||
for l in alert['labels']:
|
||||
labels += l + " : "+alert['labels'][l] + "\n"
|
||||
message += labels + "```"
|
||||
message += labels + "```\n"
|
||||
if api.chat_post_message(message, channel=chatName, alias='Alertmanager').ok:
|
||||
return "Alert OK", 200
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue