Skip to content

Latest commit

 

History

History
65 lines (59 loc) · 1.38 KB

PROMETHEUS.md

File metadata and controls

65 lines (59 loc) · 1.38 KB

Integrate wmbusmeters with Prometheus

https://prometheus.io/

  1. Add a shell configuration key to /etc/wmbusmeters.conf:
shell=/usr/bin/curl localhost:9144/webhook --data "$METER_JSON"
  1. Create a grok_exporter configuration:
global:
  config_version: 3
input:
  type: webhook
  webhook_path: /webhook
  webhook_format: json_single
  webhook_json_selector: .meter
metrics:
- type: gauge
  name: water_consumption
  help: Cubic meters of water used
  match: 'multical21'
  value: '{{ index .extra "total_m3" }}'
  cumulative: false
  labels:
    media: '{{ index .extra "media" }}'
    id: '{{ index .extra "id" }}'
    name: '{{ index .extra "name" }}'
server:
  host: "[::]"
  port: 9144
  1. Start grok_exporter
docker-compose up -d

With:

version: '3'
services:
  grok_exporter:
    image: magentaaps/grok_exporter:latest-rc
    command: -config /srv/grok_exporter_config.yml
    ports:
      - 9144:9144
    volumes:
      - ./grok_exporter_config.yml:/srv/grok_exporter_config.yml
  1. Start wmbusmetersd

  2. Verify that metrics are flowing:

curl localhost:9144/metrics

Yields:

...
# HELP water_consumption Cubic meters of water used
# TYPE water_consumption gauge
water_consumption{id="11111111",media="cold water",name="MyColdTapWater"} 1.326
  1. Add grok_exporter as a scrape_target to Prometheus.