Giter VIP home page Giter VIP logo

matrix-alertmanager's Introduction

issue tracker

GitHub mirror: https://github.com/jaywink/matrix-alertmanager

Matrix-Alertmanager

A bot to receive Prometheus Alertmanager webhook events and forward them to chosen rooms.

Main features:

  • Uses pre-created Matrix user to send alerts using token auth.
  • Configurable room per alert receiver.
  • Automatic joining of configured rooms. Private rooms require an invite.
  • Secret key authentication with Alertmanager.
  • HTML formatted messages.
  • Optionally mentions @room on firing alerts

How to use

Configuration

Whether running manually or via the Docker image, the configuration is set via environment variables. When running manually, copy .env.default into .env, set the values and they will be loaded automatically. When using the Docker image, set the environment variables when running the container.

Docker

The Docker image jaywink/matrix-alertmanager:latest is the easiest way to get the service running. Ensure you set the required environment variables listed in .env.default in this repository.

Alertmanager

You will need to configure a webhook receiver in Alertmanager. It should looks something like this:

receivers:
- name: 'myreceiver'
  webhook_configs:
  - url: 'https://my-matrix-alertmanager.tld/alerts?secret=veryverysecretkeyhere'

The secret key obviously should match the one in the alertmanager configuration.

Prometheus rules

Add some styling to your prometheus rules

rules:
- alert: High Memory Usage of Container
  annotations:
    description: Container named <strong>{{\$labels.container_name}}</strong> in <strong>{{\$labels.pod_name}}</strong> in <strong>{{\$labels.namespace}}</strong> is using more than 75% of Memory Limit
  expr: |
    ((( sum(container_memory_usage_bytes{image!=\"\",container_name!=\"POD\", namespace!=\"kube-system\"}) by (namespace,container_name,pod_name, instance)  / sum(container_spec_memory_limit_bytes{image!=\"\",container_name!=\"POD\",namespace!=\"kube-system\"}) by (namespace,container_name,pod_name, instance) ) * 100 ) < +Inf ) > 75
  for: 5m
  labels:
    team: dev

NOTE! Currently the bot cannot talk HTTPS, so you need to have a reverse proxy in place to terminate SSL, or use unsecure unencrypted connections.

TODO

  • Registering an account instead of having to use an existing account

Tech

Node 14, Express, Matrix JS SDK

Help

Come chat in the https://matrix.to/#/#matrix-alertmanager:federator.dev room!

Author

Jason Robinson / https://jasonrobinson.me / @jaywink:federator.dev

License

MIT

matrix-alertmanager's People

Contributors

jaywink avatar abeluck avatar ssams avatar lyr avatar ptman avatar sbruder avatar daniego 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.