
监控Mysql
linux环境下载:https://prometheus.io/download/
linux版本
下载
shell
wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.14.0/mysqld_exporter-0.14.0.linux-amd64.tar.gz解压
shell
tar -zxvf mysqld_exporter-0.14.0.linux-amd64.tar.gz -C /data
mv /data/mysqld_exporter-0.14.0.linux-amd64 /data/mysqld_exporter
cp /data/mysqld_exporter /usr/sbin创建数据库连接账号并授权
shell
create user 'mysqlexporter'@'%' identified by '123456';
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'mysqlexporter'@'%' identified by '123456';
flush privileges;创建连接数据库的配置文件
shell
cd /etc/mysqld_exporter
vim my.cnf
[client]
host=127.0.0.1
port=3306
user=mysqlexporter
password=123456启动服务
shell
/etc/mysqld_exporter/mysqld_exporter --config.my-cnf="/etc/mysqld_exporter/my.cnf"Grafana模版
ID: 11323

