安装部署pmm2并监控mycat2

2年前 (2022) 程序员胖胖胖虎阿
390 0 0

安装部署pmm2并监控mycat2

  • 前言
  • 1. 安装 pmm2 服务端
    • 1.1 安装docker
    • 1.2 安装 pmm-server
    • 1.3 登录web-ui(grafana)
  • 2. 安装 pmm2 客户端
  • 3. 向 pmm-server注册mycat2开放的监控指标
    • 3.1 打开 mycat2 的监控指标
    • 3.2 向 pmm-server注册
      • 3.2.1 向pmm-server 注册mycat2 所在的主机节点
      • 3.2.2 向pmm-server 注册mycat2 的监控指标
      • 3.2.3 检测是否能查询到mycat2的监控指标
    • 3.3 导入mycat2的监控面板

前言

pmm 全称 Percona Monitoring and Management, 是 percona 公司的开源数据库监视器,其架构可通过官网文档 https://docs.percona.com/percona-monitoring-and-management/details/architecture.html 去了解,本质还是 prometheus + grafana 模式,但是使用更便利了。
部署环境如下:
主机1:centos7, ip=192.168.1.20,hostname=h20,安装 pmm2 的服务端,
主机2:centos7, ip=192.168.1.30,hostname=h30,安装 mycat2 和 pmm2 的客户端
主机3:windows10, ip=192.168.1.10, 什么也不用装,用于测试访问服务端提供的web-ui

1. 安装 pmm2 服务端

pmm2服务器安装在 主机1,以下均为在主机1 内的操作

1.1 安装docker

具体安装步骤参考:Install Docker Engine on CentOS 以下列出了关键命令

yum install -y yum-utils
# 安装 docker 仓库
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# 启用稳定版
yum-config-manager --enable docker-ce-stable
# 列出历史版本
yum list docker-ce --showduplicates |sort -r

# 安装 docker
yum install -y docker-ce docker-ce-cli containerd.io
# 查看docke 版本
docker -v

# 查看docker服务 状态
systemctl status docker
# 设置开机自启动
systemctl enable docker
# 取消开机自启动
systemctl disable docker
# 启动docker 服务
systemctl start docker
# 关闭 docker 服务
systemctl stop docker

1.2 安装 pmm-server

参考:https://docs.percona.com/percona-monitoring-and-management/setting-up/server/docker.html
关键命令如下:

# 拉取镜像
docker images
docker pull percona/pmm-server

# 创建持久化数据容器
docker create --volume /srv --name pmm-data percona/pmm-server /bin/true

# 启动 PMM 服务器(注意网络模式为与宿主机共用网络:--network host)
docker run --detach --restart always --network host --volumes-from pmm-data \
--name pmm-server percona/pmm-server

# 检查数据卷是否是 /srv, 否则可能会导致 PMM 数据丢失
docker inspect pmm-data |grep Destination && docker inspect pmm-server |grep Destination

# 容器常用操作
docker ps -a
docker stop pmm-server
docker restart pmm-server
docker rm pmm-server pmm-data

# 进入容器
docker exec -it pmm-server bash

# 开放端口(易漏操作)
firewall-cmd --zone=public --permanent --add-port=7771-7773/tcp --add-port=80/tcp --add-port=443/tcp
firewall-cmd --reload

以下为进入容器内的操作

# 修改时区
cp  /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# 查看时区是否为:CST
date

# 查看pmm-managed的错误日志
tail -100 /srv/logs/pmm-managed.log

1.3 登录web-ui(grafana)

在主机3浏览器打开: https://192.168.1.20,初始账号和密码都是 admin
安装部署pmm2并监控mycat2

2. 安装 pmm2 客户端

pmm2的客户端安装在mycat2 所在的主机上,用于收集mycat2的监控数据,

参考文档:https://docs.percona.com/percona-monitoring-and-management/setting-up/client/index.html
以下为使用yum安装方式,关键命令如下:

# 安装 percorna 系列产品的安装工具:percoan-release
yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm
# 查看启用的 percona 库
percona-release show

# 启用 pmm2-client 库
percona-release enable pmm2-client
# 查看历史版本
yum search --showduplicates pmm2-client
# 安装 pmm2-client
yum install -y pmm2-client

# 查看是否安装成功
pmm-admin -v

3. 向 pmm-server注册mycat2开放的监控指标

3.1 打开 mycat2 的监控指标

