Solar Data Handling With Prometheus, Grafana And Docker

Now that we can pull the data from the local solar inverters, we need somewhere to store it. The excellent solismon3 discussed in the last post presents a simple page that Prometheus can consume to store the historic data.
The reporting partner to Prometheus is Grafana. This allows the creation of graphs/basic reporting of the data like this :
To bundle everything together I created two solismon3 docker images with the configuration for each inverter added. I then used docker-compose to run those along with Prometheus and Grafana as follows :
services:
prometheus:
image: prom/prometheus
container_name: prometheus
volumes:
- ./prometheus/data:/prometheus
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
expose:
- 9090
ports:
- 9090:9090
grafana:
image: grafana/grafana-oss
container_name: grafana
volumes:
- ./grafana/data:/var/lib/grafana
expose:
- 3000
ports:
- 3000:3000
solismon3-hybrid:
restart: unless-stopped
image: solismon3-hybrid
container_name: solismon3-hybrid
expose:
- 18000
ports:
- 18000:18000
solismon3-v5:
restart: unless-stopped
image: solismon3-v5
container_name: solismon3-v5
expose:
- 18001
ports:
- 18001:18001
The data volumes and configuration files are mapped into the containers from the local file system. I’ve chosen to expose the solisman endpoints to the host to make debugging easier.
I had a soare rasberry pi 4 and it seems easily powerful enough to run all the containers.
Prometheus needs to be told to connect to the solisman3 endpoint. Given that all the containers are running together, you can use the container-names defined in docker-compose within the Prometheus configuration :
global:
scrape_interval: 1m
scrape_timeout: 10s
evaluation_interval: 1m
scrape_configs:
- job_name: solarmon
honor_timestamps: true
scrape_interval: 1m
scrape_timeout: 10s
metrics_path: /metrics
scheme: http
follow_redirects: true
static_configs:
- targets:
- solismon3-hybrid:18000
- job_name: solarmon-v5
honor_timestamps: true
scrape_interval: 1m
scrape_timeout: 10s
metrics_path: /metrics
scheme: http
follow_redirects: true
static_configs:
- targets:
- solismon3-v5:18001