Code Monkey home page Code Monkey logo

alerter's Introduction

Alerter

Crates.io Docker Image Size (latest by date) GitHub Workflow Status

Telegram and Matrix bot for alerts from Alertmanager

Usage

Telegram preparations

  1. Create bot with BotFather and get token.

  2. Get your, group or channel chat id with Get My ID bot.

Matrix preparations

  1. Create user under which alerter will work.

  2. Add this user to room for alerts and get room_id.

After preparations:

  1. Configure alerter.

  2. Optionally check that messages are being sent and formatted correctly using this script:

    ./test.sh tg

    Or

    ./test.sh matrix
  3. Add alerter to receivers in your alertmanager.yml:

    receivers:
      - name: alerter_tg
        webhook_configs:
          - send_resolved: true
            url: "http://127.0.0.1:3030/tg"
      - name: alerter_matrix
        webhook_configs:
          - send_resolved: true
            url: "http://127.0.0.1:3030/matrix"

Templating

You can modify default templates for your needs, they are in Handlebars format. For Telegram alerter uses HTML style and for Matrix Markdown style.

Installation

Prebuilt packages

You can download prebuilt archive or Deb/RPM package from releases.

Docker

Pull image from DockerHub:

docker pull ultram4rine/alerter

In other cases, you need Rust installed.

Crates.io

You can install alerter from crates.io:

cargo install alerter

Then download needed template and run.

Build from source

  1. Clone repository:

    git clone https://github.com/ultram4rine/alerter.git
    cd alerter
  2. Build binary:

    cargo build --release
  3. Binary should be in target/release/alerter.

Build Deb or RPM package

See cargo-deb or cargo-generate-rpm instructions respectively.

Configuration

Use environment variables or command-line flags to configure alerter:

Environment variable Command-line flag Default Description
ALERTER_LISTEN_PORT --port (-p) 3030 Port to listen.
--tg Enable Telegram support.
ALERTER_TG_BOT_TOKEN --tg-token Telegram bot token. Required for Telegram support.
ALERTER_TG_CHAT_ID --tg-chat-id Telegram chat ID. Required for Telegram support.
ALERTER_TG_TMPL_PATH --tg-template-path templates/default.tg.hbs Path to handlebars template file. Required for Telegram support.
--matrix Enable Matrix support.
ALERTER_MATRIX_USERNAME --matrix-user Matrix username. Required for Matrix support.
ALERTER_MATRIX_PASSWORD --matrix-pass Matrix password. Required for Matrix support.
ALERTER_MATRIX_ROOM_ID --matrix-room-id Matrix room id. Required for Matrix support.
ALERTER_MATRIX_TMPL_PATH --matrix-template-path templates/default.matrix.hbs Path to handlebars template file for Matrix. Required for Matrix support.

alerter's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar ivansaratov avatar ultram4rine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

alerter's Issues

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.