Grafana MySQL and InfluxDB annotations

What are Annotations and why are useful ?

Annotations is a way to add a Marker over the Graph (Panel). Depending on where you store the annotations, you would have the possibility to mark the Start and the End. This datasources support $start and $end in grafana:

  1. Grafana internal datastore
  2. Elasticsearch
  3. MySQL

Why are useful?

It’s a simple way of highlighting and visualization an action over a Graph. For example: Somebody is running a script over any element of the infrastructure. You can add tags, and text. In the tags you can add a datacenter, server, or a change ID and in the text, you can add a description and a hyperlink. This is very useful when you have an incident caused by a change in the infrastructure, because you will see when it started and finished the change over a metric (for example: successful logins). Obviously you need to have a good source of truth.

I’ve created a docker-compose environment and pushed into github:

If you check the file docker-compose.yml.all you will se that we have 3 docker containers: Grafana, MySQL and InfluxDB.

To install everything execute the bash script: It will ask you for a password (to connect to the databases) and it will replace the password in all the needed files. It will take 4-7 minutes depending on your environment. It also provision the datasources and two dashboards. If you want to know how the datasources/dashboards are provisiones, take a look into $PROJECT/grafana/dashboard.yml, datasource.yml, both .json files and the Dockerfile.

The previous script will also populate both databases with some example datapoints and annotations with this two scripts: and

Grafana Access:

URL: http://localhost:3000

The first time you access to grafana you will need to put: admin/admin (user/password) and then change it.

There are two provisioned dashboards:

An example of both Dashboards:

MySQL Dashboard
InfluxDB Dashboard

To stop everything you need to execute docker-compose -f docker-compose.yml.all down at the PROJECT level.

If you want to delete everything, Execute:

This last script won’t delete the data inside $PROJECT/influxdb/data and you will need to do it manually.

Please let me know if you have any question.


Leave a Reply