-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Description
Hey everyone,
I have the following issue with my Shelly 2pm g3. I have configured mqtt2prometheus with the following
mqtt:
server: tcp://127.0.0.1:1883
user: USERNAME
password: PASSWORD
client_id: mqtt2prometheusExporter-shelly
topic_path: shellies/+/status/+
device_id_regex: "shellies/.*/status/(?P<deviceid>.*)"
qos: 0
cache:
timeout: 24h
state_directory: "/var/lib/mqtt2prometheus"
metrics:
- prom_name: meters_electricity_consumption_kwh_total
mqtt_name: "aenergy.total"
help: "Total consumed energy in Kilowatt-hours"
type: counter
- prom_name: meters_electricity_production_kwh_total
mqtt_name: "ret_aenergy.total"
help: "Total consumed energy in Kilowatt-hours"
type: counter
And this is what is delivered as metrics:
# HELP meters_electricity_consumption_kwh_total Total consumed energy in Kilowatt-hours
# TYPE meters_electricity_consumption_kwh_total counter
meters_electricity_consumption_kwh_total{sensor="switch:0",topic="shellies/shelly2pmg3-balcony/status/switch:0"} 14506.001 1770022860084
meters_electricity_consumption_kwh_total{sensor="switch:1",topic="shellies/shelly2pmg3-balcony/status/switch:1"} 258099.939 1770022860111
# HELP meters_electricity_production_kwh_total Total consumed energy in Kilowatt-hours
# TYPE meters_electricity_production_kwh_total counter
meters_electricity_production_kwh_total{sensor="switch:0",topic="shellies/shelly2pmg3-balcony/status/switch:0"} 0 1770022860084
meters_electricity_production_kwh_total{sensor="switch:1",topic="shellies/shelly2pmg3-balcony/status/switch:1"} 258024.916 1770022860112
# HELP mqtt2prometheus_connected Whether the mqtt2prometheus exporter is connected to the broker
# TYPE mqtt2prometheus_connected gauge
mqtt2prometheus_connected 1
# HELP mqtt2prometheus_received_messages_total Total number of messages received per topic and status
# TYPE mqtt2prometheus_received_messages_total counter
mqtt2prometheus_received_messages_total{status="success",topic="shellies/shelly2pmg3-balcony/status/switch:0"} 5
mqtt2prometheus_received_messages_total{status="success",topic="shellies/shelly2pmg3-balcony/status/switch:1"} 140
So, technically it is working as expected, but I would really like to have sensor as a composition of e.g. shelly2pmg3-balcony and switch:0 to e.g. shelly2pmg3-balcony:0. Is there already a way extract multiple strings from a topic to manually compose the sensor name?
Help would be greatly appreciated π
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels