From Engines to Graphs: Exploring Car Metrics Visualization with Grafana and Prometheus


In today's connected world, extracting and visualizing data from various sources is becoming increasingly relevant (if you are a metrics nerd or data driven). 

Today i wanted to share what could be a good way of tracking usages of connected cars which provide access to their dedicated apps via 4G connected SIMs inside vehicles

This specific usecase is relevant for BMW cars but as far as i see most of car brands nowadays provide a sort of custom application that may provide directly or indirectly a backend API with all the necessary data/metrics


Some other manufacturer examples are:

- skodaconnect

- seatconnect

- mercedes_me_api

- tesla-api

If you're a BMW owner, you might be interested in monitoring your car's metrics in a more usable format. 

That's where this exporter comes into play by connecting the My BMW App data (from bimmerconnected library) directly into your Grafana instance leveraging a Prometheus scraper job

In today's connected world, the extraction and visualization of data from various sources are gaining relevance, especially for metrics enthusiasts and data-driven individuals. 

In this blog post, we will explore a practical way to track the usage of connected cars, which provide access to dedicated apps via 4G-connected SIMs installed within the vehicles. 

While this use case focuses on BMW cars, it is worth noting that many car brands now offer custom applications that provide backend APIs with the necessary data and metrics.

Why Visualize Car Metrics? 

If you own a car, you might be interested in monitoring your car's metrics in a more user-friendly format. To address this need, i tried to implement an exporter that connects the data from the My BMW App directly to my Grafana instance, leveraging a Prometheus scraper instance. 

Before diving into the technical details, let's outline the main goals of this project.

Project Goals


The primary objectives of this project are as follows:

  1. Visualize all relevant data on a Grafana dashboard.
  2. Create alerts based on metric usage using Grafana Alerting.
  3. Generate monthly usage reports for live or static storage.
  4. Explore non-common Prometheus query language (PromQL) functions, such as predicting usage, autonomy, and costs.

Current Status

At the moment i have made some progress towards achieving these goals. 

Three out of the four objectives have been nearly completed, however, predicting metrics like range, which is highly variable due to driving and fuel usage, remains a challenging topic. 

The predict_linear function provided by Prometheus seems working well for metrics with low variations, such as mileages. (as in my specific case)

This function may also be not the proper one to be used and maybe a complete ML model should be trained and used for this case to be more correct

 For example:

  • Predicted range
  • Predicted current mileage



sum(predict_linear(range {job="bmw_exporter"}[4d],48*3600))



sum(predict_linear(currentMileages  {job="bmw_exporter"}[4d],48*3600))

How to implement it (TLDR)

To implement the solution described in this blog post, you will need the following components:

  1. Kubernetes cluster or the ability to deploy the exporter as a Docker container.
  2. Prometheus for scraping the exported data.
  3. Grafana for visualization.


In the accompanying repository (, you will find the Terraform implementation for deploying the necessary exporter resource and cronjob inside your Kubernetes cluster to trigger data refresh.


As an alternative you could deploy that via Docker or run the Golang code standalone alonside the bimmerconnected  library to generate the json datasets


The cool use-case of leveraging the ODB Port

To expand the scope of our car metrics with performance ones, we could draw inspiration from the informative blog post "Raspberry Pi Car Automation".

This post outlines the process of utilizing a wireless adapter and a Raspberry Pi to collect engine stats directly from the ODB port. By following that simple integration process (ODB + RPi + Mobile connection), we could extract more valuable insights and combine them with other metrics in Grafana.

A complete data-driven approach to car usage and performance, utilizing standardized metrics such as Prometheus, would revolutionize the way we optimize vehicle performance. 

While racing cars have been employing data-driven approaches for years to outperform their competition, this methodology can now extend to everyday car usage. With the advent of advanced sensors and onboard computers in modern vehicles, data can be collected on various aspects like engine performance, tire wear, aerodynamics, and driver inputs.




Visualizing car metrics on Grafana provides the owners with valuable insights into their car's cost and usage. 

By connecting the manifacturer data to Grafana using an exporter, users can create informative dashboards, set up alerts, and generate usage reports. 

Although predicting certain metrics remains a challenge, the overall project is a step towards making data more accessible and actionable for car owners.