Have you ever thought "What am I doing with my life if I'm not storing and visualising my engine RPM on a daily basis?" No? Just me? Well fear not this tool bridges the gap between the data in your car and your prometheus instance. It leverages AndrOBD to read and store the data in an MQTT broker and this just reads that data and returns it when scraped.
This tool reads andrOBD data being stored in an MQTT broker and gives it to prometheus when scraped as an exporter.
All configuration is stored in the .env.example which is also able to configured as environment variables. Refer to the docker-compose.yml for an example.
If you don't have SSL setup properly on your broker you can configure MQTT_IGNORE_INVALID_CERTS=TRUE
to ignore any protential SSL errors, however I discourage this as your traffic can be read by anyone.
- You need AndrOBD configured and reading data from your OBDII device.
- Make sure it's connected and displaying your car data.
- Install the AndrOBD-MQTTPublisher plugin Available on F-Droid
- Information on how to configure it is available here: https://github.com/fr3ts0n/AndrOBD-Plugin/tree/master/MqttPublisher
- Configure it to publish it to your broker
- Take note of the message prefix you set (aka the topic)
- Have a look at your message broker to make sure the data is available
- I recommend MQTT Explorer
- Add the following job to your
prometheus.yml
file, noting the ip address on the last line pointing to the exporter:
- job_name: 'androbd'
metrics_path: "/"
# Override the global default and scrape targets from this job every 5 seconds.
scrape_interval: 30s
static_configs:
- targets: ["Ryan's Mitsubishi Lancer"]
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 192.168.1.103:3000 # Server exporter
- None of this would be possible without the great, open-source and easily intergratable software that is AndrOBD.