Back to all posts
mysql-exporter
DevOps
Preface
Building a monitoring system with Prometheus + Grafana.
This article covers monitoring MySQL.
Steps
Modify MySQL Exporter Config File
[client]
user=exporter
password=xxx
host=172.31.44.128
port=3306
database=mysql
Install MySQL Exporter
docker run -d \
--name mysqld_exporter \
-p 9104:9104 \
-v /home/ec2-user/prometheus-mysql-exporter.cnf:/.my.cnf \
docker_url
Grant MySQL Permissions
CREATE USER 'exporter'@'localhost' IDENTIFIED BY 'XXXXXXXX' WITH MAX_USER_CONNECTIONS 3;
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'localhost';
Modify Prometheus Config File
- job_name: 'mysql'
static_configs:
- targets: ['172.31.44.128:9104']
labels:
instance: 'mysql-server-test'
Add Grafana Dashboard
Add a MySQL monitoring dashboard in Grafana.