Giter Site home page Giter Site logo

cabot_alert_telegram's Introduction

Cabot Telegram Plugin

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/onagorodniuk/cabot_alert_telegram.git
$ foreman stop

    add CABOT_PLUGINS_ENABLED=cabot_alert_telegram==0.3

Edit conf/*.env:

CABOT_PLUGINS_ENABLED=cabot_alert_telegram=0.6
...
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.

cabot_alert_telegram's People

Contributors

erral avatar onagorodniuk avatar benjosantony avatar garaolaza avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.