Notice: 函数 WP_Scripts::localize 的调用方法不正确$l10n 参数必须是一个数组。若要将任意数据传递给脚本,请改用 wp_add_inline_script() 函数。 请查阅调试 WordPress来获取更多信息。 (这个消息是在 5.7.0 版本添加的。) in /data/www/appblog/wp-includes/functions.php on line 6131

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即可

上一篇 Prometheus + Grafana 使用 elasticsearch_exporter 监控 ElasticSearch
下一篇 Prometheus与Zabbix的对比