ableev / Zabbix-in-Telegram

Zabbix Notifications with graphs in Telegram
MIT License
776 stars 233 forks source link

Markdown and Python3 #152

Open XaTTa6bl4 opened 5 years ago

XaTTa6bl4 commented 5 years ago

With python2, markdown errors are processed and corrected as described in https://github.com/ableev/Zabbix-in-Telegram/wiki/Markdown-and-HTML In log:

zbxtg_group.py: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 85
zbxtg_group.py: Original message has been fixed due to https://github.com/ableev/Zabbix-in-Telegram/wiki/Markdown-and-HTML

but with python3 we can see cyclic error:

zbxtg_group.py: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 85
zbxtg_group.py: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 85
zbxtg_group.py: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 85
zbxtg_group.py: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 85
zbxtg_group.py: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 85
zbxtg_group.py: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 85
...
ableev commented 5 years ago

@XaTTa6bl4 are you using emojis? If yes - I probably can fix it. If not - please, provide input and output, not just errors.

XaTTa6bl4 commented 5 years ago

Yes, I'm using emojis. Example:

/usr/lib/zabbix/alertscripts/zbxtg_group.py 'TGroup' '{{OK}} RECOVER: *Unavailable by ICMP ping*, IP:10.0.23.101' '_SwitchName_12_ zbxtg;markdown'
ableev commented 5 years ago

@XaTTa6bl4 thanks. Let's hope that users won't be using more than one emoji. Dirty hack applied. Please, test it.