首页 > 数据库技术 > 详细

Prometheus(四)监控mysql

时间:2020-01-02 15:51:33      阅读:100      评论:0      收藏:0      [点我收藏+]

 

1.安装mysqld exporter

1.1.上传解压

上传mysqld_exporter-0.12.1.linux-amd64.tar安装包并解压到/usr/local目录

tar -xvf mysqld_exporter-0.12.1.linux-amd64.tar.gz
cd mysqld_exporter-0.12.1.linux-amd64/

 

1.2.创建mysql用户

mysqld_exporter需要连接Mysql,首先为它创建用户(exporter)并赋予所需的权限

CREATE USER exporter IDENTIFIED BY Aa123456.;
GRANT REPLICATION CLIENT, PROCESS ON *.* TO exporter@%;
GRANT SELECT ON performance_schema.* TO exporter@%;
FLUSH PRIVILEGES;

 

1.3.配置

在根目录下创建my.cnf配置文件。vi my.cnf,添加以下内容:

[client]
user=exporter
password=Aa123456.
port=3306

 

1.4.启动

进入根目录下,输入以下命令:

nohup ./mysqld_exporter --config.my-cnf="my.cnf" &
tail -1000f nohup.out

技术分享图片

 

  

2.Prometheus配置

2.1.配置

修改prometheus组件的prometheus.yml加入MySql节点:

技术分享图片

  

2.1.启动验证

保存以后重启Prometheus,查看targets:

技术分享图片

 

  

3.Grafana配置

3.1.下载仪表盘

官网查询:Mysql overView  https://grafana.com/dashboards?search=MySql%20Ov

技术分享图片

技术分享图片

 

3.2.导入仪表盘

技术分享图片

技术分享图片

技术分享图片

技术分享图片

技术分享图片

 

3.3.查看仪表盘

技术分享图片

Prometheus(四)监控mysql

原文:https://www.cnblogs.com/caoweixiong/p/12133281.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!