2022-08-08 23:08:58 +02:00
# Matrix AlertBot [![Built with matrix-nio](https://img.shields.io/badge/built%20with-matrix--nio-brightgreen)](https://github.com/poljar/matrix-nio) [![coverage report](https://gitlab.domainepublic.net/Neutrinet/matrix-alertbot/badges/master/coverage.svg)](https://gitlab.domainepublic.net/Neutrinet/matrix-alertbot/-/commits/master)
2019-09-25 14:26:29 +02:00
2022-08-08 12:48:56 +02:00
A bot that receives alert from [Alertmanager ](https://prometheus.io/docs/alerting/latest/alertmanager ) to send them to a Matrix room. Users can interract with the bot to create silences for the alerts.
2019-09-25 14:26:29 +02:00
2022-08-08 12:48:56 +02:00
Features include:
2020-08-16 18:46:05 +02:00
2022-08-08 12:48:56 +02:00
* Send alerts from Alertmanager to a Matrix room
* Add a reaction to an alert to create a silence until the alert is resolved
* Reply to an alert to create a silence with a given duration
* Reply to an alert to create a silence until the alert is resolved
* Remove silences created through the bot
2020-08-16 18:46:05 +02:00
* Participation in end-to-end encrypted rooms
## Getting started
2022-08-13 13:33:14 +02:00
See [SETUP.md ](SETUP.md ) for how to setup and run the bot.
See [CONTRIBUTING.md ](CONTRIBUTING.md ) for how to contribute to the project.
2019-10-04 15:54:36 +02:00
2019-09-25 14:26:29 +02:00
## Project structure
2022-06-13 20:55:01 +02:00
The majority of the code is kept inside of the `matrix_alertbot` folder, which
2022-08-13 13:48:49 +02:00
is in itself a [python package ](https://docs.python.org/3/tutorial/modules.html ),
2020-08-07 02:16:46 +02:00
the `__init__.py` file inside declaring it as such.
2022-06-13 20:55:01 +02:00
To run the bot, the `matrix-alertbot` script in the root of the codebase is
2020-08-09 23:34:23 +02:00
available. It will import the `main` function from the `main.py` file in the
2022-08-13 13:48:49 +02:00
package and run it. To properly install this script into your python environment,
2020-08-07 02:16:46 +02:00
run `pip install -e .` in the project's root directory.
2022-08-08 12:48:56 +02:00
`setup.py` contains package information (for publishing the code to
2020-08-07 02:16:46 +02:00
[PyPI ](https://pypi.org )) and `setup.cfg` just contains some configuration
options for linting tools.
2022-08-13 13:48:49 +02:00
`config.sample.yaml` is a sample configuration file. You should copy this file to `config.yaml` , then edit it according to
2022-08-08 12:48:56 +02:00
your needs. Be sure never to check the edited `config.yaml` into source control
2020-08-07 02:16:46 +02:00
since it'll likely contain sensitive details such as passwords!