参考:mycat2权威指南 - 监控 - Prometheus与Grafana监控

以下命令 在主机2(mycat2 所在的主机)操作:

# 开放端口
firewall-cmd --zone=public --permanent --add-port=7066/tcp
firewall-cmd --reload

# 进入 mycat2 安装目录(每个人的可能与此不同)
cd /usr/local/mycat

# 修改配置文件
vi conf/server.json

server.json

{
  "properties":{"prometheusPort":7066}, //关键
  "server": {
    "serverVersion": "8.0.27-mycat-2.0",
    "bufferPool": {},
    "ip": "0.0.0.0",
    "mycatId": 1,
    "port": 8066
  }
}

在主机3 浏览器查看是否能访问到这些指标
http://192.168.1.20:7066/metrics

安装部署pmm2并监控mycat2

3.2 向 pmm-server注册

以下命令 在主机2(mycat2 所在的主机)操作:

3.2.1 向pmm-server 注册mycat2 所在的主机节点

pmm-admin list
pmm-admin status

pmm-admin config --server-insecure-tls --server-url=https://admin:admin@192.168.1.20:443 192.168.1.20 generic h20

可以看到多了一条node记录
安装部署pmm2并监控mycat2

3.2.2 向pmm-server 注册mycat2 的监控指标

# 注意 service-name=mycat-jvm,这个名称要与后面讲到的json 面板中设置的一致,所有不用改变这个名称
pmm-admin add external --scheme=http --listen-port=7066 --metrics-path=/metrics --service-name=mycat-jvm 

可以看到多了一条 service
安装部署pmm2并监控mycat2

3.2.3 检测是否能查询到mycat2的监控指标

在菜单“Explorer ” 中查询 mycat2 的 指标 jvm_info ,点 Run query 看是否有结果
安装部署pmm2并监控mycat2

3.3 导入mycat2的监控面板

依次单击菜单 +Importupload json file,上传 mycat2 提供的面板文件(先下载):Mycat2-monitor.json
安装部署pmm2并监控mycat2
安装部署pmm2并监控mycat2
导入之后的效果如下,可见这个面板是有问题的,需要简单修改下面板文件
安装部署pmm2并监控mycat2

删掉之前的面板,重新导入我修改后的面板文件(在文章末尾),修改后的面板显示效果如下
安装部署pmm2并监控mycat2
我修改后的面板文件(Mycat2-monitor-update.json):

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "0.01",
  "editable": true,
  "gnetId": null,
  "graphTooltip": 0,
  "id": 15,
  "iteration": 1593676032267,
  "links": [],
  "panels": [
    {
      "datasource": "Metrics",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 30,
      "interval": "1m",
      "maxDataPoints": 100,
      "options": {
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": true
      },
      "pluginVersion": "7.0.4",
      "targets": [
        {
          "expr": "mycat_cpu_utility{service_name=\"$service_name\",instance=\"$instance\"}",
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "timeFrom": "1h",
      "timeShift": null,
      "title": "CPU利用率",
      "type": "gauge"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Metrics",
      "description": "mycat2 客户端数量",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 6,
        "w": 24,
        "x": 0,
        "y": 7
      },
      "hiddenSeries": false,
      "id": 8,
      "interval": "1m",
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "maxDataPoints": 1000,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pluginVersion": "7.0.4",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "client_connection{service_name=\"$service_name\",instance=\"$instance\"}",
          "format": "time_series",
          "interval": "",
          "legendFormat": "",
          "refId": "B"
        }
      ],
      "thresholds": [],
      "timeFrom": "1h",
      "timeRegions": [],
      "timeShift": null,
      "title": "连接mycat2 客户端数量",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:1081",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:1082",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Metrics",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 13
      },
      "hiddenSeries": false,
      "id": 26,
      "interval": "1m",
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "maxDataPoints": 100,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pluginVersion": "7.0.4",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "thread_pool_active{service_name=\"$service_name\",instance=\"$instance\"}",
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": "1h",
      "timeRegions": [],
      "timeShift": null,
      "title": "线程池活跃线程数量",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:3411",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:3412",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "datasource": "Metrics",
      "description": "集群信息",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 24,
        "x": 0,
        "y": 21
      },
      "id": 24,
      "interval": "",
      "maxDataPoints": 1000,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        }
      },
      "pluginVersion": "7.0.4",
      "targets": [
        {
          "expr": "replica_available_value{service_name=\"$service_name\",instance=\"$instance\"}",
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "timeFrom": "1h",
      "timeShift": null,
      "title": "集群信息",
      "type": "stat"
    },
    {
      "datasource": "Metrics",
      "description": "数据源存活",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 24,
        "x": 0,
        "y": 26
      },
      "id": 28,
      "interval": "30s",
      "maxDataPoints": 1000,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        }
      },
      "pluginVersion": "7.0.4",
      "targets": [
        {
          "expr": "instance_acitve{service_name=\"$service_name\",instance=\"$instance\"}",
          "interval": "",
          "intervalFactor": 3,
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "timeFrom": "1h",
      "timeShift": null,
      "title": "数据源存活",
      "type": "stat"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Metrics",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 13,
        "w": 24,
        "x": 0,
        "y": 32
      },
      "hiddenSeries": false,
      "hideTimeOverride": false,
      "id": 22,
      "interval": "60s",
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "maxDataPoints": 100,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pluginVersion": "7.0.4",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "repeat": null,
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "heartbeat_stat{service_name=\"$service_name\",instance=\"$instance\"}",
          "format": "heatmap",
          "instant": false,
          "interval": "60",
          "intervalFactor": 10,
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": "1h",
      "timeRegions": [],
      "timeShift": null,
      "title": "心跳信息",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "transformations": [
        {
          "id": "filterFieldsByName",
          "options": {}
        }
      ],
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:2602",
          "format": "short",
          "label": "心跳请求响应时间",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:2603",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Metrics",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 13,
        "w": 24,
        "x": 0,
        "y": 45
      },
      "hiddenSeries": false,
      "id": 18,
      "interval": "30m",
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "maxDataPoints": 100,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pluginVersion": "7.0.4",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "sql_stat{time_type=\"COMPILE_TIME\",service_name=\"$service_name\",instance=\"$instance\"}",
          "format": "table",
          "interval": "",
          "intervalFactor": 10,
          "legendFormat": "",
          "refId": "A"
        },
        {
          "expr": "sql_stat{time_type=\"RBO_TIME\",service_name=\"$service_name\",instance=\"$instance\"}",
          "format": "table",
          "interval": "",
          "intervalFactor": 10,
          "legendFormat": "",
          "refId": "B"
        },
        {
          "expr": "sql_stat{time_type=\"CBO_TIME\",service_name=\"$service_name\",instance=\"$instance\"}",
          "format": "table",
          "interval": "",
          "intervalFactor": 10,
          "legendFormat": "",
          "refId": "C"
        }
      ],
      "thresholds": [],
      "timeFrom": "1h",
      "timeRegions": [],
      "timeShift": null,
      "title": "SQL编译优化时间",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:258",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:259",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "datasource": "Metrics",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 58
      },
      "id": 16,
      "interval": "1h",
      "maxDataPoints": 100,
      "options": {
        "showHeader": true
      },
      "pluginVersion": "7.0.4",
      "targets": [
        {
          "expr": "sql_stat{time_type=\"CONNECTION_QUERY_TIME\",service_name=\"$service_name\",instance=\"$instance\"}",
          "format": "table",
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "timeFrom": "1h",
      "timeShift": null,
      "title": "后端数据库查询响应时间",
      "type": "table"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Metrics",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 9,
        "w": 24,
        "x": 0,
        "y": 66
      },
      "hiddenSeries": false,
      "id": 14,
      "interval": "1m",
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "maxDataPoints": 100,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pluginVersion": "7.0.4",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "sql_stat{time_type=\"EXECUTION_TIME\",service_name=\"$service_name\",instance=\"$instance\"}",
          "format": "table",
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": "1h",
      "timeRegions": [],
      "timeShift": null,
      "title": "SQL执行器时间",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:171",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:172",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Metrics",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 10,
        "w": 24,
        "x": 0,
        "y": 75
      },
      "hiddenSeries": false,
      "id": 10,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pluginVersion": "7.0.4",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "sql_stat{time_type=\"TOTAL_TIME\",service_name=\"$service_name\",instance=\"$instance\"}",
          "format": "table",
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "SQL总查询时间",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:84",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:85",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Metrics",
      "description": "显示所有连接数",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 85
      },
      "hiddenSeries": false,
      "id": 2,
      "interval": "2m",
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "maxDataPoints": 9000,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pluginVersion": "7.0.4",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "client_connection{service_name=\"$service_name\",instance=\"$instance\"}",
          "format": "time_series",
          "interval": "",
          "legendFormat": "",
          "refId": "A"
        },
        {
          "expr": "jdbc_connection{type=\"total\",service_name=\"$service_name\",instance=\"$instance\"}",
          "format": "time_series",
          "interval": "",
          "legendFormat": "",
          "refId": "B"
        },
        {
          "expr": "native_mysql_connection{type=\"total\",service_name=\"$service_name\",instance=\"$instance\"}",
          "format": "time_series",
          "interval": "",
          "legendFormat": "",
          "refId": "C"
        },
        {
          "expr": "instance_connection{type=\"total\",service_name=\"$service_name\",instance=\"$instance\"}",
          "interval": "",
          "legendFormat": "",
          "refId": "D"
        }
      ],
      "thresholds": [],
      "timeFrom": "1h",
      "timeRegions": [],
      "timeShift": null,
      "title": "mycat2所有连接数",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:3785",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:3786",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Metrics",
      "description": "mycat2 使用连接数",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 9,
        "w": 24,
        "x": 0,
        "y": 93
      },
      "hiddenSeries": false,
      "id": 32,
      "interval": "1m",
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "maxDataPoints": 1000,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "jdbc_connection{type=\"use\",service_name=\"$service_name\",instance=\"$instance\"}",
          "interval": "",
          "legendFormat": "",
          "refId": "B"
        },
        {
          "expr": "native_mysql_connection{type=\"use\",service_name=\"$service_name\",instance=\"$instance\"}",
          "interval": "",
          "legendFormat": "",
          "refId": "C"
        }
      ],
      "thresholds": [],
      "timeFrom": "1h",
      "timeRegions": [],
      "timeShift": null,
      "title": "mycat2 使用连接数",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:2168",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:2169",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "Metrics",
      "description": "mycat2 native闲置连接数",
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 9,
        "w": 24,
        "x": 0,
        "y": 102
      },
      "hiddenSeries": false,
      "id": 6,
      "interval": "5m",
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "maxDataPoints": 1000,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "jdbc_connection{type=\"idle\",service_name=\"$service_name\",instance=\"$instance\"}",
          "interval": "",
          "legendFormat": "",
          "refId": "B"
        },
        {
          "expr": "native_mysql_connection{type=\"idle\",service_name=\"$service_name\",instance=\"$instance\"}",
          "interval": "",
          "legendFormat": "",
          "refId": "C"
        }
      ],
      "thresholds": [],
      "timeFrom": "1h",
      "timeRegions": [],
      "timeShift": null,
      "title": "mycat2 native闲置连接数",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:2168",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:2169",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    }
  ],
  "refresh": false,
  "schemaVersion": 25,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {
          "selected": false,
          "text": "7066",
          "value": "7066"
        },
        "datasource": "$datasource",
        "definition": "label_values(jvm_info{service_name=\"$service_name\"},instance)",
        "hide": 0,
        "includeAll": false,
        "label": "instance",
        "multi": false,
        "name": "instance",
        "options": [],
        "query": "label_values(jvm_info{service_name=\"$service_name\"},instance)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "current": {
          "selected": true,
          "text": "mycat-jvm",
          "value": "mycat-jvm"
        },
        "hide": 0,
        "label": "service_name",
        "name": "service_name",
        "options": [
          {
            "selected": true,
            "text": "mycat-jvm",
            "value": "mycat-jvm"
          }
        ],
        "query": "mycat-jvm",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "constant"
      },
      {
        "current": {
          "selected": false,
          "text": "Prometheus",
          "value": "Prometheus"
        },
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "datasource",
        "options": [],
        "query": "prometheus",
        "queryValue": "",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      }
    ]
  },
  "time": {
    "from": "now-1h",
    "to": "now"
  },
  "timepicker": {
    "hidden": false,
    "refresh_intervals": [
      "10s",
      "30s",
      "60s",
      "1m",
      "2m"
    ]
  },
  "timezone": "",
  "title": "Mycat2-monitor",
  "uid": "nl-RGWMGz",
  "version": 17
}

版权声明:程序员胖胖胖虎阿 发表于 2022年11月2日 下午1:16。
转载请注明:安装部署pmm2并监控mycat2 | 胖虎的工具箱-编程导航

相关文章

暂无评论

暂无评论...