This is a Webhook server converting Prometheus Alertmanager webhook messages into MQTT messages.
The MQTT topic is taken from the MQTT_URL
's path, and the alert name is appended.
Example: With MQTT_URL=mqtts://user:[email protected]/alerts/grafana
, an alert named "My Alert" is published to /alerts/grafana/My Alert
.
$ (cd deployment && ansible-playbook playbook.yml)
-
Iterate with
entr
:$ find . -name '*.go' -or -name '*.tmpl' -type f | entr -r go run . --verbose
-
Listen to MQTT messages:
$ mosquitto_sub --url 'mqtts://user:[email protected]/alerts/grafana/#' -F %J | jq
-
Post a fixture to the running server:
$ curl -v localhost:8031 -d @fixtures/alert.json
If the server is running on a remote host and if it is listening to localhost only, a self-closing SSH tunnel helps:
$ ssh [email protected] -L 8031:localhost:8031 -f sleep 10 && curl -v localhost:8031 -d @fixtures/alert.json
Check .tmuxinator.yml
for an ready-to-launch configuration of the above.