From f79a5cbd0e3a6aed95addd4fc83a3ce93bf824f2 Mon Sep 17 00:00:00 2001 From: mikechengwei <842725815@qq.com> Date: Thu, 6 May 2021 01:36:55 +0800 Subject: [PATCH 01/12] optimze code --- docs/api-references/docs.md | 13 +++++++++++++ pkg/apis/pingcap/v1alpha1/tidbmonitor_types.go | 2 ++ pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go | 7 +++++++ pkg/monitor/monitor/util.go | 4 ++++ 4 files changed, 26 insertions(+) diff --git a/docs/api-references/docs.md b/docs/api-references/docs.md index 08e0a98cce..7ab56818e4 100644 --- a/docs/api-references/docs.md +++ b/docs/api-references/docs.md @@ -6150,6 +6150,19 @@ IngressSpec (Optional) + + +additionalVolumeMounts
+ + +[]Kubernetes core/v1.VolumeMount + + + + +

Additional volume mounts of grafana pod.

+ +

HelperSpec

diff --git a/pkg/apis/pingcap/v1alpha1/tidbmonitor_types.go b/pkg/apis/pingcap/v1alpha1/tidbmonitor_types.go index fea35dfa4b..718494e2b0 100644 --- a/pkg/apis/pingcap/v1alpha1/tidbmonitor_types.go +++ b/pkg/apis/pingcap/v1alpha1/tidbmonitor_types.go @@ -177,6 +177,8 @@ type GrafanaSpec struct { // +optional Ingress *IngressSpec `json:"ingress,omitempty"` + // Additional volume mounts of grafana pod. + AdditionalVolumeMounts []corev1.VolumeMount `json:"additionalVolumeMounts,omitempty"` } // ReloaderSpec is the desired state of reloader diff --git a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go index 544e127b12..e9d79f1d38 100644 --- a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go @@ -1900,6 +1900,13 @@ func (in *GrafanaSpec) DeepCopyInto(out *GrafanaSpec) { *out = new(IngressSpec) (*in).DeepCopyInto(*out) } + if in.AdditionalVolumeMounts != nil { + in, out := &in.AdditionalVolumeMounts, &out.AdditionalVolumeMounts + *out = make([]v1.VolumeMount, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } diff --git a/pkg/monitor/monitor/util.go b/pkg/monitor/monitor/util.go index 4e3bca8dc1..2b3d466b12 100644 --- a/pkg/monitor/monitor/util.go +++ b/pkg/monitor/monitor/util.go @@ -617,6 +617,10 @@ func getMonitorGrafanaContainer(secret *core.Secret, monitor *v1alpha1.TidbMonit } c.Env = util.AppendOverwriteEnv(c.Env, envOverrides) sort.Sort(util.SortEnvByName(c.Env)) + + if monitor.Spec.Grafana.AdditionalVolumeMounts != nil { + c.VolumeMounts = append(c.VolumeMounts, monitor.Spec.Grafana.AdditionalVolumeMounts...) + } return c } From 816fdcd8e57518b91e80fb003b537ead878d8833 Mon Sep 17 00:00:00 2001 From: mikechengwei <842725815@qq.com> Date: Wed, 12 May 2021 02:02:29 +0800 Subject: [PATCH 02/12] optimze code --- examples/basic/tidb-monitor.yaml | 1 + .../grafana/custom-dashboard.yaml | 2103 +++++++++++++++++ .../grafana/tidb-monitor.yaml | 28 + .../{ => prometheus}/README.md | 0 .../{ => prometheus}/external-configMap.yaml | 0 .../{ => prometheus}/tidb-monitor.yaml | 2 +- 6 files changed, 2133 insertions(+), 1 deletion(-) create mode 100644 examples/monitor-with-externalConfigMap/grafana/custom-dashboard.yaml create mode 100644 examples/monitor-with-externalConfigMap/grafana/tidb-monitor.yaml rename examples/monitor-with-externalConfigMap/{ => prometheus}/README.md (100%) rename examples/monitor-with-externalConfigMap/{ => prometheus}/external-configMap.yaml (100%) rename examples/monitor-with-externalConfigMap/{ => prometheus}/tidb-monitor.yaml (97%) diff --git a/examples/basic/tidb-monitor.yaml b/examples/basic/tidb-monitor.yaml index c004ee00e5..5dc11397cf 100644 --- a/examples/basic/tidb-monitor.yaml +++ b/examples/basic/tidb-monitor.yaml @@ -3,6 +3,7 @@ kind: TidbMonitor metadata: name: basic spec: + replicas: 1 clusters: - name: basic prometheus: diff --git a/examples/monitor-with-externalConfigMap/grafana/custom-dashboard.yaml b/examples/monitor-with-externalConfigMap/grafana/custom-dashboard.yaml new file mode 100644 index 0000000000..acc5beeed7 --- /dev/null +++ b/examples/monitor-with-externalConfigMap/grafana/custom-dashboard.yaml @@ -0,0 +1,2103 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: custom-dashboard +data: + test.json: |- + { + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "tidb-cluster", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "id": 7, + "iteration": 1620755757893, + "links": [], + "panels": [ + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 73, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "tidb-cluster", + "fill": 1, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 1 + }, + "hideTimeOverride": false, + "id": 68, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "hideZero": false, + "max": true, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "binlog_pump_storage_storage_size_bytes", + "format": "time_series", + "hide": false, + "intervalFactor": 2, + "legendFormat": "{{instance}} : {{type}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Storage Size", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "decbytes", + "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": "tidb-cluster", + "fill": 1, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 63, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "hideEmpty": false, + "hideZero": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "binlog_pump_storage_gc_ts", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{instance}} : gc_tso", + "refId": "A" + }, + { + "expr": "binlog_pump_storage_max_commit_ts", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{instance}} : max_commit_tso", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Metadata", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "dateTimeAsIso", + "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": "tidb-cluster", + "editable": true, + "error": false, + "fill": 1, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 7, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": true, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(binlog_pump_rpc_duration_seconds_count{method=\"WriteBinlog\"}[1m])", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{instance}} :: {{label}}", + "metric": "binlog_cistern_rpc_duration_seconds_bucket", + "refId": "A", + "step": 2 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Write Binlog QPS by Instance", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "ops", + "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": "tidb-cluster", + "editable": true, + "error": false, + "fill": 1, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 8 + }, + "id": 3, + "legend": { + "alignAsTable": true, + "avg": false, + "current": false, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "histogram_quantile(0.99, rate(binlog_pump_rpc_duration_seconds_bucket{method=\"WriteBinlog\"}[1m]))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{instance}} : {{method}}:99", + "refId": "A" + }, + { + "expr": "histogram_quantile(0.95, rate(binlog_pump_rpc_duration_seconds_bucket{method=\"WriteBinlog\"}[1m]))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{instance}} : {{method}} : 95", + "refId": "C" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Write Binlog Latency", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "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": "tidb-cluster", + "fill": 1, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 15 + }, + "id": 44, + "legend": { + "alignAsTable": true, + "avg": false, + "current": false, + "max": true, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "histogram_quantile(0.99, rate(binlog_pump_storage_write_binlog_size_bucket[1m]))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{instance}} : {{type}} : 99", + "refId": "B" + }, + { + "expr": "histogram_quantile(0.95, rate(binlog_pump_storage_write_binlog_size_bucket[1m]))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{instance}} : {{type}} : 95", + "refId": "C" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Storage Write Binlog Size", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "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": "tidb-cluster", + "editable": true, + "error": false, + "fill": 1, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 15 + }, + "id": 66, + "legend": { + "alignAsTable": true, + "avg": false, + "current": false, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "histogram_quantile(0.99, rate(binlog_pump_storage_write_binlog_duration_time_bucket[1m]))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{instance}} : {{type}}:99", + "refId": "A" + }, + { + "expr": "histogram_quantile(0.95, rate(binlog_pump_storage_write_binlog_duration_time_bucket[1m]))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{instance}} : {{type}}:95", + "refId": "C" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Storage Write Binlog Latency", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "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": "tidb-cluster", + "fill": 1, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 22 + }, + "id": 48, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": true, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": true + }, + "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(binlog_pump_storage_error_count[1m])", + "format": "time_series", + "instant": false, + "intervalFactor": 2, + "legendFormat": "{{instance}}:{{type}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Pump Storage Error By Type", + "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": "tidb-cluster", + "fill": 1, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 22 + }, + "id": 67, + "legend": { + "alignAsTable": true, + "avg": false, + "current": false, + "max": false, + "min": false, + "rightSide": true, + "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": "binlog_pump_storage_query_tikv_count", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{instance}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Query Tikv", + "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": "tidb-cluster", + "fill": 1, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 29 + }, + "id": 76, + "legend": { + "alignAsTable": true, + "avg": false, + "current": false, + "max": false, + "min": false, + "rightSide": true, + "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": "tidb_server_critical_error_total", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{instance}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "TiDB Server Skip Binlog Count", + "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": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + } + ], + "repeat": null, + "title": "pump", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 1 + }, + "id": 74, + "panels": [ + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "#299c46", + "rgba(237, 129, 40, 0.89)", + "#d44a3a" + ], + "datasource": "tidb-cluster", + "format": "dateTimeAsIso", + "gauge": { + "maxValue": null, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 23 + }, + "hideTimeOverride": false, + "id": 70, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "repeat": null, + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "__name__", + "targets": [ + { + "expr": "binlog_drainer_checkpoint_tso{instance = \"$drainer_instance\"}", + "format": "time_series", + "instant": true, + "intervalFactor": 2, + "legendFormat": "checkpoint tso", + "refId": "A" + } + ], + "thresholds": "", + "timeFrom": null, + "timeShift": null, + "title": "Checkpoint TSO", + "transparent": false, + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "tidb-cluster", + "fill": 1, + "gridPos": { + "h": 7, + "w": 16, + "x": 8, + "y": 23 + }, + "id": 69, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "hideEmpty": false, + "hideZero": false, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "binlog_drainer_pump_position{instance = \"$drainer_instance\"}", + "format": "time_series", + "hide": false, + "instant": false, + "intervalFactor": 2, + "legendFormat": "{{nodeID}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Pump Handle TSO", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "transparent": false, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "dateTimeAsIso", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "tidb-cluster", + "editable": true, + "error": false, + "fill": 1, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 30 + }, + "id": 62, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(binlog_drainer_read_binlog_size_count{instance = \"$drainer_instance\"}[1m])) by (nodeID)", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{nodeID}}", + "metric": "binlog_drainer_event", + "refId": "A", + "step": 2 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Pull Binlog QPS by Pump NodeID", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "none", + "label": null, + "logBase": 10, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "tidb-cluster", + "editable": true, + "error": false, + "fill": 1, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 30 + }, + "id": 53, + "legend": { + "alignAsTable": true, + "avg": false, + "current": false, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "histogram_quantile(0.95, rate(binlog_drainer_binlog_reach_duration_time_bucket{instance = \"$drainer_instance\"}[1m]))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{nodeID}}", + "metric": "binlog_drainer_event", + "refId": "A", + "step": 2 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "95% Binlog Reach Duration By Pump", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "s", + "label": null, + "logBase": 10, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "tidb-cluster", + "editable": true, + "error": false, + "fill": 1, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 37 + }, + "id": 58, + "legend": { + "alignAsTable": true, + "avg": false, + "current": false, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "binlog_drainer_error_count{instance = \"$drainer_instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{type}}", + "metric": "binlog_drainer_position", + "refId": "A", + "step": 2 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Error By Type", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "none", + "label": "", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "tidb-cluster", + "editable": true, + "error": false, + "fill": 1, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 37 + }, + "id": 6, + "legend": { + "alignAsTable": true, + "avg": false, + "current": false, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "irate(binlog_drainer_event{instance = \"$drainer_instance\"}[1m])", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{type}}", + "metric": "binlog_drainer_event", + "refId": "A", + "step": 2 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Drainer Event", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "ops", + "label": null, + "logBase": 10, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "tidb-cluster", + "editable": true, + "error": false, + "fill": 1, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 44 + }, + "id": 15, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "histogram_quantile(0.99, rate(binlog_drainer_execute_duration_time_bucket{instance = \"$drainer_instance\"}[1m]))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{component}}", + "metric": "binlog_drainer_txn_duration_time_bucket", + "refId": "A", + "step": 2 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "99% Execute Time", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "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 + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "tidb-cluster", + "editable": true, + "error": false, + "fill": 1, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 44 + }, + "id": 71, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "histogram_quantile(0.99, rate(binlog_drainer_query_duration_time_bucket{instance = \"$drainer_instance\"}[1m]))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{type}}", + "metric": "binlog_drainer_txn_duration_time_bucket", + "refId": "A", + "step": 2 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "99% sql query Time", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "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 + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "tidb-cluster", + "editable": true, + "error": false, + "fill": 1, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 51 + }, + "id": 55, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": true, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "histogram_quantile(0.95, rate(binlog_drainer_read_binlog_size_bucket{instance = \"$drainer_instance\"}[1m]))", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "pump: {{nodeID}}", + "metric": "binlog_drainer_event", + "refId": "A", + "step": 2 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "95% Binlog Size", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "Bps", + "label": null, + "logBase": 10, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "tidb-cluster", + "editable": true, + "error": false, + "fill": 1, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 51 + }, + "id": 52, + "legend": { + "alignAsTable": true, + "avg": false, + "current": false, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "binlog_drainer_ddl_jobs_total{instance = \"$drainer_instance\"}", + "format": "time_series", + "instant": false, + "intervalFactor": 2, + "legendFormat": "ddl job count", + "metric": "binlog_drainer_position", + "refId": "A", + "step": 2 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "DDL Job Count", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "none", + "label": "", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "tidb-cluster", + "fill": 1, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 58 + }, + "id": 72, + "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": "binlog_drainer_queue_size{instance = \"$drainer_instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{name}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "queue size", + "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 + } + ] + } + ], + "repeat": null, + "title": "drainer", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 2 + }, + "id": 75, + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "tidb-cluster", + "editable": true, + "error": false, + "fill": 1, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 59 + }, + "id": 9, + "legend": { + "alignAsTable": true, + "avg": false, + "current": false, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "go_goroutines{component=~\"binlog|pump|drainer\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{instance}}", + "metric": "go_goroutines", + "refId": "A", + "step": 2 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Goroutine", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "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 + } + ] + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "tidb-cluster", + "editable": true, + "error": false, + "fill": 1, + "grid": {}, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 59 + }, + "id": 39, + "legend": { + "alignAsTable": true, + "avg": false, + "current": false, + "max": false, + "min": false, + "rightSide": true, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 2, + "links": [], + "nullPointMode": "connected", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "go_memstats_heap_inuse_bytes{component=~\"binlog|pump|drainer\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{instance}}", + "metric": "go_goroutines", + "refId": "A", + "step": 2 + } + ], + "thresholds": [], + "timeFrom": null, + "timeShift": null, + "title": "Memory", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bits", + "label": "", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ] + } + ], + "repeat": null, + "title": "node", + "type": "row" + } + ], + "refresh": "10s", + "schemaVersion": 18, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "allValue": null, + "current": { + "isNone": true, + "text": "None", + "value": "" + }, + "datasource": "tidb-cluster", + "definition": "", + "hide": 0, + "includeAll": false, + "label": null, + "multi": false, + "name": "drainer_instance", + "options": [], + "query": "label_values(binlog_drainer_ddl_jobs_total, instance)", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "tagValuesQuery": "", + "tags": [], + "tagsQuery": "", + "type": "query", + "useTags": false + } + ] + }, + "time": { + "from": "now-1h", + "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": "browser", + "title": "basic-Test", + "uid": "RDdDTFvZz", + "version": 1 + } diff --git a/examples/monitor-with-externalConfigMap/grafana/tidb-monitor.yaml b/examples/monitor-with-externalConfigMap/grafana/tidb-monitor.yaml new file mode 100644 index 0000000000..9b8509d347 --- /dev/null +++ b/examples/monitor-with-externalConfigMap/grafana/tidb-monitor.yaml @@ -0,0 +1,28 @@ +apiVersion: pingcap.com/v1alpha1 +kind: TidbMonitor +metadata: + name: basic +spec: + clusters: + - name: basic + prometheus: + baseImage: prom/prometheus + version: v2.18.1 + grafana: + baseImage: grafana/grafana + version: 6.1.6 + additionalVolumeMounts: + - name: customdashboard + mountPath: /grafana-dashboard-definitions/tidb/dashboards/custom + initializer: + baseImage: pingcap/tidb-monitor-initializer + version: v5.0.1 + reloader: + baseImage: pingcap/tidb-monitor-reloader + version: v1.0.1 + imagePullPolicy: IfNotPresent + additionalVolumes: + - name: customdashboard + configMap: + name: custom-dashboard + diff --git a/examples/monitor-with-externalConfigMap/README.md b/examples/monitor-with-externalConfigMap/prometheus/README.md similarity index 100% rename from examples/monitor-with-externalConfigMap/README.md rename to examples/monitor-with-externalConfigMap/prometheus/README.md diff --git a/examples/monitor-with-externalConfigMap/external-configMap.yaml b/examples/monitor-with-externalConfigMap/prometheus/external-configMap.yaml similarity index 100% rename from examples/monitor-with-externalConfigMap/external-configMap.yaml rename to examples/monitor-with-externalConfigMap/prometheus/external-configMap.yaml diff --git a/examples/monitor-with-externalConfigMap/tidb-monitor.yaml b/examples/monitor-with-externalConfigMap/prometheus/tidb-monitor.yaml similarity index 97% rename from examples/monitor-with-externalConfigMap/tidb-monitor.yaml rename to examples/monitor-with-externalConfigMap/prometheus/tidb-monitor.yaml index 84ee93c679..cdfd8f1fbc 100644 --- a/examples/monitor-with-externalConfigMap/tidb-monitor.yaml +++ b/examples/monitor-with-externalConfigMap/prometheus/tidb-monitor.yaml @@ -4,7 +4,7 @@ metadata: name: basic spec: clusters: - - name: basic + - name: basic prometheus: config: configMapRef: From bb2ed2a38e412f5056b40694577c9555b2fcf1ba Mon Sep 17 00:00:00 2001 From: mikechengwei <842725815@qq.com> Date: Mon, 17 May 2021 10:41:12 +0800 Subject: [PATCH 03/12] optimze code --- examples/basic/tidb-monitor.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/basic/tidb-monitor.yaml b/examples/basic/tidb-monitor.yaml index 5dc11397cf..5fff154555 100644 --- a/examples/basic/tidb-monitor.yaml +++ b/examples/basic/tidb-monitor.yaml @@ -5,7 +5,7 @@ metadata: spec: replicas: 1 clusters: - - name: basic + - name: basic prometheus: baseImage: prom/prometheus version: v2.18.1 From 617d325a882af59f9bcb747f4349220850d0b7cb Mon Sep 17 00:00:00 2001 From: mikechengwei <842725815@qq.com> Date: Mon, 17 May 2021 10:41:52 +0800 Subject: [PATCH 04/12] optimze code --- .../monitor-with-externalConfigMap/grafana/tidb-monitor.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/monitor-with-externalConfigMap/grafana/tidb-monitor.yaml b/examples/monitor-with-externalConfigMap/grafana/tidb-monitor.yaml index 9b8509d347..03b3435c09 100644 --- a/examples/monitor-with-externalConfigMap/grafana/tidb-monitor.yaml +++ b/examples/monitor-with-externalConfigMap/grafana/tidb-monitor.yaml @@ -4,7 +4,7 @@ metadata: name: basic spec: clusters: - - name: basic + - name: basic prometheus: baseImage: prom/prometheus version: v2.18.1 From 31bdcf7fcf70f6d2762e046510999a9649b4580e Mon Sep 17 00:00:00 2001 From: mikechengwei <842725815@qq.com> Date: Mon, 17 May 2021 10:49:01 +0800 Subject: [PATCH 05/12] optimze code --- .../grafana/README.md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 examples/monitor-with-externalConfigMap/grafana/README.md diff --git a/examples/monitor-with-externalConfigMap/grafana/README.md b/examples/monitor-with-externalConfigMap/grafana/README.md new file mode 100644 index 0000000000..bdec46fe0d --- /dev/null +++ b/examples/monitor-with-externalConfigMap/grafana/README.md @@ -0,0 +1,52 @@ +# A example describe grafana mount custom dashboard json file. + +> **Note:** +> +> This document is to show how to mount custom dashboard for grafana in TidbMonitor. +> This would help to customize user's own grafana dashboards or others. + +## Install + +The following commands is assumed to be executed in this directory. + +Create custom dashboard json with configMap: + +```bash +> kubectl apply -f custom-dashboard.yaml-n ${namespace} +``` + +Install tidb monitor: + +```bash +kubectl apply -f tidb-monitor.yaml -n ${namespace} +``` + +Wait for cluster Pods ready: + +```bash +watch kubectl -n ${namespace} get pod +``` + + +Explore the monitoring dashboards: + +```bash +> kubectl -n ${namespace} port-forward svc/basic-grafann 3000:3000 &>/tmp/pf-grafana.log & +``` + +Browse [localhost:3000](http://localhost:3000), check custom dashboard json file . + +## Uninstall + + +Uninstall tidb monitor: + +```bash +kubectl delete -f tidb-monitor.yaml -n ${namespace} +``` + +Delete external configMap: +```bash +> kubectl delete -f custom-dashboard.yaml -n ${namespace} +``` + From ea851cea8ef658ce8ab3c962aea3762f086a392a Mon Sep 17 00:00:00 2001 From: mikechengwei <842725815@qq.com> Date: Mon, 17 May 2021 11:59:49 +0800 Subject: [PATCH 06/12] optimze code --- examples/basic/tidb-monitor.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/basic/tidb-monitor.yaml b/examples/basic/tidb-monitor.yaml index 5fff154555..5dc11397cf 100644 --- a/examples/basic/tidb-monitor.yaml +++ b/examples/basic/tidb-monitor.yaml @@ -5,7 +5,7 @@ metadata: spec: replicas: 1 clusters: - - name: basic + - name: basic prometheus: baseImage: prom/prometheus version: v2.18.1 From 86c605e6925a5ec6e526a0d3d6263d649f604032 Mon Sep 17 00:00:00 2001 From: Mike <842725815@qq.com> Date: Mon, 17 May 2021 12:00:04 +0800 Subject: [PATCH 07/12] Update examples/monitor-with-externalConfigMap/grafana/README.md Co-authored-by: DanielZhangQD <36026334+DanielZhangQD@users.noreply.github.com> --- examples/monitor-with-externalConfigMap/grafana/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/monitor-with-externalConfigMap/grafana/README.md b/examples/monitor-with-externalConfigMap/grafana/README.md index bdec46fe0d..ba9ba95182 100644 --- a/examples/monitor-with-externalConfigMap/grafana/README.md +++ b/examples/monitor-with-externalConfigMap/grafana/README.md @@ -12,7 +12,7 @@ The following commands is assumed to be executed in this directory. Create custom dashboard json with configMap: ```bash -> kubectl apply -f custom-dashboard.yaml-n ${namespace} +> kubectl apply -f custom-dashboard.yaml -n ${namespace} ``` Install tidb monitor: @@ -49,4 +49,3 @@ Delete external configMap: ```bash > kubectl delete -f custom-dashboard.yaml -n ${namespace} ``` - From 69cd8d2e554001efc14006c4a145adfa88c62033 Mon Sep 17 00:00:00 2001 From: Mike <842725815@qq.com> Date: Mon, 17 May 2021 12:07:19 +0800 Subject: [PATCH 08/12] Update examples/monitor-with-externalConfigMap/grafana/README.md Co-authored-by: DanielZhangQD <36026334+DanielZhangQD@users.noreply.github.com> --- examples/monitor-with-externalConfigMap/grafana/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/monitor-with-externalConfigMap/grafana/README.md b/examples/monitor-with-externalConfigMap/grafana/README.md index ba9ba95182..ad21897cdc 100644 --- a/examples/monitor-with-externalConfigMap/grafana/README.md +++ b/examples/monitor-with-externalConfigMap/grafana/README.md @@ -31,7 +31,7 @@ watch kubectl -n ${namespace} get pod Explore the monitoring dashboards: ```bash -> kubectl -n ${namespace} port-forward svc/basic-grafann 3000:3000 &>/tmp/pf-grafana.log & +> kubectl -n ${namespace} port-forward svc/basic-grafana 3000:3000 ``` Browse [localhost:3000](http://localhost:3000), check custom dashboard json file . From 0783280c95b1c4612c2af20bb4d18752dea42e75 Mon Sep 17 00:00:00 2001 From: Mike <842725815@qq.com> Date: Mon, 17 May 2021 12:07:31 +0800 Subject: [PATCH 09/12] Update examples/monitor-with-externalConfigMap/grafana/README.md Co-authored-by: DanielZhangQD <36026334+DanielZhangQD@users.noreply.github.com> --- examples/monitor-with-externalConfigMap/grafana/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/monitor-with-externalConfigMap/grafana/README.md b/examples/monitor-with-externalConfigMap/grafana/README.md index ad21897cdc..8510f71faa 100644 --- a/examples/monitor-with-externalConfigMap/grafana/README.md +++ b/examples/monitor-with-externalConfigMap/grafana/README.md @@ -34,7 +34,7 @@ Explore the monitoring dashboards: > kubectl -n ${namespace} port-forward svc/basic-grafana 3000:3000 ``` -Browse [localhost:3000](http://localhost:3000), check custom dashboard json file . +Browse [localhost:3000](http://localhost:3000), and check the custom dashboard. ## Uninstall From e1b411ab32dc549048ca62d33ab3fa48bd64cea4 Mon Sep 17 00:00:00 2001 From: mikechengwei <842725815@qq.com> Date: Mon, 17 May 2021 12:08:17 +0800 Subject: [PATCH 10/12] optimze code --- .../monitor-with-externalConfigMap/prometheus/tidb-monitor.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/monitor-with-externalConfigMap/prometheus/tidb-monitor.yaml b/examples/monitor-with-externalConfigMap/prometheus/tidb-monitor.yaml index cdfd8f1fbc..84ee93c679 100644 --- a/examples/monitor-with-externalConfigMap/prometheus/tidb-monitor.yaml +++ b/examples/monitor-with-externalConfigMap/prometheus/tidb-monitor.yaml @@ -4,7 +4,7 @@ metadata: name: basic spec: clusters: - - name: basic + - name: basic prometheus: config: configMapRef: From f369f812da0daa830887866e4df15fcbe52f74e7 Mon Sep 17 00:00:00 2001 From: mikechengwei <842725815@qq.com> Date: Mon, 17 May 2021 13:55:07 +0800 Subject: [PATCH 11/12] optimze README.md --- .../grafana/README.md | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/examples/monitor-with-externalConfigMap/grafana/README.md b/examples/monitor-with-externalConfigMap/grafana/README.md index 8510f71faa..0251a40d79 100644 --- a/examples/monitor-with-externalConfigMap/grafana/README.md +++ b/examples/monitor-with-externalConfigMap/grafana/README.md @@ -1,51 +1,50 @@ -# A example describe grafana mount custom dashboard json file. +# An example describes how to mount a custom dashboard JSON file for Grafana. > **Note:** > -> This document is to show how to mount custom dashboard for grafana in TidbMonitor. -> This would help to customize user's own grafana dashboards or others. +> This document is to show how to mount a custom dashboard for Grafana in TidbMonitor. +> This would help to customize the user's Grafana dashboards. ## Install -The following commands is assumed to be executed in this directory. +The following commands are assumed to be executed in this directory. -Create custom dashboard json with configMap: +Create custom dashboard JSON with configMap: ```bash -> kubectl apply -f custom-dashboard.yaml -n ${namespace} +kubectl apply -f custom-dashboard.yaml -n ${namespace} ``` -Install tidb monitor: +Install TidbMonitor: ```bash kubectl apply -f tidb-monitor.yaml -n ${namespace} ``` -Wait for cluster Pods ready: +Wait for Pods ready: ```bash watch kubectl -n ${namespace} get pod ``` - Explore the monitoring dashboards: ```bash -> kubectl -n ${namespace} port-forward svc/basic-grafana 3000:3000 +kubectl -n ${namespace} port-forward svc/basic-grafana 3000:3000 ``` Browse [localhost:3000](http://localhost:3000), and check the custom dashboard. ## Uninstall - -Uninstall tidb monitor: +Uninstall TidbMonitor: ```bash kubectl delete -f tidb-monitor.yaml -n ${namespace} ``` -Delete external configMap: +Delete the external configMap: + ```bash -> kubectl delete -f custom-dashboard.yaml -n ${namespace} -``` +kubectl delete -f custom-dashboard.yaml -n ${namespace} +``` \ No newline at end of file From 7407aac73aaf6a067f96f4c2896edc080e40c7d5 Mon Sep 17 00:00:00 2001 From: mikechengwei <842725815@qq.com> Date: Mon, 17 May 2021 17:06:29 +0800 Subject: [PATCH 12/12] optimze README.md --- examples/monitor-with-externalConfigMap/grafana/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/monitor-with-externalConfigMap/grafana/README.md b/examples/monitor-with-externalConfigMap/grafana/README.md index 0251a40d79..d736282925 100644 --- a/examples/monitor-with-externalConfigMap/grafana/README.md +++ b/examples/monitor-with-externalConfigMap/grafana/README.md @@ -47,4 +47,4 @@ Delete the external configMap: ```bash kubectl delete -f custom-dashboard.yaml -n ${namespace} -``` \ No newline at end of file +```