NAME
gyptazy.ch

OPTIONS

CONTENT
Howto Integrate Matrix Alerts into Grafana (2024-05-07):

Unfortunately, Grafana does not support Matrix notification by default. While Matrix is originally a free and open-source chat service, it also provides API and Bot support which makes it handy for service notifications. With End-to-end encryption, open-source, self-hosting possibilities and multi client support it provides all necessary features to integrate this as a fast and reliable notification solution to receive any kind of monitoring alerts.

With the grafana-matrix-forwarder by Hector S., a Grafana integration for Matrix alert notifications can be easily done within just a few minutes. In this case, the grafana-matrix-forwarder (written in Go) just runs as a dedicated binary and accepts requests by http on port tcp/6000. The integration will follow as a webhook in Grafana.

The installation and configuration of this forwarder is pretty easy and straight forward. The binary will just be copied and executed by a dedicated user.

    useradd -m grafanamatrixforwarder -s /bin/nologin
    cd /tmp/
    wget https://gitlab.com/hectorjsmith/grafana-matrix-forwarder/-/releases/v0.8.0/downloads/grafana-matrix-forwarder_0.8.0_linux_amd64.tar.gz
    tar xfz grafana-matrix-forwarder_0.8.0_linux_amd64.tar.gz
    cp grafana-matrix-forwarder /usr/bin/
    chown grafanamatrixforwarder:grafanamatrixforwarder /usr/bin/grafana-matrix-forwarder

Afterwards, the grafana-matrix-forwarder can already be used in theory. But this requires you to run in it always manually. However, if you like, you can already run or test it by starting it with the following command:

    grafana-matrix-forwarder --user USER --password PASSWORD --homeserver SERVER

Note: Make sure to replace your user, password and homeserver.

Now, the service is already running and can be used. The further configuration will be done in the Grafana web interface. Therefore, just login to the web frontend and go to:

Grafana Webhook Matrix

    Alert -> Contact points -> Add contact point

The new contact point will be created with the following options:

    name: matrix-channel-notification
    Integration: Webhook
    URL: http://localhost:6000/api/v1/unified?roomId=!CHANNELCHANNEL:gyptazy.ch

Note: Make sure to replace your server (if not running on the Grafana instance) and roomID.

Afterwards, the integration is done and the Matrix notifications can be used in general. Further customizing, linking to alerts etc. may be needed.

Resources:
* Overview binaries
* Github project
* grafana-matrix-forwarder 0.8.0 (Linux ARM64 binary)
* grafana-matrix-forwarder 0.8.0 (Linux AMD64 binary)