上传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/
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;
在根目录下创建my.cnf配置文件。vi my.cnf,添加以下内容:
[client] user=exporter password=Aa123456. port=3306
进入根目录下,输入以下命令:
nohup ./mysqld_exporter --config.my-cnf="my.cnf" & tail -1000f nohup.out
修改prometheus组件的prometheus.yml加入MySql节点:
保存以后重启Prometheus,查看targets:
官网查询:Mysql overView https://grafana.com/dashboards?search=MySql%20Ov
原文:https://www.cnblogs.com/caoweixiong/p/12133281.html