前言
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
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
yum install -y docker-ce docker-ce-cli containerd.io
docker -v
systemctl status docker
systemctl enable docker
systemctl disable docker
systemctl start 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
docker run --detach --restart always --network host --volumes-from pmm-data \
--name pmm-server percona/pmm-server
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
date
tail -100 /srv/logs/pmm-managed.log
1.3 登录web-ui(grafana)
在主机3浏览器打开: https://192.168.1.20 ,初始账号和密码都是 admin
2. 安装 pmm2 客户端
pmm2的客户端安装在mycat2 所在的主机上,用于收集mycat2的监控数据,
参考文档:https://docs.percona.com/percona-monitoring-and-management/setting-up/client/index.html 以下为使用yum安装方式,关键命令如下:
yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm
percona-release show
percona-release enable pmm2-client
yum search --showduplicates 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
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
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记录
3.2.2 向pmm-server 注册mycat2 的监控指标
pmm-admin add external --scheme=http --listen-port=7066 --metrics-path=/metrics --service-name=mycat-jvm
可以看到多了一条 service
3.2.3 检测是否能查询到mycat2的监控指标
在菜单“Explorer ” 中查询 mycat2 的 指标 jvm_info ,点 Run query 看是否有结果
3.3 导入mycat2的监控面板
依次单击菜单 + 、 Import 、upload json file ,上传 mycat2 提供的面板文件(先下载):Mycat2-monitor.json 导入之后的效果如下,可见这个面板是有问题的,需要简单修改下面板文件
删掉之前的面板,重新导入我修改后的面板文件(在文章末尾),修改后的面板显示效果如下 我修改后的面板文件(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
}
|