prometheus+grafana监控mysql、canal服务器

一、prometheus配置

1.prometheus安装

1.1官网下载安装包:https://prometheus.io/download/

1.2解压安装包:tar -zxvf prometheus-2.6.1.linux-amd64.tar.gz 

1.3快速启动:进入解压目录并启动:./prometheus 默认使用解压目录下的prometheus.yml配置文件】

2.优化prometheus启动、停止

2.1创建日志记录文件:touch /var/log/prometheus.log

2.2添加服务prometheus服务:

$ cd /usr/lib/systemd/system
$ vim prometheus.service

 prometheus.service内容

[Unit]
Description=Prometheus
Documentation=https://prometheus.io/docs/introduction/overview/
Wants=network-online.target
After=network-online.target

[Service]
#User=prometheus  # 必须用该用户和相应的执行权限否则不能启动
#Group=prometheus
User=root
Group=root
Type=simple
ExecStart=/opt/prometheus/prometheus.sh  # 启动脚本

[Install]
WantedBy=multi-user.target

2.3启动脚本:vim /opt/prometheus/prometheus.sh

#!/bin/bash
/root/prometheus/prometheus-2.6.1.linux-amd64/prometheus --config.file=/root/prometheus/prometheus-2.6.1.linux-amd64/prometheus.yml &>> /var/log/prometheus.log

2.4启动、停止脚本:systemctl start prometheus.service / systemctl stop prometheus.service

2.5进入登录页面:ip:9090

prometheus+grafana监控mysql、canal服务器_第1张图片

二、安装grafana(centos)

1.1不同的操作系统具体参考官网:http://docs.grafana.org/

1.2(centos),配置文件为:/opt/grafana/grafana.ini

yum install https://dl.grafana.com/oss/release/grafana-5.4.2-1.x86_64.rpm

1.3启动:systemctl start grafana-server

1.4登录页面:ip:3000,账号密码默认:admin/admin

prometheus+grafana监控mysql、canal服务器_第2张图片 三、prometheus配置mysql

1.安装node_export、mysqld_export

#安装node_export
wget https://github.com/prometheus/node_exporter/releases/download/v0.14.0/node_exporter-0.14.0.linux-amd64.tar.gz -O node_exporter-0.14.0.linux-amd64.tar.gz

#安装mysqld_exporter
wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.10.0/mysqld_exporter-0.10.0.linux-amd64.tar.gz -O mysqld_exporter-0.10.0.linux-amd64.tar.gz

#创建目录
mkdir /usr/local/services
mkdir /usr/local/services/prometheus_exporters

#解压node_export
tar zxf node_exporter-0.14.0.linux-amd64.tar.gz -C /usr/local/services/prometheus_exporters --strip-components=1

#解压mysqld_exporter
tar zxf mysqld_exporter-0.10.0.linux-amd64.tar.gz -C /usr/local/services/prometheus_exporters --strip-components=1

1.2优化启动过程,类似prometheus

node_export进入解压目录直接启动: ./node_exporter 

mysqld_export 进入解压目录直接启动:./mysqld_exporter  -config.my-cnf=my.cnf

需要配置数据连接信息:需要注意权限问题

#解压文件夹目录创建文件
vim my.cnf

#内容,数据库账号密码
[client]
user=root
password=123456
port=3306

 

1.3启动node_export与mysqld_export

2.prometheus配置mysql

2.1修改prometheus.yml配置文件:

#修改
vim prometheus.yml

#添加:
 - job_name: 'mysql'
    static_configs:
    - targets: ['192.168.1.158:9104']
      labels:
        instance: 192.168.1.158
  - job_name: 'linux'
    static_configs:
    - targets: ['192.168.1.158:9100']
      labels:
        instance: db1

2.2重启服务,页面会看到

 

3.grafana配置

3.1Add prometheus datasource

prometheus+grafana监控mysql、canal服务器_第3张图片

2.添加mysql仪表盘:import 仪表盘

官网查询:Mysql overView  https://grafana.com/dashboards?search=MySql%20Ovprometheus+grafana监控mysql、canal服务器_第4张图片

prometheus+grafana监控mysql、canal服务器_第5张图片

prometheus+grafana监控mysql、canal服务器_第6张图片

prometheus+grafana监控mysql、canal服务器_第7张图片

 选择datasource 为 Prometheusprometheus+grafana监控mysql、canal服务器_第8张图片

四、增加canal监听 

1.1修改prometheus配置文件

vim prometheus.yml

#增加内容
 - job_name: 'canal'
    static_configs:
    - targets: ['localhost:11112']#canal服务ip

1.2grafana配置,增加canal仪表盘信息,如上,不过这次不是从官网下载,而是import外部文件

见下面:canal_instance.json

1.3重启服务可看到

prometheus+grafana监控mysql、canal服务器_第9张图片

