Giter Site home page Giter Site logo

datadog-webhook-telegram's Introduction

Prerequisites

export TELEGRAM_BOT_TOKEN='<BOT_TOKEN>'

export TELEGRAM_BOT_CHAT_ID='<BOT_CHAT_ID>'

  • Create new telegram channel and add the bot into it

Datadog Webhook Configuration

  • Login to Datadog

  • Navigate to Integrations -> Integrations -> Search for Webhooks -> Configure

  • Navigate to bottom and insert the Name and URL of the receiver

ex:

Name = Datadog Test
URL = https://0f379388.ngrok.io
  • Tick Use Custom Payload checkbox and fill the Custom Payload form with below payload sample
{
    "event_title": "$EVENT_TITLE",
    "alert_title": "$ALERT_TITLE",
    "tags": "$TAGS",
    "user": "$USER",
    "priority": "$PRIORITY",
    "text_only_msg": "$TEXT_ONLY_MSG",
    "snapshot": "$SNAPSHOT",
    "link": "$LINK",
    "alert_query": "$ALERT_QUERY"
}
  • Click Save Configuration Button

How to Test

  • Run webhook receiver -> python scripts/datadog_webhooks/telegram_webhooks.py

  • Create Testing Public URL using ngrok -> ngrok http 8090

  • Update datadog webhook configuration with Ngrok URL ( use https one)

  • Login to Datadog and configure Monitor to send alert to Webhook

  • Check telegram channel with bot

Deploy to Lambda

  • Switch to python3.7 -> virtualenv -p /usr/bin/python3.7 py37 && source py37/bin/activate
  • Install dependencies -> pip3.7 install -r requirements.txt
  • Create zappa_settings.json and insert below lines for lambda deployment configuration
{
    "production": {
        "app_function": "telegram_webhooks.app",
        "aws_region": "ap-southeast-1",
        "profile_name": "dev@midas",
        "project_name": "datadog-webhook",
        "runtime": "python3.7",
        "s3_bucket": "datadog-telegram-webhooks",
        "environment_variables": {
            "TELEGRAM_BOT_TOKEN":"<BOT_TOKEN>",
            "TELEGRAM_BOT_CHAT_ID":"<BOT_CHAT_ID>",
            "HTTP_AUTH_USERNAME":"<HTTP_AUTH_USERNAME>",
            "HTTP_AUTH_PASSWORD":"<HTTP_AUTH_PASSWORD>"
        }
    }
}
  • Deploy to Lambda using zappa deploy
  • Check the API Gateway URL using zappa status

Todos

  • Create conditional rule for automatic failover ( ex: ldc dynamodb)

datadog-webhook-telegram's People

Contributors

franzramadhan 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.