Arachnys开发的Cabot的Telegram警报插件
项目描述
基于:https://github.com/lblasc/cabot-alert-slack
这是cabot服务监控工具的警报插件。它允许您使用Telegram聊天室向用户发送警报。
安装
进入cabot虚拟环境
$ pip install cabot_alert_telegram $ foreman stop
或
$ pip install git+git://github.com/codesyntax/cabot_alert_telegram.git $ foreman stop
编辑 conf/*.env
CABOT_PLUGINS_ENABLED=cabot_alert_telegram=0.4 ... TELEGRAM_BOT_TOKEN=bot_token TELEGRAM_CHAT_ID=id of the chat where messages will be sent
将cabot_alert_telegram添加到settings.py中的已安装应用
$ foreman run python manage.py syncdb $ foreman start
手动添加警报插件实例(有时它不会自动添加)
$ ssh ubuntu@server $ source venv/bin/activate $ cd cabot $ foreman run -e conf/production.env python manage.py shell # point to the correct production.env file Python 2.7.3 (default, Dec 18 2014, 19:10:20) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from cabot_alert_telegram.models import TelegramAlert >>> ta = TelegramAlert() >>> ta.title = u'Telegram' >>> ta.save() >>> (Ctrl-D to exit)
Telegram机器人
您需要创建一个用于向用户发送消息的Telegram机器人。要创建新的Telegram机器人,请查看官方文档https://core.telegram.org/bots
您需要创建一个新的群聊,将所有用户添加到该聊天室,并将机器人也添加进去。
要获取聊天ID,请打开https://telegram.me并选择您之前创建的群聊。检查URL,它将类似于以下内容
https://web.telegram.org/#/im?p=g99999999
您需要记住p参数的值(g99999999),并将g替换为-:-99999999
这是一个有点黑客式的方法,但我不知道其他获取群组ID的方法。
0.6 (2018-05-29)
包含迁移[ex0ns]
0.5 (2016-11-07)
更简单的警报消息[garaolaza]
0.4 (2016-01-21)
重写readme [Mikel Larreategi <mlarreategi@codesyntax.com>]
删除不必要的slack测试[Mikel Larreategi <mlarreategi@codesyntax.com>]
添加空白以使链接正确可点击[Mikel Larreategi <mlarreategi@codesyntax.com>]
记录Telegram安装[Mikel Larreategi <mlarreategi@codesyntax.com>]
机器人文档 [Mikel Larreategi <mlarreategi@codesyntax.com>]
删除 [Mikel Larreategi <mlarreategi@codesyntax.com>]
0.3 (2015-07-02)
升级 [Mikel Larreategi <mlarreategi@codesyntax.com>]
警告文本更改 [Mikel Larreategi <mlarreategi@codesyntax.com>]
0.2 (2015-07-02)
记录机器人文档 [Mikel Larreategi <mlarreategi@codesyntax.com>]
重新格式化消息 [Mikel Larreategi <mlarreategi@codesyntax.com>]
重新格式化 [Mikel Larreategi <mlarreategi@codesyntax.com>]
文档 [Mikel Larreategi <mlarreategi@codesyntax.com>]
合并远程跟踪分支 ‘origin/master’ [Mikel Larreategi <mlarreategi@codesyntax.com>]
更新 README.md [Aitzol <anaberan@codesyntax.com>]
0.1 (2015-07-02)
历史! [Mikel Larreategi <mlarreategi@codesyntax.com>]
版本 [Mikel Larreategi <mlarreategi@codesyntax.com>]
项目详情
cabot_alert_telegram-0.6.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 1088031da3be3aa8d6afb65e4ca54953dde2dcd5c3c194d3a258256d03f66af5 |
|
MD5 | 0e8a905b5eb272953eebf39fc5914468 |
|
BLAKE2b-256 | ec05e0f7e22d96ffc43adfab216ace56bd0ae1f26746c3d0eaa7e49eb02f7186 |