grafana / mqtt-datasource

MQTT Datasource for Grafana allows streaming data from any MQTT broker running either locally or remotely.
Apache License 2.0
168 stars 49 forks source link

Allow parsing of '+' topic into fields #77

Open Elwell opened 1 year ago

Elwell commented 1 year ago

My use case is I have a bunch of sensors that publish temperature (example) to sensors/inside/temperature sensors/outside/temperature sensors/thing1/temperature sensors/thing2/temperature

which is easy to subscribe using syntax 'sensors/+/temperature', but then I'd like to extract the sensorname somehow, and couldn't see how to do this in the existing (OSS 9.5.2) transform options

Could this be done by adding a transform to split on '/' so I could at least use '$2' or allow me to set up my own variable name by letting me set a match such as sensors/[[devicename]]/temperature and i could then use $devicename as labels.

(not sure if this is the same sort of thing the author of issue #39 was looking for too)

Nocccer commented 5 months ago

Checkout #91