Welcome to mirror list, hosted at ThFree Co, Russian Federation.

template_db_tidb_tikv_http.yaml « tidb_tikv_http « tidb_http « db « templates - github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 06e3777400bce5db8a9f1773eb98b9d7c565004a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
zabbix_export:
  version: '6.2'
  date: '2022-06-07T19:37:42Z'
  template_groups:
    -
      uuid: 748ad4d098d447d492bb935c907f652f
      name: Templates/Databases
  templates:
    -
      uuid: 3a0bbbb2ec0a4c58bba3ba3a3d6ce660
      template: 'TiDB TiKV by HTTP'
      name: 'TiDB TiKV by HTTP'
      description: |
        The template to monitor TiKV server of TiDB cluster by Zabbix that works without any external scripts.
        Most of the metrics are collected in one go, thanks to Zabbix bulk data collection.
        Don't forget to change the macros {$TIKV.URL}, {$TIKV.PORT}.
        
        Template `TiDB TiKV by HTTP` — collects metrics by HTTP agent from TiKV /metrics endpoint.
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback
        
        Template tooling version used: 0.41
      groups:
        -
          name: Templates/Databases
      items:
        -
          uuid: 449a7ba908884db3af4ec8ccc0d7ea43
          name: 'TiKV: Scheduler: High priority commands total, rate'
          type: DEPENDENT
          key: tikv.commands_pri.high.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Total count of high priority commands per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_scheduler_commands_pri_total" && @.labels.priority == "high")].value.first()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: scheduler
        -
          uuid: b5ce79ee79804e76bb7b91e17915159c
          name: 'TiKV: Scheduler: Low priority commands total, rate'
          type: DEPENDENT
          key: tikv.commands_pri.low.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Total count of low priority commands per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_scheduler_commands_pri_total" && @.labels.priority == "low")].value.first()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: scheduler
        -
          uuid: df3fa02457ac47168fad251727b300ff
          name: 'TiKV: Scheduler: Normal priority commands total, rate'
          type: DEPENDENT
          key: tikv.commands_pri.normal.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Total count of normal priority commands per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_scheduler_commands_pri_total" && @.labels.priority == "normal")].value.first()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: scheduler
        -
          uuid: dbf8288b5cab4e8a95b5e7c4355676bd
          name: 'TiKV: Coprocessor: Requests, rate'
          type: DEPENDENT
          key: tikv.coprocessor_request.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Ops
          description: 'Total number of coprocessor requests per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_coprocessor_request_duration_seconds_count")].value.sum()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: coprocessor
        -
          uuid: d6185382a1974b9194e68bea4f14eb75
          name: 'TiKV: Coprocessor: Errors, rate'
          type: DEPENDENT
          key: tikv.coprocessor_request_error.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Ops
          description: 'Total number of push down request error per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_coprocessor_request_error")].value.sum()'
              error_handler: DISCARD_VALUE
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: coprocessor
          triggers:
            -
              uuid: 31eca27ff6ce4ed78ee428ed3b8d8806
              expression: 'min(/TiDB TiKV by HTTP/tikv.coprocessor_request_error.rate,5m)>{$TIKV.COPOCESSOR.ERRORS.MAX.WARN}'
              name: 'TiKV: Too many coprocessor request error'
              event_name: 'TiKV: Too many coprocessor request error (over {$TIKV.COPOCESSOR.ERRORS.MAX.WARN} in 5m)'
              priority: WARNING
              tags:
                -
                  tag: scope
                  value: performance
        -
          uuid: 5567ebf02fb6441dbb6672e1bc77b3ab
          name: 'TiKV: Coprocessor: Response size, rate'
          type: DEPENDENT
          key: tikv.coprocessor_response_bytes.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Bps
          description: 'The total size of coprocessor response per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_coprocessor_response_bytes")].value.first()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: coprocessor
        -
          uuid: 237f6ba2973e472d8c20de1d61b4695c
          name: 'TiKV: Coprocessor: RocksDB ops, rate'
          type: DEPENDENT
          key: tikv.coprocessor_rocksdb_perf.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Ops
          description: 'Total number of RocksDB internal operations from PerfContext per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_coprocessor_rocksdb_perf")].value.sum()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: coprocessor
        -
          uuid: bfcec759c0894cf89c5267fc6b3862d7
          name: 'TiKV: Coprocessor: Scan keys, rate'
          type: DEPENDENT
          key: tikv.coprocessor_scan_keys_sum.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Ops
          description: 'Total number of scan keys observed per request per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_coprocessor_scan_keys")].value.sum()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: coprocessor
        -
          uuid: a76665b7a9924f8cbd4a455bc248d790
          name: 'TiKV: CPU util'
          type: DEPENDENT
          key: tikv.cpu.util
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: '%'
          description: 'The CPU usage ratio on TiKV instance.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_thread_cpu_seconds_total")].value.sum()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
            -
              type: MULTIPLIER
              parameters:
                - '100'
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: cpu
        -
          uuid: 4558a5a11c304584bf24a7c3d2eace23
          name: 'TiKV: Bytes read'
          type: DEPENDENT
          key: tikv.engine_flow_bytes.read
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Bps
          description: 'The total bytes of read in TiKV instance.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_engine_flow_bytes" && @.labels.db == "kv" && @.labels.type =~ "bytes_read|iter_bytes_read")].value.sum()'
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: storage
        -
          uuid: 0d44c3c9a7f34905b0404ae39a3bc881
          name: 'TiKV: Bytes write'
          type: DEPENDENT
          key: tikv.engine_flow_bytes.write
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Bps
          description: 'The total bytes of write in TiKV instance.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_engine_flow_bytes" && @.labels.db == "kv" && @.labels.type == "wal_file_bytes")].value.first()'
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: storage
        -
          uuid: f79d5daea61842b18e39c7289657ddf5
          name: 'TiKV: Store size'
          type: DEPENDENT
          key: tikv.engine_size
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: B
          description: 'The storage size of TiKV instance.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_engine_size_bytes")].value.sum()'
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: storage
        -
          uuid: 418bcc8c0bc440468efe833bef02929d
          name: 'TiKV: Get instance metrics'
          type: HTTP_AGENT
          key: tikv.get_metrics
          history: '0'
          trends: '0'
          value_type: TEXT
          description: 'Get TiKV instance metrics.'
          preprocessing:
            -
              type: CHECK_NOT_SUPPORTED
              parameters:
                - ''
            -
              type: PROMETHEUS_TO_JSON
              parameters:
                - ''
          url: '{$TIKV.URL}:{$TIKV.PORT}/metrics'
          tags:
            -
              tag: component
              value: raw
        -
          uuid: fed3db7222fa41a8bf51d2ad860a22d4
          name: 'TiKV: Total query, rate'
          type: DEPENDENT
          key: tikv.grpc_msg.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Ops
          description: 'The total QPS in TiKV instance.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_grpc_msg_duration_seconds_count")].value.sum()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: queries
        -
          uuid: c68db41c184d44d98445cc66489ef39c
          name: 'TiKV: Total query errors, rate'
          type: DEPENDENT
          key: tikv.grpc_msg_fail.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Ops
          description: 'The total number of gRPC message handling failure per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_grpc_msg_fail_total")].value.sum()'
              error_handler: DISCARD_VALUE
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: grpc
        -
          uuid: 7afa5147a1e247a5b8914d8739d31f15
          name: 'TiKV: Server: failure messages total, rate'
          type: DEPENDENT
          key: tikv.messages.failure.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Total number of reporting failure messages per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_server_report_failure_msg_total")].value.sum()'
              error_handler: DISCARD_VALUE
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: application
        -
          uuid: e6137dd87faa496497b23cadaa37dca9
          name: 'TiKV: Regions, count'
          type: DEPENDENT
          key: tikv.region_count
          delay: '0'
          history: 7d
          description: 'The number of regions collected in TiKV instance.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_raftstore_region_count" && @.labels.type == "region" )].value.first()'
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: regions
        -
          uuid: 2ab7643435794ec6b5a2c3eb1dd7e913
          name: 'TiKV: Regions, leader'
          type: DEPENDENT
          key: tikv.region_leader
          delay: '0'
          history: 7d
          description: 'The number of leaders in TiKV instance.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_raftstore_region_count" && @.labels.type == "leader" )].value.first()'
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: regions
        -
          uuid: 1c480fa23eaa42bcb367bb5afdcb65b9
          name: 'TiKV: RSS memory usage'
          type: DEPENDENT
          key: tikv.rss_bytes
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: B
          description: 'Resident memory size in bytes.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "process_resident_memory_bytes")].value.first()'
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: memory
        -
          uuid: 62f856cf22804262aef64e9369049332
          name: 'TiKV: Scheduler: Commands total, rate'
          type: DEPENDENT
          key: tikv.scheduler_commands.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Total number of commands per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_scheduler_stage_total")].value.sum()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: scheduler
        -
          uuid: 33a1b2f676134cf1b81771fbaf152f59
          name: 'TiKV: Scheduler: Pending commands'
          type: DEPENDENT
          key: tikv.scheduler_contex
          delay: '0'
          history: 7d
          description: 'The total number of pending commands. The scheduler receives commands from clients, executes them against the MVCC layer storage engine.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_scheduler_contex_total")].value.first()'
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: scheduler
          triggers:
            -
              uuid: 0f21c02b8e1c45d9bbe0c3313cea1a23
              expression: 'min(/TiDB TiKV by HTTP/tikv.scheduler_contex,5m)>{$TIKV.PENDING_COMMANDS.MAX.WARN}'
              name: 'TiKV: Too many pending commands'
              event_name: 'TiKV: Too many pending commands (over {$TIKV.PENDING_COMMANDS.MAX.WARN} for 5m)'
              priority: AVERAGE
              tags:
                -
                  tag: scope
                  value: performance
        -
          uuid: 8f5c9d2b9eca4a489d764420ee06e4b6
          name: 'TiKV: Scheduler: Busy, rate'
          type: DEPENDENT
          key: tikv.scheduler_too_busy.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'The total count of too busy schedulers per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_scheduler_too_busy_total")].value.sum()'
              error_handler: DISCARD_VALUE
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: scheduler
        -
          uuid: 0a2d0a119bcd406aadfc5c014186c5d3
          name: 'TiKV: Snapshot: Applying'
          type: DEPENDENT
          key: tikv.snapshot.applying
          delay: '0'
          history: 7d
          description: 'The total amount of raftstore snapshot traffic.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_raftstore_snapshot_traffic_total" && @.labels.type == "applying")].value.first()'
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: snapshot
        -
          uuid: 58559be859d64887a1b919e36aa1e336
          name: 'TiKV: Snapshot: Receiving'
          type: DEPENDENT
          key: tikv.snapshot.receiving
          delay: '0'
          history: 7d
          description: 'The total amount of raftstore snapshot traffic.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_raftstore_snapshot_traffic_total" && @.labels.type == "receiving")].value.first()'
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: snapshot
        -
          uuid: 0ae6a2024ed3488498e22bc542d27619
          name: 'TiKV: Snapshot: Sending'
          type: DEPENDENT
          key: tikv.snapshot.sending
          delay: '0'
          history: 7d
          description: 'The total amount of raftstore snapshot traffic.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_raftstore_snapshot_traffic_total" && @.labels.type == "sending")].value.first()'
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: snapshot
        -
          uuid: ce31318a420d40668e62a47fe19d3d40
          name: 'TiKV: Storage: commands total, rate'
          type: DEPENDENT
          key: tikv.storage_command.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Total number of commands received per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_storage_command_total")].value.sum()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: commands
        -
          uuid: fbfaa0d967c049c0a1bbcec5afea4bf2
          name: 'TiKV: Available size'
          type: DEPENDENT
          key: tikv.store_size.available
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: B
          description: 'The available capacity of TiKV instance.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_store_size_bytes" && @.labels.type == "available")].value.first()'
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: storage
        -
          uuid: 1e0c1c071b604e77998797c2f9d41dfc
          name: 'TiKV: Capacity size'
          type: DEPENDENT
          key: tikv.store_size.capacity
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: B
          description: 'The capacity size of TiKV instance.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_store_size_bytes" && @.labels.type == "capacity")].value.first()'
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: storage
        -
          uuid: f2632dbd773140398a7d61608d85f392
          name: 'TiKV: Uptime'
          type: DEPENDENT
          key: tikv.uptime
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: uptime
          description: 'The runtime of each TiKV instance.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="process_start_time_seconds")].value.first()'
            -
              type: JAVASCRIPT
              parameters:
                - |
                  //use boottime to calculate uptime
                  return (Math.floor(Date.now()/1000)-Number(value));
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: application
          triggers:
            -
              uuid: ca06602fa0b64a2ba0c51ed4835c52b2
              expression: 'last(/TiDB TiKV by HTTP/tikv.uptime)<10m'
              name: 'TiKV: has been restarted'
              event_name: 'TiKV: has been restarted (uptime < 10m)'
              priority: INFO
              description: 'Uptime is less than 10 minutes.'
              manual_close: 'YES'
              tags:
                -
                  tag: scope
                  value: notice
        -
          uuid: 8b7c2dc8c60e491db76cafd2d0e1234b
          name: 'TiKV: Snapshot: Pending tasks'
          type: DEPENDENT
          key: tikv.worker_pending_task
          delay: '0'
          history: 7d
          description: 'The number of tasks currently running by the worker or pending.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_worker_pending_task_total")].value.first()'
          master_item:
            key: tikv.get_metrics
          tags:
            -
              tag: component
              value: snapshot
          triggers:
            -
              uuid: f26874f910e34933983685ae43a90bee
              expression: 'min(/TiDB TiKV by HTTP/tikv.worker_pending_task,5m)>{$TIKV.PENDING_TASKS.MAX.WARN}'
              name: 'TiKV: Too many pending tasks'
              event_name: 'TiKV: Too many pending tasks (over {$TIKV.PENDING_TASKS.MAX.WARN} for 5m)'
              priority: AVERAGE
              tags:
                -
                  tag: scope
                  value: performance
      discovery_rules:
        -
          uuid: f1c7de94679e40a4ac6f569e05ad61d0
          name: 'Coprocessor metrics discovery'
          type: DEPENDENT
          key: tikv.coprocessor.discovery
          delay: '0'
          description: 'Discovery coprocessor metrics.'
          item_prototypes:
            -
              uuid: ecbe08549fef42d5aad0369e861b4c20
              name: 'TiKV: Coprocessor: {#REQ_TYPE} requests, rate'
              type: DEPENDENT
              key: 'tikv.coprocessor_request.rate[{#REQ_TYPE}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: Ops
              description: 'Total number of coprocessor requests per second.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name == "tikv_coprocessor_request_duration_seconds_count" && @.labels.req == "{#REQ_TYPE}")].value.first()'
                -
                  type: CHANGE_PER_SECOND
                  parameters:
                    - ''
              master_item:
                key: tikv.get_metrics
              tags:
                -
                  tag: component
                  value: coprocessor
                -
                  tag: request
                  value: '{#REQ_TYPE}'
            -
              uuid: 08060401409b4fff97430c595fec7b82
              name: 'TiKV: Coprocessor: {#REQ_TYPE} errors, rate'
              type: DEPENDENT
              key: 'tikv.coprocessor_request_error.rate[{#REQ_TYPE}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: Ops
              description: 'Total number of push down request error per second.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name == "tikv_coprocessor_request_error" && @.labels.req == "{#REQ_TYPE}")].value.first()'
                  error_handler: DISCARD_VALUE
                -
                  type: CHANGE_PER_SECOND
                  parameters:
                    - ''
              master_item:
                key: tikv.get_metrics
              tags:
                -
                  tag: component
                  value: coprocessor
                -
                  tag: request
                  value: '{#REQ_TYPE}'
            -
              uuid: bff6ee970f7349edba6cac1cd0da70ed
              name: 'TiKV: Coprocessor: {#REQ_TYPE} RocksDB ops, rate'
              type: DEPENDENT
              key: 'tikv.coprocessor_rocksdb_perf.rate[{#REQ_TYPE}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: Ops
              description: 'Total number of RocksDB internal operations from PerfContext per second.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name == "tikv_coprocessor_rocksdb_perf" && @.labels.req == "{#REQ_TYPE}")].value.sum()'
                -
                  type: CHANGE_PER_SECOND
                  parameters:
                    - ''
              master_item:
                key: tikv.get_metrics
              tags:
                -
                  tag: component
                  value: coprocessor
                -
                  tag: request
                  value: '{#REQ_TYPE}'
            -
              uuid: 8ef93de8a25b4f35b2e54f6ced4a5bd2
              name: 'TiKV: Coprocessor: {#REQ_TYPE} scan keys, rate'
              type: DEPENDENT
              key: 'tikv.coprocessor_scan_keys.rate[{#REQ_TYPE}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: Ops
              description: 'Total number of scan keys observed per request per second.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name == "tikv_coprocessor_scan_keys_count" && @.labels.req == "{#REQ_TYPE}")].value.first()'
                -
                  type: CHANGE_PER_SECOND
                  parameters:
                    - ''
              master_item:
                key: tikv.get_metrics
              tags:
                -
                  tag: component
                  value: coprocessor
                -
                  tag: request
                  value: '{#REQ_TYPE}'
          master_item:
            key: tikv.get_metrics
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_coprocessor_request_duration_seconds_count")]'
            -
              type: JAVASCRIPT
              parameters:
                - |
                  output = JSON.parse(value).map(function(item){
                       return {
                           "{#REQ_TYPE}": item.labels.req,
                       }})
                   return JSON.stringify({"data": output})
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
        -
          uuid: 39e4031ee41143ed9d0c84492f817125
          name: 'QPS metrics discovery'
          type: DEPENDENT
          key: tikv.qps.discovery
          delay: '0'
          description: 'Discovery QPS metrics.'
          item_prototypes:
            -
              uuid: 3b1d1b10cee6465c822152072189ebbe
              name: 'TiKV: Query: {#TYPE}, rate'
              type: DEPENDENT
              key: 'tikv.grpc_msg.rate[{#TYPE}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: Ops
              description: 'The QPS per command in TiKV instance.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name == "tikv_grpc_msg_duration_seconds_count" && @.labels.type == "{#TYPE}")].value.first()'
                  error_handler: CUSTOM_VALUE
              master_item:
                key: tikv.get_metrics
              tags:
                -
                  tag: component
                  value: grpc
                -
                  tag: type
                  value: '{#TYPE}'
          master_item:
            key: tikv.get_metrics
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_grpc_msg_duration_seconds_count")]'
            -
              type: JAVASCRIPT
              parameters:
                - |
                  output = JSON.parse(value).map(function(item){
                       return {
                           "{#TYPE}": item.labels.type,
                       }})
                   return JSON.stringify({"data": output})
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
        -
          uuid: 7168e631146546129284cbf9c52b2025
          name: 'Scheduler metrics discovery'
          type: DEPENDENT
          key: tikv.scheduler.discovery
          delay: '0'
          description: 'Discovery scheduler metrics.'
          item_prototypes:
            -
              uuid: c4f902a0be5444b2babb1775b89a6827
              name: 'TiKV: Scheduler: commands {#STAGE}, rate'
              type: DEPENDENT
              key: 'tikv.scheduler_stage.rate[{#STAGE}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              description: 'Total number of commands on each stage per second.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name == "tikv_scheduler_stage_total" && @.labels.stage == "{#STAGE}")].value.sum()'
                  error_handler: CUSTOM_VALUE
                  error_handler_params: '0'
                -
                  type: CHANGE_PER_SECOND
                  parameters:
                    - ''
              master_item:
                key: tikv.get_metrics
              tags:
                -
                  tag: component
                  value: scheduler
                -
                  tag: stage
                  value: '{#STAGE}'
          master_item:
            key: tikv.get_metrics
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_scheduler_stage_total")]'
            -
              type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                      result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                      var stage = item.labels.stage;
                      if (!(lookup[stage])) {
                          lookup[stage] = 1;
                          result.push({ "{#STAGE}": stage });
                      }
                  })
                  
                  return JSON.stringify(result);
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
        -
          uuid: 5ebd2e2131ab4a9f8ca63f0e490b04a3
          name: 'Server errors discovery'
          type: DEPENDENT
          key: tikv.server_report_failure.discovery
          delay: '0'
          description: 'Discovery server errors metrics.'
          item_prototypes:
            -
              uuid: 064e74b5484e42e4acf3122c8ead4826
              name: 'TiKV: Store_id {#STORE_ID}: failure messages "{#TYPE}", rate'
              type: DEPENDENT
              key: 'tikv.messages.failure.rate[{#STORE_ID},{#TYPE}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              description: 'Total number of reporting failure messages. The metric has two labels: type and store_id. type represents the failure type, and store_id represents the destination peer store id.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name == "tikv_server_report_failure_msg_total" && @.labels.store_id == "{#STORE_ID}"  && @.labels.type == "{#TYPE}")].value.sum()'
                -
                  type: CHANGE_PER_SECOND
                  parameters:
                    - ''
              master_item:
                key: tikv.get_metrics
              tags:
                -
                  tag: component
                  value: stores
                -
                  tag: message-type
                  value: '{#TYPE}'
                -
                  tag: store
                  value: '{#STORE_ID}'
              trigger_prototypes:
                -
                  uuid: 1f65b64824d64852aaa609df5f3e27fd
                  expression: 'min(/TiDB TiKV by HTTP/tikv.messages.failure.rate[{#STORE_ID},{#TYPE}],5m)>{$TIKV.STORE.ERRORS.MAX.WARN}'
                  name: 'TiKV: Store_id {#STORE_ID}: Too many failure messages "{#TYPE}"'
                  event_name: 'TiKV: Store_id {#STORE_ID}: Too many failure messages "{#TYPE}" (over {$TIKV.STORE.ERRORS.MAX.WARN} in 5m)'
                  discover: NO_DISCOVER
                  priority: WARNING
                  description: 'Indicates that the remote TiKV cannot be connected.'
                  tags:
                    -
                      tag: scope
                      value: availability
          master_item:
            key: tikv.get_metrics
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tikv_server_report_failure_msg_total")]'
              error_handler: DISCARD_VALUE
            -
              type: JAVASCRIPT
              parameters:
                - |
                  output = JSON.parse(value).map(function(item){
                       return {
                           "{#STORE_ID}": item.labels.store_id,
                           "{#TYPE}": item.labels.type,
                  
                       }})
                   return JSON.stringify({"data": output})
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          overrides:
            -
              name: 'Too many unreachable messages trigger'
              step: '1'
              filter:
                conditions:
                  -
                    macro: '{#TYPE}'
                    value: unreachable
                    formulaid: A
              operations:
                -
                  operationobject: TRIGGER_PROTOTYPE
                  operator: LIKE
                  value: 'Too many failure messages'
                  status: ENABLED
                  discover: DISCOVER
      tags:
        -
          tag: class
          value: database
        -
          tag: target
          value: tidb
        -
          tag: target
          value: tikv
      macros:
        -
          macro: '{$TIKV.COPOCESSOR.ERRORS.MAX.WARN}'
          value: '1'
          description: 'Maximum number of coprocessor request errors'
        -
          macro: '{$TIKV.PENDING_COMMANDS.MAX.WARN}'
          value: '1'
          description: 'Maximum number of pending commands'
        -
          macro: '{$TIKV.PENDING_TASKS.MAX.WARN}'
          value: '1'
          description: 'Maximum number of tasks currently running by the worker or pending'
        -
          macro: '{$TIKV.PORT}'
          value: '20180'
          description: 'The port of TiKV server metrics web endpoint'
        -
          macro: '{$TIKV.STORE.ERRORS.MAX.WARN}'
          value: '1'
          description: 'Maximum number of failure messages'
        -
          macro: '{$TIKV.URL}'
          value: localhost
          description: 'TiKV server URL'
  graphs:
    -
      uuid: cdca8a2bb2bb486da8c57740acc431d6
      name: 'TiKV: Scheduler priority commands rate'
      graph_items:
        -
          color: 1A7C11
          item:
            host: 'TiDB TiKV by HTTP'
            key: tikv.commands_pri.normal.rate
        -
          sortorder: '1'
          color: 2774A4
          item:
            host: 'TiDB TiKV by HTTP'
            key: tikv.commands_pri.high.rate
        -
          sortorder: '2'
          color: F63100
          item:
            host: 'TiDB TiKV by HTTP'
            key: tikv.commands_pri.low.rate
    -
      uuid: 93a38153ed8b44a49849cb1f920f50a4
      name: 'TiKV: Snapshot state count'
      graph_items:
        -
          color: 1A7C11
          item:
            host: 'TiDB TiKV by HTTP'
            key: tikv.snapshot.applying
        -
          sortorder: '1'
          color: 2774A4
          item:
            host: 'TiDB TiKV by HTTP'
            key: tikv.snapshot.receiving
        -
          sortorder: '2'
          color: F63100
          item:
            host: 'TiDB TiKV by HTTP'
            key: tikv.snapshot.sending