diff --git a/templates/telegram-bot.py.j2 b/templates/telegram-bot.py.j2 index ffc4d8d..db5a997 100755 --- a/templates/telegram-bot.py.j2 +++ b/templates/telegram-bot.py.j2 @@ -22,9 +22,9 @@ def postAlertmanager(chatID): for alert in content['alerts']: message = "Status: "+alert['status']+"\n" if 'name' in alert['labels']: - message += "Instance: "+alert['labels']['instance']+"("+alert['labels']['name']+")\n" + message += "Instance: "+alert['labels'].get('instance', 'unknown')+"("+alert['labels']['name']+")\n" else: - message += "Instance: "+alert['labels']['instance']+"\n" + message += "Instance: "+alert['labels'].get('instance', 'unknown')+"\n" if 'info' in alert['annotations']: message += "Info: "+alert['annotations']['info']+"\n" if 'summary' in alert['annotations']: