add Grafana Prometheus metric forwarding
This commit is contained in:
parent
45a314cf9d
commit
5137a8f063
|
|
@ -18,3 +18,25 @@ services:
|
||||||
tty: true
|
tty: true
|
||||||
volumes:
|
volumes:
|
||||||
- /home/joerg/nbit-mqtt/data-shellies:/data
|
- /home/joerg/nbit-mqtt/data-shellies:/data
|
||||||
|
|
||||||
|
mqtt2prometheus:
|
||||||
|
image: ghcr.io/hikhvar/mqtt2prometheus:latest
|
||||||
|
command:
|
||||||
|
- /mqtt2prometheus
|
||||||
|
- -log-level
|
||||||
|
- debug
|
||||||
|
- -config
|
||||||
|
- /config.yaml
|
||||||
|
ports:
|
||||||
|
- 9641:9641
|
||||||
|
volumes:
|
||||||
|
- type: bind
|
||||||
|
source: ./mqtt2prometheus-config.yaml
|
||||||
|
target: /config.yaml
|
||||||
|
|
||||||
|
prometheus:
|
||||||
|
image: prom/prometheus:latest
|
||||||
|
volumes:
|
||||||
|
- type: bind
|
||||||
|
source: ./prometheus.yml
|
||||||
|
target: /etc/prometheus/prometheus.yml
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
mqtt:
|
||||||
|
server: tcp://mqtt.nbit.ch:1883
|
||||||
|
user: mqtt
|
||||||
|
password: mqtt7355@
|
||||||
|
topic_path: shellies/events/rpc
|
||||||
|
device_id_regex: "(.*/)?(?P<deviceid>.*)"
|
||||||
|
qos: 0
|
||||||
|
cache:
|
||||||
|
timeout: 24h
|
||||||
|
json_parsing:
|
||||||
|
separator: .
|
||||||
|
metrics:
|
||||||
|
# The name of the metric in prometheus
|
||||||
|
- prom_name: aenergy_total
|
||||||
|
# The name of the metric in a MQTT JSON message
|
||||||
|
mqtt_name: params.switch:0.aenergy.total
|
||||||
|
# The prometheus help text for this metric
|
||||||
|
help: total energy
|
||||||
|
# The prometheus type for this metric. Valid values are: "gauge" and "counter"
|
||||||
|
type: gauge
|
||||||
|
# A map of string to string for constant labels. This labels will be attached to every prometheus metric
|
||||||
|
const_labels:
|
||||||
|
sensor_type: shelly
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
global:
|
||||||
|
scrape_interval: 5m
|
||||||
|
scrape_timeout: 10s
|
||||||
|
evaluation_interval: 15s
|
||||||
|
scrape_configs:
|
||||||
|
- job_name: mqtt2prometheus
|
||||||
|
honor_timestamps: true
|
||||||
|
scrape_interval: 5m
|
||||||
|
scrape_timeout: 10s
|
||||||
|
metrics_path: /metrics
|
||||||
|
scheme: http
|
||||||
|
static_configs:
|
||||||
|
- targets:
|
||||||
|
- mqtt2prometheus:9641
|
||||||
|
remote_write:
|
||||||
|
- basic_auth:
|
||||||
|
password: eyJrIjoiOWJlNzM1ODYzY2JjZmE5MTA5YTcyNzJlNTk3MjllY2U3YjViMDk1NSIsIm4iOiJzdGFjay00NDQyODktZWFzeXN0YXJ0LXByb20tcHVibGlzaGVyIiwiaWQiOjcxNzI1MX0=
|
||||||
|
username: 589349
|
||||||
|
url: https://prometheus-prod-01-eu-west-0.grafana.net/api/prom/push
|
||||||
Loading…
Reference in New Issue