性能測試之數據庫監控分析工具Grafana+Prometheus


使用到 Grafana+Prometheus+Mysql_exportor

使用Prometheus和Grafana,可以快速的構建我們性能測試的絕大多數的監控模型:數據庫監控、服務器監控、Jvm監控、Tomcat監控、Mq監控、Redis監控、Consul監控、Haproxy監控、Nginx監控
....(明天見...)


構建正確和全鏈路的監控模型,是性能測試工作中必須的工作,也是性能測試的基礎。

搭建性能測試Mysql監控模型

效果圖

安裝Mysqld_exporter

在需要監控的數據庫服務器安裝

#下載地址
https://prometheus.io/download/

#下載
mysqld_exporter
node_exporter

#安裝
tar -xvf mysqld_exporter-0.12.1.linux-amd64.tar.gz
tar -xvf node_exporter-1.0.0-rc.0.linux-amd64.tar.gz

#創建配置文件
cd mysqld_exporter-0.12.1.linux-amd64
vi my.cnf
    [client]
    user=xxxxxx
    password=xxxx
    ip=xxxx
    port=xxx
    
#啟動
nohup ./mysqld_exporter --config.my-cnf=my.cnf & > mysqld_exporter.log 2>&1 & 
nohup ./node_exporter  > node_exporter.log 2>&1 & 

安裝Prometheus

#下載地址
https://prometheus.io/download/
#下載
prometheus
#安裝
tar -xvf prometheus-2.18.1.linux-amd64.tar.gz 
#修改配置文件
vi prometheus.ym
  - job_name: 'mysql'
    static_configs:
    - targets: ['數據庫ip:9104']
      labels:
        instance: 數據庫ip
  - job_name: 'linux'
    static_configs:
    - targets: ['數據庫ip:9100']
      labels:
        instance: db
#啟動
nohup ./prometheus  > prometheus.log 2>&1 &

安裝Grafana

#下載地址
https://grafana.com/grafana/download
#安裝
rpm -ivh grafana-6.7.3-1.x86_64.rpm
#啟動
systemctl start grafana-server
#訪問
ip:3000    賬號admin/admin

Grafana設置Data source


Grafana設置Dashboards

下載Mysql儀表盤

https://grafana.com/grafana/dashboards/7362

導入Mysql儀表盤

完成。監控包含豐富的計數器,監控指標。




掃一掃,關注我


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM