Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 1.09 KB

README.markdown

File metadata and controls

33 lines (26 loc) · 1.09 KB

MQTT Grafana Event Publisher

Publishes MQTT messages as annotations (events) to Grafana.

Example

  1. Subscribe to home/frontdoor and home/backdoor at mqtt.example.com (authenticated as alice with the password s3cret).
  2. Publish each message received on one of these topics as Grafana annotation to grafana.example.com (authenticated as bob with the password geh3im). The message payload is prefixed with $topic: .
  3. Tag each annotation with mqtt and home.
$ 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.

Development

$ find . -name '*.go' -type f | entr -r \
    go run cmd/mqtt-grafana-event-publisher \
      --verbose \
      --topic home/door \
      --tag mqtt \
      --tag home