mysql_exporter:用于收集MySQL性能信息。默认监听端口:9104
项目地址:https://github.com/prometheus/mysqld_exporter
监控服务器下载Linux版mysql_exporter
部署配置监控MySQL服务器
tar zxf mysqld_exporter-0.13.0.linux-amd64.tar.gz
mv mysqld_exporter /usr/local/mysqld_exporter
cd /usr/local/mysqld_exporter
vi conf/test.cnf ---配置被监控MySQL的信息
[client]
user=root
password=123456
port=3306
host=192.168.1.99
nohup ./mysqld_exporter --config.my-cnf="conf/test.cnf" --web.listen-address=":9104" & ---启动mysqld_exporter
配置监控MySQL主机
cd /usr/local/prometheus
vi prometheus.yml
scrape_configs:
- job_name: '数据库'
static_configs:
- targets: ['localhost:9104'] ---因为数据库信息通过本地的9104端口采集
Grafana导入仪表盘