Publishes MQTT messages as annotations (events) to Grafana.
- Subscribe to
home/frontdoor
andhome/backdoor
atmqtt.example.com
(authenticated asalice
with the passwords3cret
). - Publish each message received on one of these topics as Grafana annotation to
grafana.example.com
(authenticated asbob
with the passwordgeh3im
). The message payload is prefixed with$topic:
. - Tag each annotation with
mqtt
andhome
.
$ mqtt-grafana-event-publisher \
--mqtt-url mqtts://alice:[email protected] \
--grafana-url https://bob:[email protected] \
--verbose \
--topic home/frontdoor \
--topic home/backdoor \
--tag mqtt \
--tag home
As the URLs contain secrets, it is recommended to set them as environment variables MQTT_URL
GRAFANA_URL
instead of passing them as command line parameters.
$ find . -name '*.go' -type f | entr -r \
go run cmd/mqtt-grafana-event-publisher \
--verbose \
--topic home/door \
--tag mqtt \
--tag home