一、监控exporter安装.
①、下载地址
Releases · prometheus/mysqld_exporter · GitHub

my.cnf内容.
[client]
host=127.0.0.1 #mysql ip
port=3306
user=your account #账号
password=yourpassword #密码
说明:这里的监控最好是单独建立一个业务账号并grant权限,类似搭建主从复制一样创建一个slave账号,这样便于统一管理.
②、启动服务
mysqld_exporter-0.14.0.windows-amd64>mysqld_exporter.exe --config.my-cnf=D://MySQL//mysql-5.7.29//mysqld_exporter-0.14.0.windows-amd64//my.cnf.txt
可以制作一个startup.bat

③、查看监控信息,端口是9104.

二、配置prometheus
①、配置监控任务
# mysql数据库
- job_name: 'Mysql'
static_configs:
- targets: ['192.168.1.6:9104']
②、启动prometheus


本文详细介绍了如何从下载mysqld_exporter、配置my.cnf文件,到启动监控服务,再到Prometheus配置和Grafana使用面板的过程,帮助读者快速上手MySQL监控。
最低0.47元/天 解锁文章
676

被折叠的 条评论
为什么被折叠?



