Grafana Matrix Forwarder

${ Forward alerts from Grafana to a Matrix chat room }
2020-11-20

/* project archived */

This project provides a simple way to forward alerts generated by Grafana to a Matrix chat room.

An open network for secure, decentralized communication

I use Grafana a lot to gather and track metrics on various services and servers, and when something goes wrong I want to get an automated alert about it.

Since I use Matrix a lot already, it made sense to get the alerts there. But there was no native way in Grafana to do that, so I made this forwarder to handle that translation.

  • This tool exposes a HTTP endpoint to receive requests
  • Grafana has this endpoint configured as a contact point
  • When an alert is trigger, a POST request is sent to this tool, which handles forwarding it on to a Matrix chat

This was not the first time I experimented integrating with chat protocols though. My first experiments were with the XMPP protocol back around 2016.

But there are a couple of reasons why I prefer Matrix over XMPP:

  1. End-to-end encryption is more standard
  2. Better SDKs for building apps
  3. Better, more modern chat clients

I wanted a practical project to test out building something that integrates with Matrix, and this is what I came up with.