You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
marcel
4d8224d1cc
|
2 years ago | |
---|---|---|
conf | 2 years ago | |
exampleconf | 2 years ago | |
tests | 2 years ago | |
utils | 2 years ago | |
CHANGELOG.md | 2 years ago | |
LICENSE | 2 years ago | |
README.md | 2 years ago | |
requirements-dev.txt | 2 years ago | |
requirements-frozen.txt | 2 years ago | |
requirements.txt | 2 years ago | |
version.py | 2 years ago | |
victron_mqtt_exporter.py | 2 years ago |
README.md
Prometheus exporter for Victron MQTT devices
A purposely build Prometheus exporter for Victron Energy Cerbo GX MQTT devices.
(C) 2022 M. Konstapel https://meezenest.nl/mees
Based on the General purpose Prometheus exporter for MQTT from Frederic Hemberger. (https://github.com/fhemberger/mqtt_exporter)
Subscribes to one or more MQTT topics, and lets you configure prometheus metrics based on pattern matching.
Features
- Converts JSON string from Victron MQTT device topics to value readable by Prometheus.
- Sends keepalive signal to Victron Energy Cerbo GX MQTT device (every 30 seconds).
- Supported Metrics:
- standard metrics
- Gauge, Counter, Histogram, Summary
- additional
- Counter (Absolute):
- Same as Counter, but working with absolute numbers received from MQTT. Which is far more common, than sending the diff in each publish.
- e.g. a network counter or a rain sensor
- Enum:
- is a metric type not so common, details can be found in the OpenMetrics docs and Python client code.
- Allows to track as state by a know set of strings describing the state, e.g.
on/off
orhigh/medium/low
- Common sources would be a light switch oder a door lock.
- Counter (Absolute):
- standard metrics
- Comprehensive rewriting for topic, value/payload and labels
- similar to prometheus label rewrites
- regex allows almost every conversion
- e.g. to
- remove units or other strings from payload
- convert topic hierarchy into labels
- normalize labels
- check example configs
./exampleconf
and the configs in./test/test_data/
Usage
- Create a folder to hold the config (default:
conf/
) - Add metric config(s) in YAML format to the folder. Files are combined and read as a single config. (See
exampleconf/metric_example.yaml
for details) - Install dependencies with
pip3 install -r requirements-frozen.txt
- Run
./mqtt_exporter.py
Python dependencies
- paho-mqtt
- prometheus-client
- PyYAML
- yamlreader
TODO
- Add persistence of metrics on restart
- forget/age out metrics receiving no updates anymore