Zabbix in Telegram Script
1.31K subscribers
8 photos
21 links
Channel for updates of tool "Zabbix in Telegram"
https://github.com/ableev/Zabbix-in-Telegram
Group chat: @ZbxTg
Download Telegram
Now we have the ability to send a location map (useful when you have filled inventory fields), details in https://github.com/ableev/Zabbix-in-Telegram/issues/48. Check the dev branch.
Simple daemon that can answer with trigger list, check the dev branch. Little documentation in the https://github.com/ableev/Zabbix-in-Telegram/issues/53
Forwarded from Ilia Ableev
/triggers
Severity: 5, Host: 127.0.0.1, Trigger: More than 0 items having missing data for more than 10 minutes
Interesting way to visualise trigger severities using emojis, see the wiki article: https://github.com/ableev/Zabbix-in-Telegram/wiki/Trigger-severity-as-Emoji
If you have something to share, don’t hide, join @ZbxTg and tell us about it.
Hi there. Quick but big update.
dev branch
https://github.com/ableev/Zabbix-in-Telegram/commit/614e78c9dcc8c43485d1cf1dabc60e1fcd0148b3
A lot of tasks were done.
• Added basic auth: #55
• added buttons under the graph image for interactive bot: #53
• ability to send several items in one graph: #66
• removed message editing from #37
• new option to send one message instead of two: #47

Don’t forget to update config file.
Try new version and report unexpected behaviour in @ZbxTg group.

Thanks!
Hello everyone! It's been awhile since last big changes.

Here some brief update (`dev` branch, as always):

1. Now you can get the warning right after the message: #77
2. Full list of supported features: #80
3. Some users expirienced problems with getting messages after enabling markdown support. Now the script is handling markdown parse errors and cut problematic symbols. Instead of not getting your messages, you will see some text and you will see warning in logs.
4. You don't need to create dedicated users anymore! Try to specify recipients in action, e.g. zbxtg;to:ableev or zbxtg;to_group:ZbxTgDevGroup (or zbxtg;to:@Zabbix_in_Telegram for public channel) #75
5. Now you can attach some external image for your messages, there is no examples, if you want use it, now you can do it (some users requested it) #71

Try new version (`dev` branch) and report unexpected behaviour in @ZbxTg group.

P.S.
Another good news!
I started to fill any available feature which is using in the script, check out the wiki: https://github.com/ableev/Zabbix-in-Telegram/wiki (some of pages are empty, but will be filled soon).
Users ask "how to send messages in private channel?".
Telegram bot api doesn't support sending to a private channel by design.
But it is possible to do "durty" hack: https://github.com/ableev/Zabbix-in-Telegram/wiki/Channel-support
Just fixed Python3 compatibility, https://github.com/ableev/Zabbix-in-Telegram/issues/101
Try dev branch, if you are using python3.
(Tested on basic stuff, such as graphs, emojis, multiple recipients).
If you find a bug, please, report to @ZbxTg or directly into the issue 101.
Thanks.
You can test new small feature: using {EVENT.AGE} macros to get graph with such period.
https://github.com/ableev/Zabbix-in-Telegram/issues/99
dev branch.
Usage is pretty simple:
zbxtg;graphs_age:{EVENT.AGE}
in your action.
Will work if the age is greater than 3600 seconds, in zabbix 2.x you can't get graph with period less than 3600 seconds.
Quick update.
1. dev branch merged to master, so all of the actual updates are include in master branch.
2. We created the international group for general (not about the script) questions about Zabbix: @ZabbixTech https://t.me/ZabbixTech join if you want to share your experience with others or if you have some problem implementing something, there might be someone who already faced the same problem. And of course invite friends and colleagues. Russian users could use @ZabbixPro for the same purpose.
The script if full compatible with python3 now.

Also it was checked with "2to3" python tool.

https://github.com/ableev/Zabbix-in-Telegram/issues/101
https://github.com/ableev/Zabbix-in-Telegram/issues/103

If you're using python3 and have problem using the script with it — please, do report to @ZbxTg group.
I've made some changes in ZbxTgDaemon.

1. MySQL support removed
2. API support enabled (this means PostgreSQL users can use the script now), you need to install pyzabbix module for python
3. Little help added
4. The old config is not working, zbx_tg_daemon_* parameters were renamed.

At least you can get list of active triggers right now. 🙂

Update to the latest version and run it just like that:
while true; do python ZbxTgDaemon.py; sleep 1; done

Do not forget to enable it in config:
zbx_tg_daemon_enabled should be True.
zbx_tg_daemon_enabled_ids should contain the list of ids who can communicate with the bot.

Groups are not supported yet (little steps, patience, I don't want compromise your production problems to someone else).

Thanks.
Little update.
We had a request to send message directly to userid, without setting a username.
https://github.com/ableev/Zabbix-in-Telegram/issues/141 — done, you can test it.
Works the same:
zbxtg.py 12345 test test
In case if "username" (first parameter) is digits — the script is not getting any info about user and tries no send the message to that user id.
Channel name was changed to «Zabbix in Telegram Script»
Hello.

Quick update for Zabbix 4.x users who wants to get graph with period more than 1 hour.
The behaviour has changed in Zabbix 4.0, now it has "from" and "to" arguments instead of "period" when getting a graph.
The code is fixed for now, but you need to put your zabbix's version to the config file:
#zbx_server_version = 2  # for Zabbix 2.x version
zbx_server_version = 3 # for Zabbix 3.x version, by default, not everyone updated to 4.x yet
#zbx_server_version = 4 # for Zabbix 4.x version, default will be changed in the future with this

https://github.com/ableev/Zabbix-in-Telegram/issues/149 - tested with Zabbix 3.x and Zabbix 4.x.

Try and share your results in @ZbxTg chat.
Another interesting feature which was implemented with two lines of code.

https://github.com/ableev/Zabbix-in-Telegram/issues/98

Now you can use "--tg-key" outside the config file with the key itself right after that option.

1. Create the first bot (add "--group" if you're using group).
2. Create the second bot (add "--group" if you're using group).
3. Do not forget to add such media to the user's profile.

You can manipulate with different keys and settings for different people and groups.