boblemaire / IoTaWatt

IoTaWatt Open WiFi Electric Energy Monitor
https://iotawatt.com
GNU General Public License v3.0
639 stars 177 forks source link

FR: Prometheus Support #331

Closed snowzach closed 2 years ago

snowzach commented 2 years ago

It seems like it would be fairly trivial to add support for Prometheus. If you're not familiar, it requires an http endpoint and it exposes metrics in a really simple, human readable key/value format. It collects metrics by pulling data.

https://prometheus.io/docs/concepts/data_model/

I am thinking the easiest thing to expose would be a kwh counter or something like that and then gauges for everything else like freq and voltage. I am not sure how it's stored but a kwh counter would be nice vs say a guage which might miss a spike between readings. Not sure if it's possible to capture that info or not... Food for thought.

Suggestions:

iotawatt_power_current{device_name="<device_name>",input_name="<input_name"}=123  # Gauge value
iotawatt_power{device_name="<device_name>",input_name="<input_name"}=234234 # Counter value
iotawatt_voltage{device_name="<device_name>",phase?="<input_name"}=125.342 # Gauge value
iotawatt_frequency{device_name="<device_name>",phase?="<input_name"}=60.0 # Gauge value
snowzach commented 2 years ago

I opened PR #333 to add support.

boblemaire commented 2 years ago

Comment in PR.