From eba1b920ebf834a4b85685ef85c1cd0841ba4b80 Mon Sep 17 00:00:00 2001 From: jianxiaoguo <842666271@qq.com> Date: Wed, 12 Oct 2022 16:25:49 +0800 Subject: [PATCH] feat(grafana): add pd tikv dashboard --- .../monitor-telegraf-deployment.yaml | 12 + charts/monitor/values.yaml | 1 + .../usr/share/grafana/api/dashboards/pd.json | 1226 +++++++++++++++++ .../share/grafana/api/dashboards/tikv.json | 1169 ++++++++++++++++ telegraf/rootfs/home/telegraf/config.toml.tpl | 12 +- telegraf/rootfs/home/telegraf/start-telegraf | 22 + 6 files changed, 2441 insertions(+), 1 deletion(-) create mode 100644 grafana/rootfs/usr/share/grafana/api/dashboards/pd.json create mode 100644 grafana/rootfs/usr/share/grafana/api/dashboards/tikv.json diff --git a/charts/monitor/templates/monitor-telegraf-deployment.yaml b/charts/monitor/templates/monitor-telegraf-deployment.yaml index 88da852..88d0685 100644 --- a/charts/monitor/templates/monitor-telegraf-deployment.yaml +++ b/charts/monitor/templates/monitor-telegraf-deployment.yaml @@ -117,3 +117,15 @@ spec: name: redis-creds key: password {{- end }} +{{- if eq .Values.global.storageLocation "on-cluster" }} + - name: PD_ADDRS + valueFrom: + secretKeyRef: + name: storage-meta-creds + key: pd_addrs + - name: TIKV_ADDRS + valueFrom: + secretKeyRef: + name: storage-meta-creds + key: tikv_addrs +{{- end }} diff --git a/charts/monitor/values.yaml b/charts/monitor/values.yaml index 3db2f2f..fbce570 100644 --- a/charts/monitor/values.yaml +++ b/charts/monitor/values.yaml @@ -90,6 +90,7 @@ global: # - on-cluster: Run Redis within the Kubernetes cluster # - off-cluster: Run Redis outside the Kubernetes cluster (configure in redis section) redisLocation: "on-cluster" + storageLocation: "on-cluster" # Role-Based Access Control for Kubernetes >= 1.5 rbac: false ingressClass: "" diff --git a/grafana/rootfs/usr/share/grafana/api/dashboards/pd.json b/grafana/rootfs/usr/share/grafana/api/dashboards/pd.json new file mode 100644 index 0000000..aae0a95 --- /dev/null +++ b/grafana/rootfs/usr/share/grafana/api/dashboards/pd.json @@ -0,0 +1,1226 @@ +{ + "dashboard": { + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 5, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": null, + "description": "ClusterID", + "fieldConfig": { + "defaults": { + "color": { + "mode": "fixed" + }, + "custom": { + "align": "auto", + "displayMode": "auto", + "filterable": false, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 4, + "x": 0, + "y": 0 + }, + "id": 12, + "options": { + "footer": { + "fields": [], + "reducer": [ + "lastNotNull" + ], + "show": false + }, + "showHeader": false + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_metadata\")\n |> filter(fn: (r) => r[\"url\"] == \"${instance}\")\n |> duplicate(column: \"type\", as: \"_value\")\n |> keep(columns: [\"_time\", \"_value\"])\n |> last()", + "refId": "A" + } + ], + "title": "ClusterID", + "transformations": [ + { + "id": "labelsToFields", + "options": { + "keepLabels": [ + "type" + ], + "mode": "columns" + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Time": true + }, + "indexByName": {}, + "renameByName": {} + } + } + ], + "type": "table" + }, + { + "datasource": null, + "description": "It indicates whether the current PD is the leader or a follower.", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "0": { + "index": 1, + "text": "Follower" + }, + "1": { + "index": 0, + "text": "Leader" + }, + "null": { + "index": 2, + "text": "Unknown" + } + }, + "type": "value" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 5, + "x": 4, + "y": 0 + }, + "id": 2, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_tso_role\")\n |> filter(fn: (r) => r[\"_field\"] == \"gauge\")\n |> filter(fn: (r) => r[\"dc\"] == \"global\")\n |> filter(fn: (r) => r[\"url\"] == \"$instance\")\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "PD role", + "type": "stat" + }, + { + "datasource": null, + "description": "The total capacity size of the cluster", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 5, + "x": 9, + "y": 0 + }, + "id": 3, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_status\")\n |> filter(fn: (r) => r[\"type\"] == \"storage_capacity\")\n |> filter(fn: (r) => r[\"_field\"] == \"gauge\")\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Storage capacity", + "type": "stat" + }, + { + "datasource": null, + "description": "The current storage size of the cluster", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 5, + "x": 14, + "y": 0 + }, + "id": 4, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_status\")\n |> filter(fn: (r) => r[\"_field\"] == \"gauge\")\n |> filter(fn: (r) => r[\"type\"] == \"storage_size\")\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Current storage size", + "type": "stat" + }, + { + "datasource": null, + "description": "The current storage size of the cluster", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 5, + "x": 19, + "y": 0 + }, + "id": 11, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_status\")\n |> filter(fn: (r) => r[\"type\"] == \"store_up_count\")\n", + "refId": "A" + } + ], + "title": "Normal stores", + "type": "stat" + }, + { + "datasource": null, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "green", + "mode": "fixed" + }, + "custom": { + "align": "auto", + "displayMode": "auto", + "filterable": false, + "inspect": false + }, + "decimals": 0, + "displayName": "last", + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "none" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "_value" + }, + "properties": [ + { + "id": "custom.displayMode", + "value": "color-background" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 5 + }, + "id": 10, + "options": { + "footer": { + "enablePagination": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "frameIndex": 0, + "showHeader": false, + "sortBy": [] + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "hide": false, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_status\")\n |> filter(fn: (r) => r[\"type\"] == \"store_disconnected_count\")\n |> keep(columns: [\"type\", \"_value\"])\n |> sum()", + "refId": "A" + }, + { + "datasource": null, + "hide": false, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_status\")\n |> filter(fn: (r) => r[\"type\"] == \"store_unhealth_count\")\n |> keep(columns: [\"type\", \"_value\"])\n |> sum()", + "refId": "B" + }, + { + "datasource": null, + "hide": false, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_status\")\n |> filter(fn: (r) => r[\"type\"] == \"store_low_space_count\")\n |> keep(columns: [\"type\", \"_value\"])\n |> sum()", + "refId": "C" + }, + { + "datasource": null, + "hide": false, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_status\")\n |> filter(fn: (r) => r[\"type\"] == \"store_down_count\")\n |> keep(columns: [\"type\", \"_value\"])\n |> sum()", + "refId": "D" + }, + { + "datasource": null, + "hide": false, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_status\")\n |> filter(fn: (r) => r[\"type\"] == \"store_offline_count\")\n |> keep(columns: [\"type\", \"_value\"])\n |> sum()", + "refId": "E" + }, + { + "datasource": null, + "hide": false, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_status\")\n |> filter(fn: (r) => r[\"type\"] == \"store_tombstone_count\")\n |> keep(columns: [\"type\", \"_value\"])\n |> sum()", + "refId": "F" + }, + { + "datasource": null, + "hide": false, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_status\")\n |> filter(fn: (r) => r[\"type\"] == \"store_tombstone_count\")\n |> keep(columns: [\"type\", \"_value\"])\n |> sum()", + "refId": "G" + }, + { + "datasource": null, + "hide": false, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_status\")\n |> filter(fn: (r) => r[\"type\"] == \"store_slow_count\")\n |> keep(columns: [\"type\", \"_value\"])\n |> sum()", + "refId": "H" + } + ], + "title": "Abnormal stores", + "transformations": [ + { + "id": "labelsToFields", + "options": { + "mode": "columns" + } + }, + { + "id": "merge", + "options": {} + }, + { + "id": "organize", + "options": { + "excludeByName": {}, + "indexByName": { + "_value": 1, + "type": 0 + }, + "renameByName": {} + } + } + ], + "type": "table" + }, + { + "datasource": null, + "description": "It records the unusual Regions' count which may include pending peers, down peers, extra peers, offline peers, missing peers or learner peers", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": true, + "axisColorMode": "text", + "axisGridShow": true, + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "pd_regions_status gauge {host=\"sy-z1-003\", type=\"down-peer-region-count\", url=\"http://drycc-storage-meta-pd-0.drycc-storage-meta-pd.drycc.svc.cluster.local:2379/metrics\"}" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": false, + "tooltip": false, + "viz": true + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 8, + "y": 5 + }, + "id": 8, + "options": { + "legend": { + "calcs": [ + "max", + "last" + ], + "displayMode": "table", + "placement": "right", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "desc" + } + }, + "targets": [ + { + "datasource": null, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_regions_status\")\n |> filter(fn: (r) => r[\"url\"] == \"${instance}\")\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> keep(columns: [\"_time\", \"type\", \"_value\"])\n |> yield(name: \"mean\")", + "refId": "A" + }, + { + "datasource": null, + "hide": true, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_regions_status\")\n |> filter(fn: (r) => r[\"_field\"] == \"gauge\")\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n |> group(columns: [\"url\", \"type\"], mode:\"by\")\n |> keep(columns: [\"_time\", \"type\", \"_value\"])\n |> sum()\n ", + "refId": "B" + }, + { + "datasource": null, + "hide": false, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_regions_offline_status\")\n |> filter(fn: (r) => r[\"_field\"] == \"gauge\")\n |> filter(fn: (r) => r[\"type\"] == \"offline-peer-region-count\")\n |> filter(fn: (r) => r[\"url\"] == \"${instance}\")\n |> keep(columns: [\"_time\", \"type\", \"_value\"])\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")", + "refId": "C" + } + ], + "title": "Region health", + "type": "timeseries" + }, + { + "datasource": null, + "description": "The used capacity size of each TiKV instance", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 16, + "y": 5 + }, + "id": 19, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": null, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_scheduler_store_status\")\n |> filter(fn: (r) => r[\"type\"] == \"store_used\")\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> keep(columns: [\"_time\", \"_value\", \"address\"])\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Store used", + "type": "timeseries" + }, + { + "datasource": null, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 8, + "x": 0, + "y": 13 + }, + "id": 14, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_tso\")\n |> filter(fn: (r) => r[\"url\"] == \"${instance}\")\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> last()", + "refId": "A" + } + ], + "title": "Current TSO Physcial", + "type": "stat" + }, + { + "datasource": null, + "description": "PD uptime since last restart", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto", + "filterable": false, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 8, + "y": 13 + }, + "id": 17, + "options": { + "footer": { + "enablePagination": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": false + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"process_start_time_seconds\")\n |> filter(fn: (r) => r[\"url\"] =~ /pd/)\n |> toInt()\n |> map(fn: (r) => ({r with _value: r._value * 1000}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> duplicate(column: \"url\", as: \"_time\")\n |> last()\n ", + "refId": "A" + } + ], + "title": "Startup datetime", + "transformations": [ + { + "id": "merge", + "options": {} + }, + { + "id": "convertFieldType", + "options": { + "conversions": [ + { + "destinationType": "time", + "targetField": "_value" + } + ], + "fields": {} + } + } + ], + "type": "table" + }, + { + "datasource": null, + "description": "The current peer count of the cluster", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 16, + "y": 13 + }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": null, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_status\")\n |> filter(fn: (r) => r[\"_field\"] == \"gauge\")\n |> filter(fn: (r) => r[\"type\"] == \"region_count\")\n |> keep(columns: [\"_time\", \"_value\"])\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Current peer count", + "type": "timeseries" + }, + { + "datasource": null, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "dateTimeAsIso" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 8, + "x": 0, + "y": 16 + }, + "id": 15, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_tso\")\n |> filter(fn: (r) => r[\"url\"] == \"${instance}\")\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> last()", + "refId": "A" + } + ], + "title": "Current TSO Datetime", + "type": "stat" + }, + { + "datasource": null, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 19 + }, + "id": 21, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "right", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "6fcv2jV4z" + }, + "query": "from(bucket: \"kubernetes\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"process_cpu_seconds_total\")\n |> filter(fn: (r) => r[\"url\"] =~ /pd/)\n |> toInt()\n |> map(fn: (r) => ({ r with _value: r._value / 1000 }))\n |> keep(columns: [\"_time\", \"_value\", \"url\"])\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n ", + "refId": "A" + } + ], + "title": "CPU", + "type": "timeseries" + }, + { + "datasource": null, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 19 + }, + "id": 20, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "right", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": null, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"process_resident_memory_bytes\")\n |> filter(fn: (r) => r[\"url\"] =~ /pd/)\n |> keep(columns: [\"_time\", \"_value\", \"url\"])\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Memory", + "type": "timeseries" + } + ], + "schemaVersion": 37, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "http://drycc-storage-meta-pd-0.drycc-storage-meta-pd.drycc.svc.cluster.local:2379/metrics", + "value": "http://drycc-storage-meta-pd-0.drycc-storage-meta-pd.drycc.svc.cluster.local:2379/metrics" + }, + "datasource": null, + "definition": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_status\")\n |> duplicate(column: \"url\", as: \"_value\")\n |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n |> yield(name: \"last\")", + "description": "pd_cluster_status url", + "hide": 0, + "includeAll": false, + "label": "instance", + "multi": false, + "name": "instance", + "options": [], + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_cluster_status\")\n |> duplicate(column: \"url\", as: \"_value\")\n |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n |> yield(name: \"last\")", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "allValue": ".*", + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": null, + "definition": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_scheduler_store_status\")\n |> filter(fn: (r) => r[\"_field\"] == \"gauge\")\n |> keep(columns: [\"store\", \"url\"])\n |> keyValues(keyColumns: [\"store\", \"_value\"])\n |> duplicate(column: \"_value\", as: \"_key\")\n |> group() \n ", + "hide": 0, + "includeAll": true, + "label": "store", + "multi": true, + "name": "store", + "options": [], + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"pd_scheduler_store_status\")\n |> filter(fn: (r) => r[\"_field\"] == \"gauge\")\n |> keep(columns: [\"store\", \"url\"])\n |> keyValues(keyColumns: [\"store\", \"_value\"])\n |> duplicate(column: \"_value\", as: \"_key\")\n |> group() \n ", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "PD Cluster", + "uid": "XaUfsOIVk", + "version": 1, + "weekStart": "" + }, + "overwrite": false +} \ No newline at end of file diff --git a/grafana/rootfs/usr/share/grafana/api/dashboards/tikv.json b/grafana/rootfs/usr/share/grafana/api/dashboards/tikv.json new file mode 100644 index 0000000..c0159d9 --- /dev/null +++ b/grafana/rootfs/usr/share/grafana/api/dashboards/tikv.json @@ -0,0 +1,1169 @@ +{ + "dashboard": { + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 6, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": null, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 0 + }, + "id": 2780, + "links": [], + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "right", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "scheduler-{{instance}}", + "metric": "", + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"tikv_raftstore_region_count\")\n |> filter(fn: (r) => r[\"type\"] == \"leader\")\n |> keep(columns: [\"_time\", \"url\", \"_value\"])\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n |> keep(columns: [\"_time\", \"url\", \"value\"])", + "range": true, + "refId": "A", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "channelfull-{{instance}}-{{type}}", + "metric": "", + "query": "", + "range": true, + "refId": "B", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "coprocessor-{{instance}}", + "metric": "", + "range": true, + "refId": "C", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "stall-{{instance}}", + "range": true, + "refId": "D" + } + ], + "title": "Leader", + "type": "timeseries" + }, + { + "datasource": null, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto", + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 0 + }, + "id": 2783, + "options": { + "footer": { + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": false + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"process_start_time_seconds\")\n |> filter(fn: (r) => r[\"url\"] =~ /tikv/)\n |> toInt()\n |> map(fn: (r) => ({r with _value: r._value * 1000}))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> duplicate(column: \"url\", as: \"_time\")\n |> last()\n", + "refId": "A" + } + ], + "title": "Startup datetime", + "transformations": [ + { + "id": "merge", + "options": {} + }, + { + "id": "convertFieldType", + "options": { + "conversions": [ + { + "destinationType": "time", + "targetField": "_value" + } + ], + "fields": {} + } + } + ], + "type": "table" + }, + { + "datasource": null, + "description": "The QPS of different kinds of commands in each TiKV instance", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 0 + }, + "id": 2779, + "options": { + "legend": { + "calcs": [ + "max", + "lastNotNull" + ], + "displayMode": "table", + "placement": "right", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": null, + "query": "import \"experimental/aggregate\"\nfrom(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"tikv_grpc_msg_duration_seconds\")\n |> filter(fn: (r) => r[\"_field\"] == \"count\")\n |> filter(fn: (r) => r[\"type\"] != \"kv_gc\")\n |> filter(fn: (r) => r[\"url\"] == \"${instance}\")\n |> keep(columns: [\"_time\", \"_value\", \"type\", \"url\"])\n |> derivative(unit: 1s)\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n", + "refId": "A" + } + ], + "title": "QPS", + "type": "timeseries" + }, + { + "datasource": null, + "description": "The storage size per TiKV instance", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 7 + }, + "id": 2777, + "links": [], + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "right", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "scheduler-{{instance}}", + "metric": "", + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"tikv_store_size_bytes\")\n |> filter(fn: (r) => r[\"type\"] == \"used\")\n |> keep(columns: [\"_time\", \"url\", \"_value\"])\n |> group(columns: [\"_time\", \"url\"], mode:\"by\")\n |> cumulativeSum(columns: [\"_value\", \"url\"])\n |> last()\n |> group(columns: [\"url\"], mode:\"by\")\n", + "range": true, + "refId": "A", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "channelfull-{{instance}}-{{type}}", + "metric": "", + "query": "", + "range": true, + "refId": "B", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "coprocessor-{{instance}}", + "metric": "", + "range": true, + "refId": "C", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "stall-{{instance}}", + "range": true, + "refId": "D" + } + ], + "title": "Store size", + "type": "timeseries" + }, + { + "datasource": null, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 8, + "y": 7 + }, + "id": 2786, + "links": [], + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "right", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "scheduler-{{instance}}", + "metric": "", + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"tikv_store_size_bytes\")\n |> filter(fn: (r) => r[\"type\"] == \"available\")\n |> keep(columns: [\"_time\", \"url\", \"_value\"])\n |> group(columns: [\"_time\", \"url\"], mode:\"by\")\n |> cumulativeSum(columns: [\"_value\", \"url\"])\n |> last()\n |> group(columns: [\"url\"], mode:\"by\")\n", + "range": true, + "refId": "A", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "channelfull-{{instance}}-{{type}}", + "metric": "", + "query": "", + "range": true, + "refId": "B", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "coprocessor-{{instance}}", + "metric": "", + "range": true, + "refId": "C", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "stall-{{instance}}", + "range": true, + "refId": "D" + } + ], + "title": "Available size", + "type": "timeseries" + }, + { + "datasource": null, + "description": "The storage size per TiKV instance", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 16, + "y": 7 + }, + "id": 2787, + "links": [], + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "right", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "scheduler-{{instance}}", + "metric": "", + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"tikv_store_size_bytes\")\n |> filter(fn: (r) => r[\"type\"] == \"capacity\")\n |> keep(columns: [\"_time\", \"url\", \"_value\"])\n |> group(columns: [\"_time\", \"url\"], mode:\"by\")\n |> cumulativeSum(columns: [\"_value\", \"url\"])\n |> last()\n |> group(columns: [\"url\"], mode:\"by\")\n", + "range": true, + "refId": "A", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "channelfull-{{instance}}-{{type}}", + "metric": "", + "query": "", + "range": true, + "refId": "B", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "coprocessor-{{instance}}", + "metric": "", + "range": true, + "refId": "C", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "stall-{{instance}}", + "range": true, + "refId": "D" + } + ], + "title": "Capacity size", + "type": "timeseries" + }, + { + "datasource": null, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "milli-cores" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 15 + }, + "id": 2788, + "links": [], + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "right", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "scheduler-{{instance}}", + "metric": "", + "query": "from(bucket: \"kubernetes\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"process_cpu_seconds_total\")\n |> filter(fn: (r) => r[\"url\"] =~ /tikv/)\n |> toInt()\n |> map(fn: (r) => ({ r with _value: r._value / 1000 }))\n |> keep(columns: [\"_time\", \"_value\", \"url\"])\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n ", + "range": true, + "refId": "A", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "channelfull-{{instance}}-{{type}}", + "metric": "", + "query": "", + "range": true, + "refId": "B", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "coprocessor-{{instance}}", + "metric": "", + "range": true, + "refId": "C", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "stall-{{instance}}", + "range": true, + "refId": "D" + } + ], + "title": "CPU", + "type": "timeseries" + }, + { + "datasource": null, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 15 + }, + "id": 2781, + "links": [], + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "right", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "scheduler-{{instance}}", + "metric": "", + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"process_resident_memory_bytes\")\n |> filter(fn: (r) => r[\"url\"] =~ /tikv/)\n |> keep(columns: [\"_time\", \"_value\", \"url\"])\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")", + "range": true, + "refId": "A", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "channelfull-{{instance}}-{{type}}", + "metric": "", + "query": "", + "range": true, + "refId": "B", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "coprocessor-{{instance}}", + "metric": "", + "range": true, + "refId": "C", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "stall-{{instance}}", + "range": true, + "refId": "D" + } + ], + "title": "Memory", + "type": "timeseries" + }, + { + "datasource": null, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "milli-cores" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 15 + }, + "id": 2788, + "links": [], + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "right", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "9.1.1", + "targets": [ + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "scheduler-{{instance}}", + "metric": "", + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"process_cpu_seconds_total\")\n |> filter(fn: (r) => r[\"url\"] =~ /tikv/)\n |> toInt()\n |> map(fn: (r) => ({ r with _value: r._value / 1000 }))\n |> keep(columns: [\"_time\", \"_value\", \"url\"])\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")\n ", + "range": true, + "refId": "A", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "channelfull-{{instance}}-{{type}}", + "metric": "", + "query": "", + "range": true, + "refId": "B", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "coprocessor-{{instance}}", + "metric": "", + "range": true, + "refId": "C", + "step": 4 + }, + { + "datasource": null, + "editorMode": "code", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "stall-{{instance}}", + "range": true, + "refId": "D" + } + ], + "title": "CPU", + "type": "timeseries" + } + ], + "schemaVersion": 37, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "allValue": "", + "current": { + "selected": false, + "text": "http://drycc-storage-meta-tikv-0.drycc-storage-meta-tikv.drycc.svc.cluster.local:20180/metrics", + "value": "http://drycc-storage-meta-tikv-0.drycc-storage-meta-tikv.drycc.svc.cluster.local:20180/metrics" + }, + "datasource": null, + "definition": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"tikv_engine_size_bytes\")\n |> filter(fn: (r) => r[\"_field\"] == \"gauge\")\n |> keyValues(keyColumns: [\"_value\"])\n |> duplicate(column: \"url\", as: \"_value\")\n |> group() \n |> keep(columns: [\"_value\"])\n ", + "hide": 0, + "includeAll": false, + "label": "instance", + "multi": false, + "name": "instance", + "options": [], + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"tikv_engine_size_bytes\")\n |> filter(fn: (r) => r[\"_field\"] == \"gauge\")\n |> keyValues(keyColumns: [\"_value\"])\n |> duplicate(column: \"url\", as: \"_value\")\n |> group() \n |> keep(columns: [\"_value\"])\n ", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": true, + "text": [ + "kv" + ], + "value": [ + "kv" + ] + }, + "datasource": null, + "definition": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"tikv_engine_block_cache_size_bytes\")\n |> filter(fn: (r) => r[\"_field\"] == \"gauge\")\n |> keyValues(keyColumns: [\"_value\"])\n |> duplicate(column: \"db\", as: \"_value\")\n |> group() \n |> keep(columns: [\"_value\"])\n ", + "hide": 0, + "includeAll": true, + "label": "db", + "multi": true, + "name": "db", + "options": [], + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"tikv_engine_block_cache_size_bytes\")\n |> filter(fn: (r) => r[\"_field\"] == \"gauge\")\n |> keyValues(keyColumns: [\"_value\"])\n |> duplicate(column: \"db\", as: \"_value\")\n |> group() \n |> keep(columns: [\"_value\"])\n ", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": null, + "definition": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"tikv_storage_command_total\")\n |> duplicate(column: \"type\", as: \"_value\")\n |> keyValues(keyColumns: [\"_value\"])\n |> group() \n |> keep(columns: [\"_value\"])", + "hide": 0, + "includeAll": true, + "label": "command", + "multi": true, + "name": "command", + "options": [], + "query": "from(bucket: v.bucket)\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"_measurement\"] == \"tikv_storage_command_total\")\n |> duplicate(column: \"type\", as: \"_value\")\n |> keyValues(keyColumns: [\"_value\"])\n |> group() \n |> keep(columns: [\"_value\"])", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "TiKV", + "uid": "xobcYpSVz", + "version": 1, + "weekStart": "" + }, + "overwrite": false +} \ No newline at end of file diff --git a/telegraf/rootfs/home/telegraf/config.toml.tpl b/telegraf/rootfs/home/telegraf/config.toml.tpl index db59563..0952f2c 100644 --- a/telegraf/rootfs/home/telegraf/config.toml.tpl +++ b/telegraf/rootfs/home/telegraf/config.toml.tpl @@ -19,7 +19,7 @@ debug = {{ default false .AGENT_DEBUG }} quiet = {{ default false .AGENT_QUIET }} flush_buffer_when_full = {{ default true .AGENT_FLUSH_BUFFER }} - {{- if .AGENT_HOSTNAME }}hostname = {{ .AGENT_HOSTNAME | quote }} {{ end }} + {{ if .AGENT_HOSTNAME }}hostname = {{ .AGENT_HOSTNAME | quote }} {{ end }} # Set output configuration {{- if .AMON_INSTANCE }} @@ -176,6 +176,16 @@ urls = [{{ .INFLUXDB_V2_INPUT_URLS }}] {{ end }} +{{- if .PD_SERVERS }} +[[inputs.prometheus]] + urls = {{ .PD_SERVERS }} +{{ end }} + +{{- if .TIKV_SERVERS }} +[[inputs.prometheus]] + urls = {{ .TIKV_SERVERS }} +{{ end }} + {{- if and .KUBERNETES_URL .ENABLE_KUBERNETES }} [[inputs.kubernetes]] url = {{ .KUBERNETES_URL | quote }} diff --git a/telegraf/rootfs/home/telegraf/start-telegraf b/telegraf/rootfs/home/telegraf/start-telegraf index 755ec21..e3c122c 100755 --- a/telegraf/rootfs/home/telegraf/start-telegraf +++ b/telegraf/rootfs/home/telegraf/start-telegraf @@ -40,6 +40,28 @@ if [ -n "$DRYCC_REDIS_ADDRS" ]; then export REDIS_SERVERS fi +# pd servers +if [ -n "$PD_ADDRS" ]; then + PD_SERVERS="" + for ADDR in $(echo "${PD_ADDRS}" | tr "," "\n") + do + PD_SERVERS="\"$ADDR\", ${PD_SERVERS}" + done + PD_SERVERS=\["${PD_SERVERS::-2}"\] + export PD_SERVERS +fi + +#tikv servers +if [ -n "$TIKV_ADDRS" ]; then + TIKV_SERVERS="" + for ADDR in $(echo "${TIKV_ADDRS}" | tr "," "\n") + do + TIKV_SERVERS="\"$ADDR\", ${TIKV_SERVERS}" + done + TIKV_SERVERS=\["${TIKV_SERVERS::-2}"\] + export TIKV_SERVERS +fi + echo "Building config.toml!" envtpl > config.toml < config.toml.tpl | sed '/^$/d'