no mention @here if warning

This commit is contained in:
psy 2023-09-07 12:24:01 +02:00
parent 60bb897613
commit d7cc4c7147
No known key found for this signature in database
GPG key ID: 30546501FF65B1A5

View file

@ -150,9 +150,13 @@ def postAlertmanager(chatName):
def send_alert_message(channel, alert): def send_alert_message(channel, alert):
message = "[**{state}**] [{instance}] {amendment}".format(state=alert['status'], message = "[**{state}**] [{instance}] {amendment} {mention}".format(
instance=alert['labels'].get('instance', 'unknown'), state=alert['status'],
amendment='@here' if alert['status'] == 'firing' else alert['annotations'].get('title')) 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 = []
# attach details if alert is firing # attach details if alert is firing