Public | Automated Build

Last pushed: 2 years ago
Short Description
Full Description


Grafana dashboards for measuring MySQL performance with Prometheus and InfluxDB

This is a set of Grafana dashboards to be used with Prometheus datasource for MySQL and system monitoring.
The dashboards rely on alias label in the Prometheus config and depend from the small patch applied on Grafana.

  • Cross Server Graphs
  • Disk Performance (Grafana 3.0+)
  • Disk Space (Grafana 3.0+)
  • Galera Graphs
  • MySQL InnoDB Metrics
  • MySQL MyISAM Metrics
  • MySQL Overview
  • MySQL Performance Schema
  • MySQL Query Response Time
  • MySQL Replication
  • MySQL Table Statistics
  • MySQL User Statistics
  • Prometheus
  • Summary Dashboard
  • System Overview
  • TokuDB Graphs
  • Trends Dashboard

Setup instructions

Add datasource in Grafana

Prometheus should be a default datasource in Grafana. Otherwise, you will need to pick it up for each of the graphs.

Edit Prometheus config

The dashboards use alias label to work with individual hosts.
Ensure you have alias defined for each of your targets.
For example, if you want to monitor the excerpt of the config will be look like this:

  - job_name: prometheus
      - targets: ['localhost:9090']

  - job_name: linux
      - targets: ['']
          alias: db1

  - job_name: mysql
      - targets: ['']
          alias: db1

Note, adding a new label to the existing Prometheus instance will introduce a mess with the time-series.
So it is recommended to start using alias from scratch.

How you name jobs is not important. However, "Prometheus" dashboard assumes the job name is prometheus.

Also it is assumed that the exporters are run at least with this minimal set of options:

  • node_exporter: -collectors.enabled="diskstats,filesystem,loadavg,meminfo,netdev,stat,time,uname,vmstat"
  • mysqld_exporter: -collect.binlog_size=true -collect.info_schema.processlist=true

Edit Grafana config

Enable JSON dashboards by uncommenting those lines in grafana.ini:

enabled = true
path = /var/lib/grafana/dashboards

If you wish you may import the individual dashboards via UI and ignore this and the next steps.

Apply Grafana patch

It is important to apply the following minor patch on your Grafana installation in order to use the interval template variable to get the good zoomable graphs. The fix is simply to allow variable in Step field of graph editor page. For more information, take a look at PR#3757 and PR#4257. We hope the last one will be released soon.

Grafana 2.6.0:

sed -i 's/step_input:""/; s/ HH:MM/ HH:mm/; s/,function(c)/,"templateSrv",function(c,g)/; s/,c.panel.scopedVars)/' /usr/share/grafana/public/app/plugins/datasource/prometheus/query_ctrl.js
sed -i 's/h=a.interval/h=g.replace(a.interval, c.scopedVars)/' /usr/share/grafana/public/app/plugins/datasource/prometheus/datasource.js

Grafana 3.0.1:

sed -i 's/h=b.interval/h=i.replace(b.interval, a.scopedVars)/' /usr/share/grafana/public/app/plugins/datasource/prometheus/datasource.js
sed -i 's/,range_input/.replace(\/"{\/g,"\\"").replace(\/}"\/g,"\\""),range_input/; s/step_input:""/' /usr/share/grafana/public/app/plugins/datasource/prometheus/query_ctrl.js

Those changes are idemportent and do not break anything.

Install dashboards

git clone
cp -r grafana-dashboards/dashboards /var/lib/grafana/

Restart Grafana

service grafana-server restart

Update instructions

Simply copy the new dashboards to /var/lib/grafana/dashboards and restart Grafana.

Graph samples

Here is some sample graphs.

Docker Pull Command
Source Repository