telegram moved to version 2:
This commit is contained in:
parent
d2ca0938b9
commit
b5ed1037b0
1 changed files with 2 additions and 2 deletions
|
|
@ -37,11 +37,11 @@ def postAlertmanager(chatID):
|
||||||
elif alert['status'] == "firing":
|
elif alert['status'] == "firing":
|
||||||
correctDate = parser.parse(alert['startsAt']).strftime('%Y-%m-%d %H:%M:%S')
|
correctDate = parser.parse(alert['startsAt']).strftime('%Y-%m-%d %H:%M:%S')
|
||||||
message += "Started: "+correctDate+"\n"
|
message += "Started: "+correctDate+"\n"
|
||||||
message = telegram.utils.helpers.escape_markdown(message.replace('-', '\-').replace('.', '\.').replace('!', '\!').replace('[', '\[').replace(']', '\]') + "labels: \n```\n")
|
message += "labels: \n```\n"
|
||||||
for l in alert['labels']:
|
for l in alert['labels']:
|
||||||
message += l + " : "+alert['labels'][l] + "\n"
|
message += l + " : "+alert['labels'][l] + "\n"
|
||||||
message += "```"
|
message += "```"
|
||||||
bot.sendMessage(chat_id=chatID, text=message, parse_mode=telegram.ParseMode.MARKDOWN_V2)
|
bot.sendMessage(chat_id=chatID, text=telegram.utils.helpers.escape_markdown(message, version=2), parse_mode=telegram.ParseMode.MARKDOWN_V2)
|
||||||
return "Alert OK", 200
|
return "Alert OK", 200
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
bot.sendMessage(chat_id=chatID, text="Error to read json: "+str(error))
|
bot.sendMessage(chat_id=chatID, text="Error to read json: "+str(error))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue