{"id":1557,"date":"2023-03-25T15:49:10","date_gmt":"2023-03-25T07:49:10","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1557"},"modified":"2023-04-27T21:36:45","modified_gmt":"2023-04-27T13:36:45","slug":"prometheus-grafana-using-mysqld-exporter-monitoring-mysql","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/25\/prometheus-grafana-using-mysqld-exporter-monitoring-mysql\/","title":{"rendered":"Prometheus + Grafana \u4f7f\u7528 mysqld_exporter \u76d1\u63a7 MySQL"},"content":{"rendered":"<p>Prometheus Exporters\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/prometheus.io\/docs\/instrumenting\/exporters\/\">https:\/\/prometheus.io\/docs\/instrumenting\/exporters\/<\/a><br \/>\nPrometheus Download\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/prometheus.io\/download\/\">https:\/\/prometheus.io\/download\/<\/a><br \/>\nmysqld_exporter\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/prometheus\/mysqld_exporter\">https:\/\/github.com\/prometheus\/mysqld_exporter<\/a><\/p>\n<h2>\u521b\u5efa Prometheus Data Sources<\/h2>\n<p><!-- more --><\/p>\n<p>\u6ce8\uff1amysqld_exporter\u6307\u5b9aData Sources\u4e3aPrometheus\uff08\u9996\u5b57\u6bcd\u5927\u5199\uff09<\/p>\n<h2>mysqld_exporter\u90e8\u7f72<\/h2>\n<pre><code># tar -zxf mysqld_exporter-0.12.0.linux-amd64.tar.gz -C \/usr\/local\/\n# mv \/usr\/local\/mysqld_exporter-0.12.0.linux-amd64 \/usr\/local\/mysqld_exporter\n# cd \/usr\/local\/mysqld_exporter\/\n# vim my.cnf\n# nohup .\/mysqld_exporter --config.my-cnf=my.cnf &amp;<\/code><\/pre>\n<pre><code>[client]\nhost=127.0.0.1\nuser=root\npassword=******<\/code><\/pre>\n<h2>Prometheus\u914d\u7f6e<\/h2>\n<pre><code class=\"language-yml\">- job_name: mysql\n  metrics_path: &quot;\/metrics&quot;\n  static_configs:\n    - targets: [&#039;192.168.16.22:9104&#039;]\n      labels:\n        instance: MySQL\n        group: inner<\/code><\/pre>\n<h2>Grafana Dashboard\u914d\u7f6e<\/h2>\n<p>Grafana Dashboard\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/percona\/grafana-dashboards\">https:\/\/github.com\/percona\/grafana-dashboards<\/a><\/p>\n<p>\u5bfc\u5165\u9879\u76ee\u4e2ddashboards\u76ee\u5f55\u4e0b\u7684<code>MySQL_Overview.json<\/code>\u5373\u53ef<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prometheus Exporters\uff1ahttps:\/\/prometheus.io\/docs\/instrum [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[386],"tags":[385,387],"class_list":["post-1557","post","type-post","status-publish","format-standard","hentry","category-monitor","tag-grafana","tag-prometheus"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1557","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1557"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1557\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1557"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1557"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1557"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}