ableev / Zabbix-in-Telegram

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

KeyError: 'message_id' #188

Open rmalenko opened 4 years ago

rmalenko commented 4 years ago

Helo,

I have got this error

zbxtg.py: {'ok': True, 'result': {'id': 1054514541, 'is_bot': True, 'first_name': '***_alert', 'username': '****_bot'}}
zbxtg.py: Cache file with uids: /var/tmp/zbxtg/uids.txt
zbxtg.py: Telegram uid of group '9******68': 9******68
zbxtg.py: http://zabbix-***.com/chart3.php?from=now-10800&to=now&name=ah-s**.com%20-%20zabbix-agent%20service%20not%20running&width=900&height=200&graphtype=0&legend=1&items[0][itemid]=29689&items[0][sortorder]=0&items[0][drawtype]=5&items[0][color]=00CC00
{'ok': True, 'result': {'id': 1054514541, 'is_bot': True, 'first_name': '***_alert', 'username': '***_father_bot'}}
Traceback (most recent call last):
File "/etc/zabbix/alertscripts/zbxtg.py", line 939, in <module>
main()
File "/etc/zabbix/alertscripts/zbxtg.py", line 899, in main
message_id = tg.result["result"]["message_id"]
KeyError: 'message_id'
jtprogru commented 4 years ago

I commented out the line with checking this key - this solved the problem

ableev commented 4 years ago

I don't know the input and don't know what's inside the telegram's answer. Do as it said: https://github.com/ableev/Zabbix-in-Telegram/wiki/How-to-test-script-in-command-line Use actual data from zabbix.