zoukankan      html  css  js  c++  java
  • 性能测试之数据库监控分析工具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仪表盘

    完成。监控包含丰富的计数器,监控指标。




    扫一扫,关注我

  • 相关阅读:
    js 数据格式化
    js 获取URL中参数
    微信公众平台JSSDK开发
    js 日期格式化及日期增减
    一句话的设计模式
    微信小程序开源项目库汇总
    bash 配置文件
    centos 设置时间为北京时间
    数据库一般数据的查询操作
    linux tmux 工具使用 tmux.conf 文件
  • 原文地址:https://www.cnblogs.com/hally/p/12899447.html
Copyright © 2011-2022 走看看