canal_instance.json

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "5.2.2"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": "5.0.0"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "5.0.0"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": null,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1536989235272,
  "links": [],
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 30,
      "panels": [],
      "title": "Instance status",
      "type": "row"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "$datasource",
      "description": "Canal instance 基本信息。",
      "fill": 1,
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 0,
        "y": 1
      },
      "id": 24,
      "legend": {
        "alignAsTable": true,
        "avg": false,
        "current": false,
        "hideEmpty": false,
        "hideZero": false,
        "max": false,
        "min": false,
        "rightSide": true,
        "show": true,
        "sideWidth": 500,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "repeat": null,
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "canal_instance{destination=~\"$destination\"}",
          "format": "time_series",
          "instant": true,
          "intervalFactor": 1,
          "legendFormat": "Destination: {{destination}}",
          "refId": "A"
        },
        {
          "expr": "canal_instance_parser_mode{destination=~\"$destination\"}",
          "format": "time_series",
          "instant": true,
          "intervalFactor": 1,
          "legendFormat": "Parallel parser: {{parallel}}",
          "refId": "B"
        },
        {
          "expr": "canal_instance_store{destination=~\"$destination\"}",
          "format": "time_series",
          "instant": true,
          "intervalFactor": 1,
          "legendFormat": "Batch mode: {{batchMode}}",
          "refId": "C"
        },
        {
          "expr": "canal_instance_store{destination=~\"$destination\"}",
          "format": "time_series",
          "instant": true,
          "intervalFactor": 1,
          "legendFormat": "Buffer size: {{size}}",
          "refId": "D"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Basic",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "transparent": true,
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": false,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {
        "inbound": "#bf1b00"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "$datasource",
      "description": "Canal instance 网络带宽占用。\ninbound: 读取MySQL binlog.\noutbound: 对Client端传输格式化binlog.",
      "fill": 1,
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 6,
        "y": 1
      },
      "id": 6,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "rate(canal_instance_received_binlog_bytes{destination=~\"$destination\", parser=\"0\"}[2m]) / 1024",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "inbound",
          "refId": "A"
        },
        {
          "expr": "rate(canal_instance_client_bytes{destination=~\"$destination\"}[2m]) / 1024",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "outbound",
          "refId": "B"
        },
        {
          "expr": "rate(canal_instance_received_binlog_bytes{destination=~\"$destination\", parser=\"1\"}[2m]) / 1024",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "inbound-1",
          "refId": "C"
        },
        {
          "expr": "rate(canal_instance_received_binlog_bytes{destination=~\"$destination\", parser=\"2\"}[2m]) / 1024",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "inbound-2",
          "refId": "D"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Network bandwith",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "KBs",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {
        "ack": "#f29191",
        "get": "#cca300",
        "put": "#1f78c1"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "$datasource",
      "description": "master: Canal server相对于MySQL master的延时。通过master heartbeat机制能刷新idle状态下的延时。\nput: store put操作的时间点为基准。\nget: client get操作的时间点为基准。\nack:  client ack操作的时间点为基准。",
      "fill": 1,
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 12,
        "y": 1
      },
      "id": 4,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "canal_instance_traffic_delay{destination=~\"$destination\"} / 1000",
          "format": "time_series",
          "hide": false,
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "master",
          "refId": "D"
        },
        {
          "expr": "canal_instance_put_delay{destination=~\"$destination\"} / 1000",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "put",
          "refId": "A"
        },
        {
          "expr": "canal_instance_get_delay{destination=~\"$destination\"} / 1000",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "get",
          "refId": "B"
        },
        {
          "expr": "canal_instance_ack_delay{destination=~\"$destination\"} / 1000",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "ack",
          "refId": "C"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Delay",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "s",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "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": "$datasource",
      "description": "sink线程blocking占比;dump线程blocking占比(仅parallel mode)。",
      "fill": 1,
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 18,
        "y": 1
      },
      "hideTimeOverride": false,
      "id": 2,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "clamp_max(rate(canal_instance_publish_blocking_time{destination=~\"$destination\", parser=\"0\"}[2m]), 1000) / 10",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "dump",
          "refId": "B"
        },
        {
          "expr": "clamp_max(rate(canal_instance_sink_blocking_time{destination=~\"$destination\"}[2m]), 1000) / 10",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "sink",
          "refId": "A"
        },
        {
          "expr": "clamp_max(rate(canal_instance_publish_blocking_time{destination=~\"$destination\", parser=\"1\"}[2m]), 1000) / 10",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "dump-1",
          "refId": "C"
        },
        {
          "expr": "clamp_max(rate(canal_instance_publish_blocking_time{destination=~\"$destination\", parser=\"2\"}[2m]), 1000) / 10",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "dump-2",
          "refId": "D"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Blocking",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "percent",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 6
      },
      "id": 32,
      "panels": [],
      "title": "Throughput",
      "type": "row"
    },
    {
      "aliasColors": {
        "rowDatas": "#7eb26d",
        "tableRows": "#c15c17"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "$datasource",
      "description": "Instance处理binlog的TPS(以master变更行数table rows为基准计算)。\nput: put操作TPS。\nget: get操作TPS。\nack: ack操作TPS。",
      "fill": 1,
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 0,
        "y": 7
      },
      "id": 14,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "rate(canal_instance_put_rows{destination=~\"$destination\"}[2m])",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "put",
          "refId": "A"
        },
        {
          "expr": "rate(canal_instance_get_rows{destination=~\"$destination\"}[2m])",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "get",
          "refId": "B"
        },
        {
          "expr": "rate(canal_instance_ack_rows{destination=~\"$destination\"}[2m])",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "ack",
          "refId": "C"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "TPS(table rows)",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "iops",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {
        "transactions": "#f9ba8f"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "$datasource",
      "description": "Canal instance 处理binlog的TPS,以MySQL transaction为单位计算。",
      "fill": 1,
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 6,
        "y": 7
      },
      "id": 12,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "rate(canal_instance_transactions{destination=~\"$destination\"}[2m])",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "transactions",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "TPS(MySQL transaction)",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "iops",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 12
      },
      "id": 34,
      "panels": [],
      "title": "Client",
      "type": "row"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "$datasource",
      "description": "Canal instance接收到的请求统计,结果按packet type分类。",
      "fill": 1,
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 0,
        "y": 13
      },
      "id": 16,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "canal_instance_client_packets{destination=~\"$destination\"}",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "{{packetType}}",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Client requests",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "none",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "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": "$datasource",
      "description": "client 请求的GET与ACK包的QPS。",
      "fill": 1,
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 6,
        "y": 13
      },
      "id": 38,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "rate(canal_instance_client_packets{destination=~\"$destination\",packetType=\"GET\"}[2m])",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "GET",
          "refId": "A"
        },
        {
          "expr": "rate(canal_instance_client_packets{destination=~\"$destination\",packetType=\"CLIENTACK\"}[2m])",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "ACK",
          "refId": "B"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Client QPS",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "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": "$datasource",
      "description": "server响应GET请求,但返回空包的占比。",
      "fill": 1,
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 12,
        "y": 13
      },
      "id": 26,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "rate(canal_instance_client_empty_batches{destination=~\"$destination\"}[2m])",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "empty",
          "refId": "A"
        },
        {
          "expr": "rate(canal_instance_client_packets{destination=~\"$destination\", packetType=\"GET\"}[2m])",
          "format": "time_series",
          "intervalFactor": 1,
          "legendFormat": "nonempty",
          "refId": "B"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Empty packets",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "wps",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "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": "$datasource",
      "description": "Canal client 请求响应时间的概况。",
      "fill": 1,
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 18,
        "y": 13
      },
      "id": 18,
      "legend": {
        "alignAsTable": false,
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "rightSide": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "alias": "25.0",
          "yaxis": 1
        },
        {
          "alias": "100.0",
          "yaxis": 1
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "rate(canal_instance_client_request_latency_bucket{destination=~\"$destination\"}[2m])",
          "format": "time_series",
          "hide": false,
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "{{le}}ms",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Response time",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "transparent": false,
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 18
      },
      "id": 36,
      "panels": [],
      "title": "Store",
      "type": "row"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "$datasource",
      "description": "Canal instance ringbuffer内未释放的events数量。",
      "fill": 1,
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 0,
        "y": 19
      },
      "id": 20,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "canal_instance_store_produce_seq{destination=~\"$destination\"} - canal_instance_store_consume_seq{destination=~\"$destination\"}",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "events",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Store remain events",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": null,
          "format": "none",
          "label": "",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "decimals": null,
          "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": "$datasource",
      "description": "Canal instance ringbuffer 内未释放events占用内存。",
      "fill": 1,
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 6,
        "y": 19
      },
      "id": 22,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "percentage": false,
      "pointradius": 5,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "expr": "(canal_instance_store_produce_mem{destination=~\"$destination\"} - canal_instance_store_consume_mem{destination=~\"$destination\"}) / 1024",
          "format": "time_series",
          "interval": "15s",
          "intervalFactor": 2,
          "legendFormat": "memsize",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeShift": null,
      "title": "Store remain mem",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "deckbytes",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    }
  ],
  "refresh": false,
  "schemaVersion": 16,
  "style": "dark",
  "tags": [
    "canal"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "text": "prometheus",
          "value": "prometheus"
        },
        "hide": 0,
        "label": "datasource",
        "name": "datasource",
        "options": [],
        "query": "prometheus",
        "refresh": 1,
        "regex": "",
        "type": "datasource"
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "$datasource",
        "hide": 0,
        "includeAll": false,
        "label": "destination",
        "multi": false,
        "name": "destination",
        "options": [],
        "query": "label_values(canal_instance, destination)",
        "refresh": 1,
        "regex": "",
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "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": "Canal instances",
  "uid": "8vh8NGpiz",
  "version": 103
}

 

你可能感兴趣的:(监控)