prometheus监控MySQL-server

1 创建mysql导出器的用户和密码

GRANT REPLICATION CLIENT, PROCESS ON *.* TO 'prom'@'localhost' identified by '$password';
GRANT SELECT ON performance_schema.* TO 'prom'@'localhost';

2 下载导出器

wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.11.0/mysqld_exporter-0.11.0.linux-amd64.tar.gz -P /usr/local/

tar xf mysqld_exporter-0.11.0.linux-amd64.tar.gz

3 运行导出器

    1)创建 .my.cnf

$ cat .my.cnf 
[client]
user=prom
password=abc123

   2) 运行导出器

./mysqld_exporter --config.my-cnf=".my.cnf"

4 配置展示页面

   1)配置grafana

cat /etc/grafana/grafana.ini
[dashboards.json]
enabled = true
path = /etc/grafana/dashboards

  2)下载dashboards

git clone https://github.com/percona/grafana-dashboards.git
cp -r grafana-dashboards/dashboards /etc/grafana/
cd !$

  3) 重启grafana

systemctl restart grafana-server

 4 配置仪表盘

下载仪表盘文件

https://raw.githubusercontent.com/percona/grafana-dashboards/master/dashboards/MySQL_Overview.json

5 导入

056e0b79dbccabf23d82c3957feaae2a735.jpg

prometheus监控MySQL-server_第1张图片

      选择我们下载的MySQL_Overview.json导入即可

  6)查看仪表盘

prometheus监控MySQL-server_第2张图片

转载于:https://my.oschina.net/54188zz/blog/3067695

你可能感兴趣的:(prometheus监控MySQL-server)