Skip to main content

A Telegram alert plugin for Cabot by Arachnys

Project description

Based on: https://github.com/lblasc/cabot-alert-slack

This is an alert plugin for the cabot service monitoring tool. It allows you to alert users using a Telegram chat room.

Installation

Enter the cabot virtual environment:

$ pip install cabot_alert_telegram
$ foreman stop

or:

$ pip install git+git://github.com/codesyntax/cabot_alert_telegram.git
$ foreman stop

Edit 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

Add cabot_alert_telegram to the installed apps in settings.py:

$ foreman run python manage.py syncdb
$ foreman start

Add manually an instance of the Alert Plugin (sometimes it is not added automatically):

$ 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 Bot

You need to create a Telegram bot which will be used to send the messages to the users. To create a new Telegram Bot check the official documentation at https://core.telegram.org/bots

You need to create a new Group Chat, add all your users to that chatroom and add also the Bot there.

To get the chat id, open https://telegram.me and select the group chat you previously created. Check the URL, it will be something like this:

https://web.telegram.org/#/im?p=g99999999

You need to not the value of p parameter (g99999999) and exchange g with a -: -99999999

This is a bit hacky, but I don’t know any other way to get the group id.

0.4 (2016-01-21)

0.3 (2015-07-02)

0.2 (2015-07-02)

0.1 (2015-07-02)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cabot_alert_telegram-0.4.tar.gz (4.5 kB view details)

Uploaded Source

File details

Details for the file cabot_alert_telegram-0.4.tar.gz.

File metadata

File hashes

Hashes for cabot_alert_telegram-0.4.tar.gz
Algorithm Hash digest
SHA256 d9b84d973bb5b4ef025f62519a82f43472a51eb3b859b6a0beb851cdb322b927
MD5 a7514310b8f6243b6ff0b559504f312b
BLAKE2b-256 e5ab9498a06dd054da23a175d4b865394451d14883fb515266155ce6c625df24

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page