每一个你不满意的现在,都有一个你不努力的曾经。

prometheus和grafana实现Zookeeper集群监控


版本信息

prometheus      v2.37.8
grafana         v10.0.2
zookeeper       v3.7.1

1). 采用zookeeper_exporter方式采集数据

#注意:zookeeper 从3.6.0版本后自身加入了支持Prometheus的监控,在 zoo_sample.cfg 配置文件末尾可以看见
## Metrics Providers

# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true

2). 下载 zookeeper_exporter采集器

[root@local130 opt]# mkdir -p /opt/exporter
[root@local130 opt]# cd /opt/exporter
[root@local130 exporter]# wget https://github.com/carlpett/zookeeper_exporter/releases/download/v1.1.0/zookeeper_exporter
[root@local130 exporter]# chmod 755 zookeeper_exporter

3). 编写 zk 采集器启动服务

vim /lib/systemd/system/zkexporter.service

[Unit]
Description=zookeeper_exporter
After=network.target
[Service]
Type=simple
User=root
ExecStart=/opt/zookeeper_exporter -zookeeper 192.168.41.130:2181 -bind-addr :9143
Restart=on-failure
[Install]
WantedBy=multi-user.target

systemctl start zkexporter.service

systemctl status zkexporter.service

zookeeper 集群模式下,每台机器都安装并启动 zookeeper_exporter 采集器

4). 查看采集的 zookeeper 数据

curl localhost:9143/metrics

启动失败
# HELP zk_up Exporter successful
# TYPE zk_up gauge
zk_up 0

启动成功
# HELP zk_up Exporter successful
# TYPE zk_up gauge
zk_up 1

5). 修改 Prometheus 的配置文件 即 prometheus.yml

- job_name: "prd_zookeeper"
  static_configs:
   - targets: ['192.168.41.130:9143']
     labels:
      instance: 192.168.41.130
   - targets: ['192.168.41.131:9143']
     labels:
      instance: 192.168.41.131
   - targets: ['192.168.41.133:9143']
     labels:
      instance: 192.168.41.133

8). 遇到的问题

查看采集服务状态
systemctl status zkexporter.service
[root@local130 bin]# systemctl status zkexporter.service
● zkexporter.service - zookeeper_exporter
   Loaded: loaded (/usr/lib/systemd/system/zkexporter.service; disabled; vendor preset: disabled)
   Active: active (running) since Wed 2023-11-22 23:31:26 PST; 2min 57s ago
 Main PID: 29941 (zookeeper_expor)
    Tasks: 7
   CGroup: /system.slice/zkexporter.service
           └─29941 /opt/exporter/zookeeper_exporter -zookeeper 192.168.41.130:2181 -bind-addr :9143

Nov 22 23:33:33 local130 zookeeper_exporter[29941]: time="2023-11-22T23:33:33-08:00" level=info msg="Resetting Zookeeper statistics"
Nov 22 23:33:48 local130 zookeeper_exporter[29941]: time="2023-11-22T23:33:48-08:00" level=info msg="Fetching metrics from Zookeeper"
Nov 22 23:33:48 local130 zookeeper_exporter[29941]: time="2023-11-22T23:33:48-08:00" level=warning msg="Unexpected format of returned data, expected tab-separated key/value." data="mntr is not executed because it is not in the whitelist."
Nov 22 23:33:48 local130 zookeeper_exporter[29941]: time="2023-11-22T23:33:48-08:00" level=info msg="Resetting Zookeeper statistics"
Nov 22 23:34:03 local130 zookeeper_exporter[29941]: time="2023-11-22T23:34:03-08:00" level=info msg="Fetching metrics from Zookeeper"
Nov 22 23:34:03 local130 zookeeper_exporter[29941]: time="2023-11-22T23:34:03-08:00" level=warning msg="Unexpected format of returned data, expected tab-separated key/value." data="mntr is not executed because it is not in the whitelist."
Nov 22 23:34:03 local130 zookeeper_exporter[29941]: time="2023-11-22T23:34:03-08:00" level=info msg="Resetting Zookeeper statistics"
Nov 22 23:34:18 local130 zookeeper_exporter[29941]: time="2023-11-22T23:34:18-08:00" level=info msg="Fetching metrics from Zookeeper"
Nov 22 23:34:18 local130 zookeeper_exporter[29941]: time="2023-11-22T23:34:18-08:00" level=warning msg="Unexpected format of returned data, expected tab-separated key/value." data="mntr is not executed because it is not in the whitelist."
Nov 22 23:34:18 local130 zookeeper_exporter[29941]: time="2023-11-22T23:34:18-08:00" level=info msg="Resetting Zookeeper statistics"

