Blog
Routing alertmanager alerts to matrix
There are numerous ways to route alerts from Prometheus’s alertmanager to matrix. I’ve been using Go-NEB for the past years but this has been discontinued. Since it has been discontinued, I had on my mind to move my setup to matrix Hookshot which is the recommended successor and also an official matrix project. While hookshot seems to be a perfect match if one wants to route numerous things to matrix, it seems “too much” if one just wants to route alerts from alertmanager.
A colleague from dNation Roman is working on observability for the SCS KaaS layer and looked at various ways of routing alerts from alertmanager to matrix. In the issue he outlines the following options:
- https://ems-docs.element.io/books/element-cloud-documentation/page/public-slack-bridge
- https://github.com/jaywink/matrix-alertmanager
- https://github.com/silkeh/alertmanager_matrix
- https://github.com/metio/matrix-alertmanager-receiver
When I read his conclusion, which is that matrix-alertmanager-receiver is the simplest of them, I immediately looked at it. Indeed, matrix-alertmanager-receiver is ideal if one just wants to route alerts and have simple templating of the messages.
Since in most environments where I run stuff, I automate them via ansible, I wrote a simple ansible role that will deploy matrix-alertmanager-receiver via docker: ansible-matrix-alertmanager-receiver-docker
The image is built from the dockerfile that Roman submitted to the project in this PR.
For a Kubernetes based deployment, you can check Roman’s work in this PR to the k8-observability MVP for SCS.