1、mysqld_exporter的安装
官网地址:https://prometheus.io/download
wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.13.0/mysqld_exporter-0.13.0.linux-amd64.tar.gz
2、解压mysqld_exporter
tar xf mysqld_exporter-0.13.0.linux-amd64.tar.gz
mv mysqld_exporter-0.13.0.linux-amd64 /usr/local/mysqld_exporter
3、Mysql授权(因为Mysql在本机)
grant all on *.* to admin@'localhost' identified by '123456';
flush privileges;
4、创建mysql.cnf配置文件
cd /usr/local/mysqld_exporter
vim mysql.cnf
[client]
user=admin
password=123456
5、创建Mysqld_exporter启动脚本
vim /usr/lib/systemd/system/mysqld_exporter.s