You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've spent some time to figure out how to configure mqtt2prometheus for my Shelly 3em Energy Meter.
Guess this might be usefull to others as well and could be inlcuded in the configuration examples.
# Settings for the MQTT Client. Currently only these three are supported
mqtt:
# The MQTT broker to connect to
server: tcp://127.0.0.1:1883
# Optional: Username and Password for authenticating with the MQTT Server
# user: bob
# password: happylittleclouds
# The Topic path to subscribe to. Be aware that you have to specify the wildcard.
topic_path: shellies/shellyem3-123456789/emeter/+/+
# Use the phase number as device_id in order to see all three phases in /metrics
device_id_regex: "shellies/(.*)/emeter/(?P<deviceid>.*)/.*"
# Metrics are being published on a per-topic basis.
metric_per_topic_config:
metric_name_regex: "shellies/(?P<deviceid>.*)/emeter/(.*)/(?P<metricname>.*)"
# The MQTT QoS level
qos: 0
cache:
timeout: 60m
metrics:
- prom_name: power
mqtt_name: power
type: gauge
const_labels:
sensor_type: shelly
- prom_name: voltage
mqtt_name: voltage
type: gauge
const_labels:
sensor_type: shelly
Result in /metrics. Label "sensor" = energy meter phase
# HELP power
# TYPE power gauge
power{sensor="0",sensor_type="shelly",topic="shellies/shellyem3-123456789/emeter/0/power"} 35.4 1661984533463
power{sensor="1",sensor_type="shelly",topic="shellies/shellyem3-123456789/emeter/1/power"} 401.45 1661984533465
power{sensor="2",sensor_type="shelly",topic="shellies/shellyem3-123456789/emeter/2/power"} -2.31 1661984533467
# TYPE received_messages counter
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/0/current"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/0/pf"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/0/power"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/0/total"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/0/total_returned"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/0/voltage"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/1/current"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/1/pf"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/1/power"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/1/total"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/1/total_returned"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/1/voltage"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/2/current"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/2/pf"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/2/power"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/2/total"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/2/total_returned"} 4
received_messages{status="success",topic="shellies/shellyem3-123456789/emeter/2/voltage"} 4
# HELP voltage
# TYPE voltage gauge
voltage{sensor="0",sensor_type="shelly",topic="shellies/shellyem3-123456789/emeter/0/voltage"} 231.78 1661984533464
voltage{sensor="1",sensor_type="shelly",topic="shellies/shellyem3-123456789/emeter/1/voltage"} 232.46 1661984533466
voltage{sensor="2",sensor_type="shelly",topic="shellies/shellyem3-123456789/emeter/2/voltage"} 232.71 1661984533468
The text was updated successfully, but these errors were encountered:
I'm planning to deploy Shelly 3EM Pro in several days so I'm grateful for this example.
I however will have multiple of those devices so instead of hardcoding the device name I will need to find a better solution.
If you have an idea feel free to reply here otherwise I will attempt to make this example more universal later.
Hi,
I've spent some time to figure out how to configure mqtt2prometheus for my Shelly 3em Energy Meter.
Guess this might be usefull to others as well and could be inlcuded in the configuration examples.
Shelly 3em metrics example
shelly_3em.yaml configuration
Result in /metrics. Label "sensor" = energy meter phase
The text was updated successfully, but these errors were encountered: