From d7cc4c7147d4b8ab21044e4378bda8298a48f430 Mon Sep 17 00:00:00 2001 From: psy Date: Thu, 7 Sep 2023 12:24:01 +0200 Subject: [PATCH] no mention @here if warning --- templates/rocketchat-bot.py.j2 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/templates/rocketchat-bot.py.j2 b/templates/rocketchat-bot.py.j2 index 1ff4db4..8f31bf4 100755 --- a/templates/rocketchat-bot.py.j2 +++ b/templates/rocketchat-bot.py.j2 @@ -150,9 +150,13 @@ def postAlertmanager(chatName): def send_alert_message(channel, alert): - message = "[**{state}**] [{instance}] {amendment}".format(state=alert['status'], - instance=alert['labels'].get('instance', 'unknown'), - amendment='@here' if alert['status'] == 'firing' else alert['annotations'].get('title')) + message = "[**{state}**] [{instance}] {amendment} {mention}".format( + state=alert['status'], + instance=alert['labels'].get('instance', 'unknown'), + amendment=alert['annotations'].get('title'), + mention='@here' if alert['status'] == 'firing' and alert['labels']['severity'] == 'critical' else '' + ) + attach = [] # attach details if alert is firing