mysql
https://github.com/prometheus/mysqld_exporter
mysql授权
CREATE USER 'exporter'@'192.168.1.2' IDENTIFIED BY 'password';
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'192.168.1.2' WITH MAX_USER_CONNECTIONS 3;
commit;
FLUSH PRIVILEGES;
select User,Host,authentication_string,Password from mysql.user;
mysqld-exporter部署
date -R
mv /etc/timezone /etc/timezone-`date +%Y%m%d-%H%M%S`
echo 'Asia/Shanghai' > /etc/timezone
mv /etc/localtime /etc/localtime-`date +%Y%m%d-%H%M%S`
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
docker pull prom/mysqld-exporter
docker rm -f mysqld-exporter
docker run -d \
--name mysqld-exporter \
-v /etc/timezone:/etc/timezone \
-v /etc/localtime:/etc/localtime \
-p 9104:9104 \
-e DATA_SOURCE_NAME="exporter:password@(192.168.1.1:3306)/" \
--restart=unless-stopped \
prom/mysqld-exporter
docker logs -f --tail 10 mysqld-exporter
dashboard from
https://github.com/percona/grafana-dashboards/blob/master/dashboards/MySQL_Overview.json
2020.4.16 增加主从复制同步相关
Data source config
Collector config:
Upload an updated version of an exported dashboard.json file from Grafana
Revision | Description | Created | |
---|---|---|---|
Download |
MySQL
Monitor MySQL with Grafana. Easily monitor your MySQL deployment with Grafana Cloud's out-of-the-box monitoring solution.
Learn more