Prometheus + Grafana 使用 mysqld_exporter 监控 MySQL

Prometheus Exporters:https://prometheus.io/docs/instrumenting/exporters/
Prometheus Download:https://prometheus.io/download/
mysqld_exporter:https://github.com/prometheus/mysqld_exporter

创建 Prometheus Data Sources

注:mysqld_exporter指定Data Sources为Prometheus(首字母大写)

mysqld_exporter部署

1
2
3
4
5
# tar -zxf mysqld_exporter-0.12.0.linux-amd64.tar.gz -C /usr/local/
# mv /usr/local/mysqld_exporter-0.12.0.linux-amd64 /usr/local/mysqld_exporter
# cd /usr/local/mysqld_exporter/
# vim my.cnf
# nohup ./mysqld_exporter --config.my-cnf=my.cnf &
1
2
3
4
[client]
host=127.0.0.1
user=root
password=******

Prometheus配置

1
2
3
4
5
6
7
- job_name: mysql
metrics_path: "/metrics"
static_configs:
- targets: ['192.168.16.22:9104']
labels:
instance: MySQL
group: inner

Grafana Dashboard配置

Grafana Dashboard:https://github.com/percona/grafana-dashboards

导入项目中dashboards目录下的MySQL_Overview.json即可

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :