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部署
# 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 &
[client]
host=127.0.0.1
user=root
password=******
Prometheus配置
- 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
即可
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/03/25/prometheus-grafana-using-mysqld-exporter-monitoring-mysql/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
共有 0 条评论