Prometheus-采集MySQL指标

mysql_exporter 项目地址:https://github.com/prometheus/mysqld_exporter

  • 云厂商地址: 1.1.1.1

  • 服务器地址: 2.2.2.2

1. 安装 mysql_exporter

mkdir /data

cd /usr/local/src

wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.15.0/mysqld_exporter-0.15.0.linux-amd64.tar.gz

mv mysqld_exporter-0.15.0.linux-amd64 /data/mysqld_exporter

cd /data/mysqld_exporter

cat >> mysql_node.cnf << EOF
[client]
host="1.1.1.1"
port=3306
user=exporter
password=123456
EOF

2. 数据库授权

3. 启动

  • 方式二,使用 systemd 管理

4. 检查是否收集了数据

5. Prometheus 配置

  • Prometheus 命令热加载, 我这里端口: 8090

6. Grafana 配置

根据喜好自行选择: https://grafana.com/grafana/dashboards

Last updated