Skip to content

Interactive bot

Ilya Ableev edited this page Aug 17, 2017 · 3 revisions

MySQL backend supported only, sorry if you are using PostgreSQL.

Version 0.000001, use for your own risk

Edit settings, enable zbx_tg_daemon_enabled (False -> True), add your user_id or nickname (so that other users couldn't get any info).

zbx_tg_daemon_enabled = True
zbx_tg_daemon_enabled_ids = [6931850, ]
zbx_tg_daemon_enabled_users = ["ableev", ]
zbx_tg_daemon_enabled_chats = ["ZbxTg", ]

Specify db in the config

zbx_db_host = "localhost"
zbx_db_database = "zabbix"
zbx_db_user = "zbxtg"
zbx_db_password = "zbxtg"

Run bot, in infinite loop

while true; do python ZbxTgDaemon.py; sleep 1; done

Note: if you close command line, script dies. Use script in screen/`tmux.

Available commands

/triggers – shows active problems

/triggers host=www1 trigger=Nginx – filters active triggers by host and trigger

Refreshing graphs

In case you activated graph_buttons parameter (zbxtg;graph_buttons in action), you can get graphs with several buttons under it. Interactive bot will detect which button was pressed and send you new graph with current itemid.