Closed kpetremann closed 7 months ago
Add an interactive test mode in CLI, to test the conversion of a topic+payload to a Prometheus metric.
Usage example
$ python ./exporter.py --test topic: zigbee2mqtt/0x00157d00032b1234 payload: {"temperature":26.24,"humidity":45.37} ## Debug ## parsed to: zigbee2mqtt_0x00157d00032b1234 {'temperature': 26.24, 'humidity': 45.37} INFO:mqtt-exporter:creating prometheus metric: PromMetricId(name='mqtt_temperature', labels=()) INFO:mqtt-exporter:creating prometheus metric: PromMetricId(name='mqtt_humidity', labels=()) ## Result ## # HELP mqtt_temperature metric generated from MQTT message. # TYPE mqtt_temperature gauge mqtt_temperature{topic="zigbee2mqtt_0x00157d00032b1234"} 26.24 # HELP mqtt_humidity metric generated from MQTT message. # TYPE mqtt_humidity gauge mqtt_humidity{topic="zigbee2mqtt_0x00157d00032b1234"} 45.37
Add an interactive test mode in CLI, to test the conversion of a topic+payload to a Prometheus metric.
Usage example