日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

EPG组合 (Exporter Prometheus Grafana) 监控MySQL

發布時間:2024/2/28 数据库 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 EPG组合 (Exporter Prometheus Grafana) 监控MySQL 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
環境說明 監控機10.0.0.200 服務器10.0.0.201
Prometheus的架構

在被監控服務器10.0.0.201安裝exporter 安裝node_exporter wgethttps://github.com/prometheus/node_exporter/releases/download/v0.15.1/node_exporter-0.15.1.linux-amd64.tar.gz tar zxvf node_exporter-0.15.1.linux-amd64.tar.gz cd node_exporter-0.15.1.linux-amd64 nohup ./node_exporter &
安裝mysqld_exporter 連接mysql授予權限mysql -uroot -p GRANT REPLICATION CLIENT, PROCESS ON *.* TO'exporter'@'localhost' identified by'123456'; GRANT SELECT ON performance_schema.* TO 'exporter'@'localhost'; flush privileges;
wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.10.0/mysqld_exporter-0.10.0.linux-amd64.tar.gz tar zxvf mysqld_exporter-0.10.0.linux-amd64 cd mysqld_exporter-0.10.0.linux-amd64 建立配置文件my.cnf [client] user=exporter password=123456 運行mysqld exporter nohup ./mysqld_exporter -config.my-cnf="my.cnf" &
在監控主機10.0.0.200安裝Prometheus wget https://github.com/prometheus/prometheus/releases/download/v2.0.0/prometheus-2.0.0.linux-amd64.tar.gz tar zxvf prometheus-2.0.0.linux-amd64.tar.gz cd prometheus-2.0.0.linux-amd64

prometheus.yml

global:scrape_interval: 5s # By default, scrape targets every 15 seconds.evaluation_interval: 15s# Attach these labels to any time series or alerts when communicating with# external systems (federation, remote storage, Alertmanager).#external_labels:# monitor: 'codelab-monitor'scrape_configs:- job_name: prometheusstatic_configs:- targets: ['10.0.0.200:9090']labels: instance: prometheus- job_name: linuxstatic_configs:- targets: ['10.0.0.201:9100']labels: instance: db1- job_name: mysqlstatic_configs:- targets: ['10.0.0.201:9104']labels:instance: db1

運行prometheus

nohup prometheus &

打開瀏覽器訪問http://10.0.0.200:9090

查看Status->Target



安裝Grafana yuminstallhttps://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.6.2-1.x86_64.rpm yum install fontconfig yum install freetype* yum install urw-fonts
Package details
  • Installs binary to?/usr/sbin/grafana-server
  • Copies init.d script to?/etc/init.d/grafana-server
  • Installs default file (environment vars) to?/etc/sysconfig/grafana-server
  • Copies configuration file to?/etc/grafana/grafana.ini
  • Installs systemd service (if systemd is available) name?grafana-server.service
  • The default configuration uses a log file at?/var/log/grafana/grafana.log
  • The default configuration specifies an sqlite3 database at?/var/lib/grafana/grafana.db
編輯配置文件/etc/grafana/grafana.ini 找到[dashboards.json] enabled = true path = /var/lib/grafana/dashboards
安裝dashboards git clone https://github.com/percona/grafana-dashboards.git cp -r grafana-dashboards/dashboards /var/lib/grafana/
運行grafana server systemctl start grafana-server
訪問grafana服務器 通過瀏覽器訪問http://10.0.0.200:3000, 默認用戶名和密碼是admin 建立數據源



查看dashboard

以下展現的是node_exporter采集的數據


以下展現的是mysqld_exporter采集的數據


grafana的圖表展現比cacti之類的確實漂亮多了。


參考資料

https://prometheus.io/

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

總結

以上是生活随笔為你收集整理的EPG组合 (Exporter Prometheus Grafana) 监控MySQL的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。