这里出现 "mntr is not executed because it is not in the whitelist.",则在zookeeper 配置文件 zoo.cfg 中添加并保存
#开启四字命令
4lw.commands.whitelist=*

9).JSON Model(gnetId 12338)

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "prometheus",
          "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "description": "基于zookeeper_exporter创建的多数据中心,多集群dashboard,数据源为prometheus",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "gnetId": 12338,
  "graphTooltip": 0,
  "id": 20,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "prometheus",
        "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 2,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "background",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "10.0.2",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
          },
          "editorMode": "code",
          "expr": "sum(zk_up{instance=~\"$node\"})",
          "format": "time_series",
          "intervalFactor": 1,
          "range": true,
          "refId": "A"
        }
      ],
      "title": "活动节点数",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "max": 1000,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "index": 0,
                "value": null
              },
              {
                "color": "red",
                "index": 1,
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 5,
        "x": 2,
        "y": 0
      },
      "id": 8,
      "links": [],
      "options": {
        "displayMode": "lcd",
        "minVizHeight": 10,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "mean"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "valueMode": "color"
      },
      "pluginVersion": "10.0.2",
      "targets": [
        {
          "datasource": {
            "uid": "${DS_PROMETHEUS-SZGDS}"
          },
          "expr": "zk_open_file_descriptor_count{instance=~\"$node\"}",
          "format": "time_series",
          "instant": true,
          "intervalFactor": 1,
          "legendFormat": "{{instance}}",
          "refId": "A"
        }
      ],
      "title": "打开文件数",
      "type": "bargauge"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 6,
        "w": 6,
        "x": 7,
        "y": 0
      },
      "hiddenSeries": false,
      "id": 4,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "10.0.2",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
          },
          "expr": "zk_num_alive_connections{instance=~\"$node\"}",
          "format": "time_series",
          "instant": false,
          "intervalFactor": 1,
          "legendFormat": "{{instance}}",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "活动连接数",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "logBase": 1,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 13,
        "y": 0
      },
      "hiddenSeries": false,
      "id": 6,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "10.0.2",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "uid": "${DS_PROMETHEUS-SZGDS}"
          },
          "editorMode": "code",
          "expr": "zk_znode_count{instance=~\"$node\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "{{instance}}",
          "range": true,
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "znode数量",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "logBase": 1,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 6,
        "w": 6,
        "x": 18,
        "y": 0
      },
      "hiddenSeries": false,
      "id": 22,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "10.0.2",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "uid": "${DS_PROMETHEUS-SZGDS}"
          },
          "expr": "zk_watch_count{instance=~\"$node\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "{{instance}}",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "watch数",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "logBase": 1,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "decimals": 0,
          "mappings": [],
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 7,
        "w": 7,
        "x": 0,
        "y": 5
      },
      "id": 16,
      "links": [],
      "maxDataPoints": 3,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "table",
          "placement": "right",
          "showLegend": true,
          "values": [
            "value"
          ]
        },
        "pieType": "pie",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "6.2.5",
      "repeatDirection": "h",
      "targets": [
        {
          "datasource": {
            "uid": "${DS_PROMETHEUS-SZGDS}"
          },
          "expr": "zk_server_state{instance=~\"$node\"}",
          "format": "time_series",
          "instant": true,
          "intervalFactor": 1,
          "legendFormat": "{{instance}}--{{state}}",
          "refId": "A"
        }
      ],
      "title": "主从状态",
      "type": "piechart"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 6,
        "w": 6,
        "x": 7,
        "y": 6
      },
      "hiddenSeries": false,
      "id": 18,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "10.0.2",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "uid": "${DS_PROMETHEUS-SZGDS}"
          },
          "expr": "zk_outstanding_requests{instance=~\"$node\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "{{instance}}",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "堆积请求数",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "logBase": 1,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 6,
        "w": 5,
        "x": 13,
        "y": 6
      },
      "hiddenSeries": false,
      "id": 20,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "10.0.2",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "uid": "${DS_PROMETHEUS-SZGDS}"
          },
          "expr": "zk_pending_syncs{instance=~\"$node\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "{{instance}}",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "阻塞的sync操作",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "logBase": 1,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 6,
        "w": 6,
        "x": 18,
        "y": 6
      },
      "hiddenSeries": false,
      "id": 14,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "10.0.2",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "uid": "${DS_PROMETHEUS-SZGDS}"
          },
          "expr": "zk_avg_latency{instance=~\"$node\"}",
          "format": "time_series",
          "instant": false,
          "intervalFactor": 1,
          "legendFormat": "zk_avg_latency {{instance}}",
          "refId": "A"
        },
        {
          "datasource": {
            "uid": "${DS_PROMETHEUS-SZGDS}"
          },
          "expr": "zk_min_latency{instance=~\"$node\"}",
          "format": "time_series",
          "instant": false,
          "intervalFactor": 1,
          "legendFormat": "zk_min_latency {{instance}}",
          "refId": "B"
        },
        {
          "datasource": {
            "uid": "${DS_PROMETHEUS-SZGDS}"
          },
          "expr": "zk_max_latency{instance=~\"$node\"}",
          "format": "time_series",
          "instant": false,
          "intervalFactor": 1,
          "legendFormat": "zk_max_latency {{instance}}",
          "refId": "C"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "响应延时",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "logBase": 1,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 12
      },
      "hiddenSeries": false,
      "id": 10,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "10.0.2",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "uid": "${DS_PROMETHEUS-SZGDS}"
          },
          "expr": "zk_packets_sent{instance=~\"$node\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "{{instance}}",
          "refId": "B"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "发送数据",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "logBase": 1,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": {
        "type": "prometheus",
        "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
      },
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 12
      },
      "hiddenSeries": false,
      "id": 12,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "10.0.2",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "uid": "${DS_PROMETHEUS-SZGDS}"
          },
          "expr": "zk_packets_received{instance=~\"$node\"}",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "{{instance}}",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "收包数",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "logBase": 1,
          "show": true
        },
        {
          "format": "short",
          "logBase": 1,
          "show": true
        }
      ],
      "yaxis": {
        "align": false
      }
    }
  ],
  "refresh": "",
  "schemaVersion": 38,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "selected": true,
          "text": "prd_zookeeper",
          "value": "prd_zookeeper"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
        },
        "definition": "query_result(zk_up)",
        "hide": 0,
        "includeAll": false,
        "label": "集群",
        "multi": false,
        "name": "cluster",
        "options": [],
        "query": {
          "query": "query_result(zk_up)",
          "refId": "PrometheusVariableQueryEditor-VariableQuery"
        },
        "refresh": 1,
        "regex": "/.*job=\"([^\"]*).*/",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "current": {
          "selected": true,
          "text": "All",
          "value": "$__all"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
        },
        "definition": "query_result(zk_up{job=~\"$cluster\"})",
        "hide": 0,
        "includeAll": true,
        "label": "节点",
        "multi": false,
        "name": "node",
        "options": [],
        "query": {
          "query": "query_result(zk_up{job=~\"$cluster\"})",
          "refId": "PrometheusVariableQueryEditor-VariableQuery"
        },
        "refresh": 1,
        "regex": "/.*instance=\"([^\"]*).*/",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "current": {
          "selected": false,
          "text": "follower",
          "value": "follower"
        },
        "datasource": {
          "type": "prometheus",
          "uid": "a14f2f3a-8e4e-4bd7-bb93-3b23a82563e5"
        },
        "definition": "query_result(zk_server_state)",
        "hide": 2,
        "includeAll": false,
        "label": "状态",
        "multi": false,
        "name": "state",
        "options": [],
        "query": {
          "query": "query_result(zk_server_state)",
          "refId": "PrometheusVariableQueryEditor-VariableQuery"
        },
        "refresh": 1,
        "regex": "/.*state=\"([^\"]*).*/",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-5m",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "",
  "title": "zookeeper集群",
  "uid": "X0ShwjRMk",
  "version": 7,
  "weekStart": ""
}
Card image cap

每一个你不满意的现在,都有一个你不努力的曾经。