MySQL Monitoring

Requires Docker 1.10+

MySQL monitoring example using docker-compose to orchestrate a monitoring solution using grafana, prometheus & influxdb. It includes an example db node using mysql with a sample load generated by sysbench. The prometheus config is manually configured in this example, although could be edited to use your preferred service discovery solution. The prometheus configuration file can be found here: ./prometheus/config/prometheus.yml, the config is imported into the container on startup. When editing the prometheus configuration (to add/remove nodes, etc), you can restart the prometheus container individually to pick up the config changes.

Installation

  • If you don't have it installed already, install docker-compose (https://docs.docker.com/compose/install/)
  • cd to monitor and run: docker-compose up -d
  • To install an example db node with associated collectors, cd to example_dbnode and run: docker-compose up -d
  • To install only the collecters using docker (not required for the example dbnode), cd to collecters and run: docker-compose up -d

If you want to monitor other hosts edit the prometheus config file ./prometheus/config/prometheus.yml add additional targets or your service discovery of choice, and restart prometheus, cd to monitor and run: docker-compose restart prometheus

Default ports

  • Grafana: 3000
  • Prometheus: 9090
  • InfluxDB: 8083 8086
  • MySQL: 3306
  • Prometheus Node Exporter: 9100
  • Prometheus MySQL Exporter (High Res): 9104
  • Prometheus MySQL Exporter (Med Res): 9105
  • Prometheus MySQL Exporter (Low Res): 9106
  • cAdvisor: 8080

Example usage

Bring up monitor containers

cd monitor
docker-compose up -d

Bring up example db-node with node_exporter & mysqld_exporter

cd example_dnode
docker-compose up -d

Restart individual service

cd monitor
docker-compose restart prometheus

View mysqld log

cd example_dbnode
docker-compose logs mysqld