I got this to work and am rather happy with it. I thought I would post some cliff’s notes on what I did for those who may want to go down the Docker route.
-
I installed both InfluxDB and Grafana using the official Docker images from Docker Hub:
docker pull influxdb
docker pull grafana/grafana -
I next configured them both to run as a service. I do not recycle containers (i.e. a new container gets built every time the service starts) so I mount the config file and a path for the InfluxDB and Grafana database files. Also, as a lesson learned I had to mount /etc/localtime to the containers to make the graphs generated by in the right timezone.
influxdb.service
[Unit]
Description=influxdb
Requires=docker.service
After=docker.service
[Service]
Restart=always
ExecStart=/usr/bin/docker run --name=%n -p 8083:8083 -p 8086:8086 -v /opt/influxdb:/var/lib/influxdb -v /opt/influxdb/influxdb.conf:/etc/influxdb/influxdb.conf:ro -v /etc/localtime:/etc/localtime:ro influxdb -config /etc/influxdb/influxdb.conf
ExecStop=/usr/bin/docker stop -t 2 %n ; /usr/bin/docker rm -f %n
[Install]
WantedBy=multi-user.target
grafana.service
[Unit]
Description=grafana
Requires=docker.service
After=docker.service
[Service]
Restart=always
ExecStart=/usr/bin/docker run --name=%n -p 3030:3000 -v /opt/influxdb/grafana.ini:/etc/grafana/grafana.ini -v /opt/influxdb:/var/lib/grafana -v /etc/localtime:/etc/localtime:ro grafana/grafana
ExecStop=/usr/bin/docker stop -t 2 %n ; /usr/bin/docker rm -f %n
[Install]
WantedBy=multi-user.target
NOTE: I had permission problems when I tried to mount the grafana.ini file ro which I haven’t resolved so I mount it rw as you see above.
-
Because I’m running in Docker, it was easier to use the web admin interface for InfluxDB instead of the cli interface. The commands are identical to @ThomDietrich’s above. However, there is a way to run the CLI, see the notes for the Docker image on DockerHub.
-
Grafana is supposed to support passing in changes to the config via environment variables rather than needing to mount the ini file but I couldn’t get it to work.
-
Creating the carts themselves is pretty easy. To put two Items with different scales (e.g. a Switch and a Temperature) on the same graph, you can configure a right hand axis and then move those Items to the right hand access by applying a Series Override in the Display tab.
-
To discover the panelID and see the general format of the URL to the chart press the Label of the graph, choose “Share” and select “Direct Link” at the bottom. This will open just an image of that chart in a separate tab.
NOTES:
- I still haven’t figured out how to set up the RP
- I also haven’t figured out how to make Grafana not interpolate certain series (e.g. see the Fan line above which is a Switch)
- I’ve noticed with the longer timer periods there can be a noticeable delay.