项目作者: cho45

项目描述 :
Subscribe MQTT topics and export them to prometheus.
高级语言: Go
项目地址: git://github.com/cho45/mqtt_topic_exporter.git
创建时间: 2018-07-27T12:33:33Z
项目社区:https://github.com/cho45/mqtt_topic_exporter

开源协议:

下载


mqtt_topic_exporter

Subscribe MQTT topic and export them to prometheus.

  1. usage: mqtt_topic_exporter --mqtt.server=MQTT.SERVER --mqtt.topic=MQTT.TOPIC [<flags>]
  2. Flags:
  3. -h, --help Show context-sensitive help (also try --help-long and --help-man).
  4. --web.listen-address=":9981"
  5. Address on which to expose metrics and web interface.
  6. --web.telemetry-path="/metrics"
  7. Path under which to expose metrics.
  8. --mqtt.retain-time="1m" Retain duration for a topic
  9. --mqtt.server=MQTT.SERVER MQTT Server address URI mqtts://user:pass@host:port
  10. --mqtt.topic=MQTT.TOPIC Watch MQTT topic
  11. --log.level="info" Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal]
  12. --log.format="logger:stderr"
  13. Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true"
  14. --version Show application version.

Sample output:

  1. curl -s http://127.0.0.1:9981/metrics | grep mqtt
  2. # HELP mqtt_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, and goversion from which mqtt_exporter was built.
  3. # TYPE mqtt_exporter_build_info gauge
  4. mqtt_exporter_build_info{branch="",goversion="go1.10.3",revision="",version=""} 1
  5. # HELP mqtt_topic mqtt topic gauge
  6. # TYPE mqtt_topic gauge
  7. mqtt_topic{topic="/home/sensor/co2"} 462
  8. mqtt_topic{topic="/home/sensor/temp"} 31.171875