mqtt-exporter

command module
v0.0.0-...-424354c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2020 License: MIT Imports: 9 Imported by: 0

README

mqtt-exporter

Publishes Prometheus metrics for last received message on a given MQTT topic.

Usage

Docker image is built and published to radhus/mqtt-exporter on Docker Hub.

docker run -p 8080:8080 radhus/mqtt-exporter:latest -url mqtt-server.domain:1883 -topic-pattern 'topic/+/pattern'

Then scrape http://localhost:8080/metrics to get:

# HELP mqtt_last_message MQTT topic time
# TYPE mqtt_last_message gauge
mqtt_last_message{topic="topic/11/pattern"} 1.5825474109081864e+09
mqtt_last_message{topic="topic/12/pattern"} 1.5825474109117537e+09

Simple Prometheus alert may look like:

- alert: NoIOTStateUpdate
  expr: (time() - mqtt_last_message{topic="topic/11/pattern"}) / 60 > 5
  for: 5m
  annotations:
    description: "IOT state has not updated in {{ $value }} minutes!"
    summary: "IOT state stopped updating"

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL