Tomdee

12Oct/150

Using Graphana with InfluxDB and Docker

Now that that I have InfluxDB running as part of my infrastructure, I need some way to display nice dashboards for the data I collect.

The best tool I can find for this job is Grafana. They have an active community, great graphing support, excellent support for InfluxDB and they even produce a good Docker image.

Running Grafana

docker run -d --restart=always -p 3000:3000 --link influxdb:influxdb -v /var/lib/grafana:/var/lib/grafana -v /var/log/grafana:/var/log/grafana -v /etc/grafana:/etc/grafana --name grafana grafana/grafana

Running Grafana is as simple as running the grafana/grafana container. The additional options are

  • To link to the influxdb container
  • The mount volumes for the data, logs and config
  • To expose the container on port 3000

Once the container is running, navigate to the http://host:3000 and login with admin/admin

Grafana documentation is great and it's very configurable; either by placing a config file in /etc/grapfana or by setting environment variables.

Upgrading Grafana

Since the container is stateless (all state is in volumes outside of the container), it can just be stopped, a new image pulled and a new container created.

Backing Up Grafana

Since I'm not using a custom config file, I just need to backup the /var/lib/grafana directory which contains the database storing the dashboards that I create.

e.g.tar -czvf grafana.$(date +%Y-%m-%d-%H.%M.%S).tgz /var/lib/grafana

 

Tagged as: , No Comments