时间:2021-07-01 10:21:17 帮助过:22人阅读
创建.my.cnf文件 vi .my.cnf:
[client]
user=exporter
password=123456
运行mysqld_exporter:
./mysqld_exporter -config.my-cnf=".my.cnf" &
修改prometheus.yml加入MySql节点:
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: [‘localhost:9090‘]
labels:
instance: prometheus
- job_name: linux1
static_configs:
- targets: [‘192.168.1.120:9100‘]
labels:
instance: sys1
- job_name: linux2
static_configs:
- targets: [‘192.168.1.130:9100‘]
labels:
instance: sys2
- job_name: redis1
static_configs:
- targets: [‘192.168.1.120:9121‘]
labels:
instance: redis1
- job_name: mysql
static_configs:
- targets: [‘192.168.1.120:9104‘]
labels:
instance: db1
保存以后重启Prometheus,查看targets:
最后登录grafana查看MySql监控信息:
参考文档:
https://github.com/prometheus/mysqld_exporter
Grafana+Prometheus系统监控之MySql
标签:oar src man 安装配置 span 文档 oca es2017 mysqld