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

template_db_tidb_tidb_http.yaml « tidb_tidb_http « tidb_http « db « templates - github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bab39373ebb9391815122f4164b0523a2a627dd0 (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
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
zabbix_export:
  version: '6.2'
  date: '2022-06-07T19:37:41Z'
  template_groups:
    -
      uuid: 748ad4d098d447d492bb935c907f652f
      name: Templates/Databases
  templates:
    -
      uuid: 8ec72ebbe3204d7789429640abcac610
      template: 'TiDB by HTTP'
      name: 'TiDB by HTTP'
      description: |
        The template to monitor TiDB 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 {$TIDB.URL}, {$TIDB.PORT}.
        
        Template `TiDB by HTTP` — collects metrics by HTTP agent from PD /metrics endpoint and from monitoring API.
        
        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: f6c68d3961e04d5185ab38c12fa25532
          name: 'TiDB: CPU'
          type: DEPENDENT
          key: tidb.cpu.util
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: '%'
          description: 'Total user and system CPU usage ratio.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="process_cpu_seconds_total")].value.first()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
            -
              type: MULTIPLIER
              parameters:
                - '100'
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: cpu
        -
          uuid: e1da33fc95ab46bcbe6bc6a68154d172
          name: 'TiDB: DDL waiting jobs'
          type: DEPENDENT
          key: tidb.ddl_waiting_jobs
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'The number of TiDB operations that resolve locks per second. When TiDB''s read or write request encounters a lock, it tries to resolve the lock.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_ddl_waiting_jobs")].value.sum()'
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: operations
          triggers:
            -
              uuid: 4125d55d9931455091d2f3a0b25e9678
              expression: 'min(/TiDB by HTTP/tidb.ddl_waiting_jobs,5m)>{$TIDB.DDL.WAITING.MAX.WARN}'
              name: 'TiDB: Too many DDL waiting jobs'
              event_name: 'TiDB: Too many DDL waiting jobs (over {$TIDB.DDL.WAITING.MAX.WARN} for 5m)'
              priority: WARNING
              tags:
                -
                  tag: scope
                  value: performance
        -
          uuid: 0fe0c1dee67e469d9d38193ef7b040ec
          name: 'TiDB: Load schema failed, rate'
          type: DEPENDENT
          key: tidb.domain_load_schema.failed.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'The total number of failures to reload the latest schema information in TiDB per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_domain_load_schema_total && @.labels.type == "failed"")].value.first()'
              error_handler: DISCARD_VALUE
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: domain
          triggers:
            -
              uuid: b4948f37af804c01a2b8887f9e89ec90
              expression: 'min(/TiDB by HTTP/tidb.domain_load_schema.failed.rate,5m)>{$TIDB.SCHEMA_LOAD_ERRORS.MAX.WARN}'
              name: 'TiDB: Too many schema lease errors'
              event_name: 'TiDB: Too many schema lease errors (over {$TIDB.SCHEMA_LOAD_ERRORS.MAX.WARN} for 5m)'
              priority: AVERAGE
              tags:
                -
                  tag: scope
                  value: availability
        -
          uuid: b0e960ddac4d43a3860e8a06dfe09e03
          name: 'TiDB: Load schema total, rate'
          type: DEPENDENT
          key: tidb.domain_load_schema.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'The statistics of the schemas that TiDB obtains from TiKV per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_domain_load_schema_total")].value.sum()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: domain
        -
          uuid: 8fffe502bd2f42368e60d2110f1c3319
          name: 'TiDB: Failed Query, rate'
          type: DEPENDENT
          key: tidb.execute_error.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'The number of error occurred when executing SQL statements per second (such as syntax errors and primary key conflicts).'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_server_execute_error_total")].value.sum()'
              error_handler: DISCARD_VALUE
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: sql
        -
          uuid: 954f5e433a7c44128d7772b87d493270
          name: 'TiDB: Get instance metrics'
          type: HTTP_AGENT
          key: tidb.get_metrics
          history: '0'
          trends: '0'
          value_type: TEXT
          description: 'Get TiDB instance metrics.'
          preprocessing:
            -
              type: CHECK_NOT_SUPPORTED
              parameters:
                - ''
            -
              type: PROMETHEUS_TO_JSON
              parameters:
                - ''
          url: '{$TIDB.URL}:{$TIDB.PORT}/metrics'
          tags:
            -
              tag: component
              value: raw
        -
          uuid: e95ebe1050b8404f8274e243203fdecc
          name: 'TiDB: Get instance status'
          type: HTTP_AGENT
          key: tidb.get_status
          history: '0'
          trends: '0'
          value_type: TEXT
          description: 'Get TiDB instance status info.'
          preprocessing:
            -
              type: CHECK_NOT_SUPPORTED
              parameters:
                - ''
              error_handler: CUSTOM_VALUE
              error_handler_params: '{"status": "0"}'
          url: '{$TIDB.URL}:{$TIDB.PORT}/status'
          tags:
            -
              tag: component
              value: health
            -
              tag: component
              value: raw
        -
          uuid: 14cf8296365048a59fd42f03966b1e1e
          name: 'TiDB: Goroutine count'
          type: DEPENDENT
          key: tidb.goroutines
          delay: '0'
          history: 7d
          description: 'The number of Goroutines on TiDB instance.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="go_goroutines")].value.first()'
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: goroutines
        -
          uuid: 78e60bd44e3e4a4a859705c94ef94420
          name: 'TiDB: Heap memory usage'
          type: DEPENDENT
          key: tidb.heap_bytes
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: B
          description: 'Number of heap bytes that are in use.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="go_memstats_heap_inuse_bytes")].value.first()'
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: memory
          triggers:
            -
              uuid: 575a4821ed8c4a1881b7f9bd264b1929
              expression: 'min(/TiDB by HTTP/tidb.heap_bytes,5m)>{$TIDB.HEAP.USAGE.MAX.WARN}'
              name: 'TiDB: Heap memory usage is too high'
              event_name: 'TiDB: Heap memory usage is too high (over {$TIDB.HEAP.USAGE.MAX.WARN} for 5m)'
              priority: WARNING
              tags:
                -
                  tag: scope
                  value: capacity
        -
          uuid: 104c09cb47f640fb804c136a09aa3bd2
          name: 'TiDB: Keep alive, rate'
          type: DEPENDENT
          key: tidb.monitor_keep_alive.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Ops
          description: 'The number of times that the metrics are refreshed on TiDB instance per minute.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_monitor_keep_alive_total")].value.first()'
              error_handler: DISCARD_VALUE
            -
              type: SIMPLE_CHANGE
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: health
          triggers:
            -
              uuid: eb3c09904fa843d78401b00eff4f6a08
              expression: 'max(/TiDB by HTTP/tidb.monitor_keep_alive.rate,5m)<{$TIDB.MONITOR_KEEP_ALIVE.MAX.WARN}'
              name: 'TiDB: Too few keep alive operations'
              event_name: 'TiDB: Too few keep alive operations (less {$TIDB.MONITOR_KEEP_ALIVE.MAX.WARN} for 5m)'
              priority: AVERAGE
              description: 'Indicates whether the TiDB process still exists. If the number of times for tidb_monitor_keep_alive_total increases less than 10 per minute, the TiDB process might already exit and an alert is triggered.'
              tags:
                -
                  tag: scope
                  value: availability
        -
          uuid: d3ef55b9fd8b4a2aa1cbbc48f15203cb
          name: 'TiDB: Time jump back, rate'
          type: DEPENDENT
          key: tidb.monitor_time_jump_back.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Ops
          description: 'The number of times that the operating system rewinds every second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_monitor_time_jump_back_total")].value.first()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: application
          triggers:
            -
              uuid: c3c1f6eab224453b92534d5393aca2b7
              expression: 'min(/TiDB by HTTP/tidb.monitor_time_jump_back.rate,5m)>{$TIDB.TIME_JUMP_BACK.MAX.WARN}'
              name: 'TiDB: Too many time jump backs'
              event_name: 'TiDB: Too many time jump backs (over {$TIDB.TIME_JUMP_BACK.MAX.WARN} for 5m)'
              priority: WARNING
              tags:
                -
                  tag: scope
                  value: performance
        -
          uuid: dce76be0ccbe44969bb09ad29d599790
          name: 'TiDB: PD TSO commands, rate'
          type: DEPENDENT
          key: tidb.pd_tso_cmd.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Ops
          description: 'The number of TSO commands that TiDB obtains from PD per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="pd_client_cmd_handle_cmds_duration_seconds_count" && @.labels.type == "tso")].value.first()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: pd-commands
        -
          uuid: 2bde50849f5541c3ac8aa5b26f5b8b52
          name: 'TiDB: PD TSO requests, rate'
          type: DEPENDENT
          key: tidb.pd_tso_request.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Ops
          description: 'The number of TSO requests that TiDB obtains from PD per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="pd_client_request_handle_requests_duration_seconds_count" && @.labels.type == "tso")].value.first()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: pd-commands
        -
          uuid: ad8764623b8e46238efc0a94f0766a5b
          name: 'TiDB: Open file descriptors, max'
          type: DEPENDENT
          key: tidb.process_max_fds
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Maximum number of open file descriptors.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="process_max_fds")].value.first()'
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: fds
        -
          uuid: 04b3d6bf810c449db1e4b79be6b263a9
          name: 'TiDB: Open file descriptors'
          type: DEPENDENT
          key: tidb.process_open_fds
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Number of open file descriptors.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="process_open_fds")].value.first()'
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: fds
        -
          uuid: fbee374d0fda4679a693ccccc26e5713
          name: 'TiDB: RSS memory usage'
          type: DEPENDENT
          key: tidb.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: tidb.get_metrics
          tags:
            -
              tag: component
              value: memory
        -
          uuid: 651140aae7334994a31d24568c08a9ab
          name: 'TiDB: Total "error" server query, rate'
          type: DEPENDENT
          key: tidb.server_query.error.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Qps
          description: 'The number of queries on TiDB instance per second with failure of command execution results.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tidb_server_query_total" && @.labels.result == "Error")].value.sum()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: queries
        -
          uuid: 00374eab11a14ab1b4e636996519ab80
          name: 'TiDB: Total "ok" server query, rate'
          type: DEPENDENT
          key: tidb.server_query.ok.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Qps
          description: 'The number of queries on TiDB instance per second with success of command execution results.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tidb_server_query_total" && @.labels.result == "OK")].value.sum()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: queries
        -
          uuid: 938e7bb83c714e198db55f3bb009daaf
          name: 'TiDB: Total server query, rate'
          type: DEPENDENT
          key: tidb.server_query.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Qps
          description: 'The number of queries per second on TiDB instance.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name == "tidb_server_query_total")].value.sum()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: queries
        -
          uuid: 84824ff459b74679b33e34a1f1e8cc69
          name: 'TiDB: Schema lease "change" errors, rate'
          type: DEPENDENT
          key: tidb.session_schema_lease_error.change.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: |
            The number of schema lease errors per second.
            "change" means that the schema has changed
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_session_schema_lease_error_total && @.labels.type == "change"")].value.first()'
              error_handler: DISCARD_VALUE
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: sessions
        -
          uuid: fe35df7cc7de4b0b8d616b042da99d69
          name: 'TiDB: Schema lease "outdate" errors , rate'
          type: DEPENDENT
          key: tidb.session_schema_lease_error.outdate.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: |
            The number of schema lease errors per second.
            "outdate" errors means that the schema cannot be updated, which is a more serious error and triggers an alert.
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_session_schema_lease_error_total && @.labels.type == "outdate"")].value.first()'
              error_handler: DISCARD_VALUE
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: sessions
          triggers:
            -
              uuid: b077eb1afe6a4da79707987324fb40c8
              expression: 'min(/TiDB by HTTP/tidb.session_schema_lease_error.outdate.rate,5m)>{$TIDB.SCHEMA_LEASE_ERRORS.MAX.WARN}'
              name: 'TiDB: Too many schema lease errors'
              event_name: 'TiDB: Too many schema lease errors (over {$TIDB.SCHEMA_LEASE_ERRORS.MAX.WARN} for 5m)'
              priority: AVERAGE
              description: 'The latest schema information is not reloaded in TiDB within one lease.'
              tags:
                -
                  tag: scope
                  value: availability
        -
          uuid: fe8cf5e5c7704db797e76fd9d64e6d17
          name: 'TiDB: SQL statements, rate'
          type: DEPENDENT
          key: tidb.statement_total.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'The total number of SQL statements executed per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_executor_statement_total")].value.sum()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: sql
        -
          uuid: ed86585a496b4b438c521c4765d76b11
          name: 'TiDB: Status'
          type: DEPENDENT
          key: tidb.status
          delay: '0'
          history: 7d
          trends: '0'
          value_type: CHAR
          description: 'Status of PD instance.'
          valuemap:
            name: 'Service state'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.status
              error_handler: CUSTOM_VALUE
              error_handler_params: '1'
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: tidb.get_status
          tags:
            -
              tag: component
              value: health
          triggers:
            -
              uuid: 82a638ac4a3f4b349ee7bb0d53bc1f29
              expression: 'last(/TiDB by HTTP/tidb.status)=0'
              name: 'TiDB: Instance is not responding'
              priority: AVERAGE
              tags:
                -
                  tag: scope
                  value: availability
        -
          uuid: b5db09e71f2341b8ac1b9e48cbdefc82
          name: 'TiDB: Server connections'
          type: DEPENDENT
          key: tidb.tidb_server_connections
          delay: '0'
          history: 7d
          description: 'The connection number of current TiDB instance.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_server_connections")].value.first()'
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: connections
        -
          uuid: 73992d4be61e443eafcc03aaa1bbf4a5
          name: 'TiDB: Server critical error, rate'
          type: DEPENDENT
          key: tidb.tidb_server_critical_error_total.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'The number of critical errors occurred in TiDB per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_server_critical_error_total")].value.first()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: server
        -
          uuid: f1e2436ced3c456a85650e0622715777
          name: 'TiDB: Server panic, rate'
          type: DEPENDENT
          key: tidb.tidb_server_panic_total.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'The number of panics occurred in TiDB per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_server_panic_total")].value.first()'
              error_handler: DISCARD_VALUE
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: server
          triggers:
            -
              uuid: c457465731c947eab7b477186d8ba876
              expression: 'last(/TiDB by HTTP/tidb.tidb_server_panic_total.rate)>0'
              name: 'TiDB: There are panicked TiDB threads'
              priority: AVERAGE
              description: 'When a panic occurs, an alert is triggered. The thread is often recovered, otherwise, TiDB will frequently restart.'
              tags:
                -
                  tag: scope
                  value: availability
        -
          uuid: 8a63b326356f4fdbb9cb6e73437348be
          name: 'TiDB: KV backoff, rate'
          type: DEPENDENT
          key: tidb.tikvclient_backoff.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Ops
          description: 'The number of errors returned by TiKV.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_tikvclient_backoff_total")].value.sum()'
              error_handler: DISCARD_VALUE
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: tikv-commands
        -
          uuid: aef7cdfd07f1420c970f20c821fed8dd
          name: 'TiDB: Lock resolves, rate'
          type: DEPENDENT
          key: tidb.tikvclient_lock_resolver_action.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Ops
          description: 'The number of DDL tasks that are waiting.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_tikvclient_lock_resolver_actions_total")].value.sum()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: tikv-commands
        -
          uuid: c116313e63fa45d89bf44772cc9cb3b8
          name: 'TiDB: TiClient region errors, rate'
          type: DEPENDENT
          key: tidb.tikvclient_region_err.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Ops
          description: 'The number of region related errors returned by TiKV per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_tikvclient_region_err_total")].value.sum()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: regions
          triggers:
            -
              uuid: d3cb81c46e414ff2a7e411a877b899ef
              expression: 'min(/TiDB by HTTP/tidb.tikvclient_region_err.rate,5m)>{$TIDB.REGION_ERROR.MAX.WARN}'
              name: 'TiDB: Too many region related errors'
              event_name: 'TiDB: Too many region related errors (over {$TIDB.REGION_ERROR.MAX.WARN} for 5m)'
              priority: AVERAGE
              tags:
                -
                  tag: scope
                  value: performance
        -
          uuid: 8ddf164df8c9404ba9f7c0f87db3bc2f
          name: 'TiDB: KV commands, rate'
          type: DEPENDENT
          key: tidb.tikvclient_txn.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Ops
          description: 'The number of executed KV commands per second.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_tikvclient_txn_cmd_duration_seconds_count")].value.sum()'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: tidb.get_metrics
          tags:
            -
              tag: component
              value: tikv-commands
        -
          uuid: 20c0fffd66c84a16bb4d8f7882c896bc
          name: 'TiDB: Uptime'
          type: DEPENDENT
          key: tidb.uptime
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: uptime
          description: 'The runtime of each TiDB 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: tidb.get_metrics
          tags:
            -
              tag: component
              value: application
          triggers:
            -
              uuid: 91adc4c6b9364693891faf58c8cced75
              expression: 'last(/TiDB by HTTP/tidb.uptime)<10m'
              name: 'TiDB: has been restarted'
              event_name: 'TiDB: has been restarted (uptime < 10m)'
              priority: INFO
              description: 'Uptime is less than 10 minutes.'
              manual_close: 'YES'
              tags:
                -
                  tag: scope
                  value: notice
        -
          uuid: 65fa2b077073467387b39bef035b0644
          name: 'TiDB: Version'
          type: DEPENDENT
          key: tidb.version
          delay: '0'
          history: 7d
          trends: '0'
          value_type: CHAR
          description: 'Version of the TiDB instance.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.version
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: tidb.get_status
          tags:
            -
              tag: component
              value: application
          triggers:
            -
              uuid: 5f863fc0944848fdad145f42c94dbea3
              expression: 'last(/TiDB by HTTP/tidb.version,#1)<>last(/TiDB by HTTP/tidb.version,#2) and length(last(/TiDB by HTTP/tidb.version))>0'
              name: 'TiDB: Version has changed'
              event_name: 'TiDB: Version has changed (new version: {ITEM.VALUE})'
              priority: INFO
              description: 'TiDB version has changed. Ack to close.'
              manual_close: 'YES'
              tags:
                -
                  tag: scope
                  value: notice
      discovery_rules:
        -
          uuid: 4db735b652eb451d911f6dc01de6b1ba
          name: 'KV metrics discovery'
          type: DEPENDENT
          key: tidb.kv_ops.discovery
          delay: '0'
          description: 'Discovery KV specific metrics.'
          item_prototypes:
            -
              uuid: 79b0a13b25c745d288c313c4197f2e5c
              name: 'TiDB: KV Commands: {#TYPE}, rate'
              type: DEPENDENT
              key: 'tidb.tikvclient_txn.rate[{#TYPE}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: Ops
              description: 'The number of executed KV commands per second.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name=="tidb_tikvclient_txn_cmd_duration_seconds_count" && @.labels.type == "{#TYPE}")].value.first()'
                -
                  type: CHANGE_PER_SECOND
                  parameters:
                    - ''
              master_item:
                key: tidb.get_metrics
              tags:
                -
                  tag: component
                  value: tikv-commands
                -
                  tag: type
                  value: '{#TYPE}'
          master_item:
            key: tidb.get_metrics
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_tikvclient_txn_cmd_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: bcaf700328b94b59b35cf5bfaf27d5ac
          name: 'QPS metrics discovery'
          type: DEPENDENT
          key: tidb.qps.discovery
          delay: '0'
          description: 'Discovery QPS specific metrics.'
          item_prototypes:
            -
              uuid: 3b450f5a853247358a8fe6f31f000575
              name: 'TiDB: Server query "Error": {#TYPE}, rate'
              type: DEPENDENT
              key: 'tidb.server_query.error.rate[{#TYPE}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: Qps
              description: 'The number of queries on TiDB instance per second with failure of command execution results.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name == "tidb_server_query_total" && @.labels.result == "Error" && @.labels.type == "{#TYPE}")].value.first()'
                -
                  type: CHANGE_PER_SECOND
                  parameters:
                    - ''
              master_item:
                key: tidb.get_metrics
              tags:
                -
                  tag: component
                  value: queries
                -
                  tag: type
                  value: '{#TYPE}'
            -
              uuid: 125bdd3eb1b643f4ad00d58fbed455f6
              name: 'TiDB: Server query "OK": {#TYPE}, rate'
              type: DEPENDENT
              key: 'tidb.server_query.ok.rate[{#TYPE}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: Qps
              description: 'The number of queries on TiDB instance per second with success of command execution results.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name == "tidb_server_query_total" && @.labels.result == "OK" && @.labels.type == "{#TYPE}")].value.first()'
                -
                  type: CHANGE_PER_SECOND
                  parameters:
                    - ''
              master_item:
                key: tidb.get_metrics
              tags:
                -
                  tag: component
                  value: queries
                -
                  tag: type
                  value: '{#TYPE}'
          master_item:
            key: tidb.get_metrics
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_server_query_total")]'
            -
              type: JAVASCRIPT
              parameters:
                - |
                  var lookup = {},
                      result = [];
                  
                  JSON.parse(value).forEach(function (item) {
                      var type = item.labels.type;
                      if (!(lookup[type])) {
                          lookup[type] = 1;
                          result.push({ "{#TYPE}": type });
                      }
                  })
                  
                  return JSON.stringify(result);
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
        -
          uuid: e3c23b94a9514389b37e3911f79db8f8
          name: 'Statement metrics discovery'
          type: DEPENDENT
          key: tidb.statement.discover
          delay: '0'
          description: 'Discovery statement specific metrics.'
          item_prototypes:
            -
              uuid: 111ffa26edd247eb9325f5ab5f5f3f94
              name: 'TiDB: SQL statements: {#TYPE}, rate'
              type: DEPENDENT
              key: 'tidb.statement.rate[{#TYPE}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              description: 'The number of SQL statements executed per second.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name=="tidb_executor_statement_total" && @.labels.type == "{#TYPE}")].value.first()'
                -
                  type: CHANGE_PER_SECOND
                  parameters:
                    - ''
              master_item:
                key: tidb.get_metrics
              tags:
                -
                  tag: component
                  value: sql
                -
                  tag: type
                  value: '{#TYPE}'
          master_item:
            key: tidb.get_metrics
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_executor_statement_total")]'
            -
              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: f9af6d56e612459583a1f5d3b4a7d61b
          name: 'KV backoff discovery'
          type: DEPENDENT
          key: tidb.tikvclient_backoff.discovery
          delay: '0'
          description: 'Discovery KV backoff specific metrics.'
          item_prototypes:
            -
              uuid: a11cf69675654e7ca70dbab255509bb8
              name: 'TiDB: KV backoff: {#TYPE}, rate'
              type: DEPENDENT
              key: 'tidb.tikvclient_backoff.rate[{#TYPE}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: Ops
              description: 'The number of TiDB operations that resolve locks per second. When TiDB''s read or write request encounters a lock, it tries to resolve the lock.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name=="tidb_tikvclient_backoff_total" && @.labels.type == "{#TYPE}")].value.first()'
                -
                  type: CHANGE_PER_SECOND
                  parameters:
                    - ''
              master_item:
                key: tidb.get_metrics
              tags:
                -
                  tag: component
                  value: tikv-backoff
                -
                  tag: type
                  value: '{#TYPE}'
          master_item:
            key: tidb.get_metrics
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_tikvclient_backoff_total")]'
              error_handler: DISCARD_VALUE
            -
              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: 72d1f090ce9c4f89b06e4195989e4b2b
          name: 'GC action results discovery'
          type: DEPENDENT
          key: tidb.tikvclient_gc_action.discovery
          delay: '0'
          description: 'Discovery GC action results metrics.'
          item_prototypes:
            -
              uuid: e3c19674dcdf4fdea1f8cd82e3df9f72
              name: 'TiDB: GC action result: {#TYPE}, rate'
              type: DEPENDENT
              key: 'tidb.tikvclient_gc_action.rate[{#TYPE}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: Ops
              description: 'The number of results of GC-related operations per second.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name=="tidb_tikvclient_gc_action_result" && @.labels.type == "{#TYPE}")].value.first()'
                -
                  type: CHANGE_PER_SECOND
                  parameters:
                    - ''
              master_item:
                key: tidb.get_metrics
              tags:
                -
                  tag: component
                  value: gc
                -
                  tag: type
                  value: '{#TYPE}'
              trigger_prototypes:
                -
                  uuid: 2d24956d0a4f459fad155590376696c1
                  expression: 'min(/TiDB by HTTP/tidb.tikvclient_gc_action.rate[{#TYPE}],5m)>{$TIDB.GC_ACTIONS.ERRORS.MAX.WARN}'
                  name: 'TiDB: Too many failed GC-related operations'
                  event_name: 'TiDB: Too many failed GC-related operations (over {$TIDB.GC_ACTIONS.ERRORS.MAX.WARN} in 5m)'
                  discover: NO_DISCOVER
                  priority: WARNING
                  tags:
                    -
                      tag: scope
                      value: performance
          master_item:
            key: tidb.get_metrics
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_tikvclient_gc_action_result")]'
              error_handler: DISCARD_VALUE
            -
              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
          overrides:
            -
              name: 'Failed GC-related operations trigger'
              step: '1'
              filter:
                conditions:
                  -
                    macro: '{#TYPE}'
                    value: failed
                    formulaid: A
              operations:
                -
                  operationobject: TRIGGER_PROTOTYPE
                  operator: LIKE
                  value: 'Too many failed GC-related operations'
                  status: ENABLED
                  discover: DISCOVER
        -
          uuid: a4f2e1902cc54f0db9e9c345c63285e2
          name: 'Lock resolves discovery'
          type: DEPENDENT
          key: tidb.tikvclient_lock_resolver_action.discovery
          delay: '0'
          description: 'Discovery lock resolves specific metrics.'
          item_prototypes:
            -
              uuid: 2eebf2ccc44a4cadb0b70e153b70b3a2
              name: 'TiDB: Lock resolves: {#TYPE}, rate'
              type: DEPENDENT
              key: 'tidb.tikvclient_lock_resolver_action.rate[{#TYPE}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: Ops
              description: 'The number of TiDB operations that resolve locks per second. When TiDB''s read or write request encounters a lock, it tries to resolve the lock.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name=="tidb_tikvclient_lock_resolver_actions_total" && @.labels.type == "{#TYPE}")].value.first()'
                -
                  type: CHANGE_PER_SECOND
                  parameters:
                    - ''
              master_item:
                key: tidb.get_metrics
              tags:
                -
                  tag: component
                  value: locks
                -
                  tag: type
                  value: '{#TYPE}'
          master_item:
            key: tidb.get_metrics
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.name=="tidb_tikvclient_lock_resolver_actions_total")]'
            -
              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
      tags:
        -
          tag: class
          value: database
        -
          tag: target
          value: tidb
      macros:
        -
          macro: '{$TIDB.DDL.WAITING.MAX.WARN}'
          value: '5'
          description: 'Maximum number of DDL tasks that are waiting'
        -
          macro: '{$TIDB.GC_ACTIONS.ERRORS.MAX.WARN}'
          value: '1'
          description: 'Maximum number of GC-related operations failures'
        -
          macro: '{$TIDB.HEAP.USAGE.MAX.WARN}'
          value: 10G
          description: 'Maximum heap memory used'
        -
          macro: '{$TIDB.MONITOR_KEEP_ALIVE.MAX.WARN}'
          value: '10'
          description: 'Minimum number of keep alive operations'
        -
          macro: '{$TIDB.OPEN.FDS.MAX.WARN}'
          value: '90'
          description: 'Maximum percentage of used file descriptors'
        -
          macro: '{$TIDB.PORT}'
          value: '10080'
          description: 'The port of TiDB server metrics web endpoint'
        -
          macro: '{$TIDB.REGION_ERROR.MAX.WARN}'
          value: '50'
          description: 'Maximum number of region related errors'
        -
          macro: '{$TIDB.SCHEMA_LEASE_ERRORS.MAX.WARN}'
          value: '0'
          description: 'Maximum number of schema lease errors'
        -
          macro: '{$TIDB.SCHEMA_LOAD_ERRORS.MAX.WARN}'
          value: '1'
          description: 'Maximum number of load schema errors'
        -
          macro: '{$TIDB.TIME_JUMP_BACK.MAX.WARN}'
          value: '1'
          description: 'Maximum number of times that the operating system rewinds every second'
        -
          macro: '{$TIDB.URL}'
          value: localhost
          description: 'TiDB server URL'
      valuemaps:
        -
          uuid: 047f0303f1bc424a959f5d0ceaab77c7
          name: 'Service state'
          mappings:
            -
              value: '0'
              newvalue: Down
            -
              value: '1'
              newvalue: Up
  triggers:
    -
      uuid: cfd6ba0dbf294b9e9ab6afc7d44be7b3
      expression: 'min(/TiDB by HTTP/tidb.process_open_fds,5m)/last(/TiDB by HTTP/tidb.process_max_fds)*100>{$TIDB.OPEN.FDS.MAX.WARN}'
      name: 'TiDB: Current number of open files is too high'
      event_name: 'TiDB: Current number of open files is too high (over {$TIDB.OPEN.FDS.MAX.WARN}% for 5m)'
      priority: WARNING
      description: 'Heavy file descriptor usage (i.e., near the process''s file descriptor limit) indicates a potential file descriptor exhaustion issue.'
      tags:
        -
          tag: scope
          value: capacity
  graphs:
    -
      uuid: ee25671d0b5446348341be56967a74b2
      name: 'TiDB: File descriptors'
      graph_items:
        -
          drawtype: GRADIENT_LINE
          color: 1A7C11
          item:
            host: 'TiDB by HTTP'
            key: tidb.process_open_fds
        -
          sortorder: '1'
          drawtype: BOLD_LINE
          color: 2774A4
          item:
            host: 'TiDB by HTTP'
            key: tidb.process_max_fds
    -
      uuid: fb29a5ea3a62416f8eeee804a6f83c46
      name: 'TiDB: Memory usage'
      graph_items:
        -
          color: 1A7C11
          item:
            host: 'TiDB by HTTP'
            key: tidb.heap_bytes
        -
          sortorder: '1'
          color: 2774A4
          item:
            host: 'TiDB by HTTP'
            key: tidb.rss_bytes
    -
      uuid: 5ab746ad86ef4710948263d4d6157742
      name: 'TiDB: Server query rate'
      graph_items:
        -
          color: 1A7C11
          item:
            host: 'TiDB by HTTP'
            key: tidb.server_query.rate
        -
          sortorder: '1'
          color: 2774A4
          item:
            host: 'TiDB by HTTP'
            key: tidb.server_query.ok.rate
        -
          sortorder: '2'
          color: F63100
          item:
            host: 'TiDB by HTTP'
            key: tidb.server_query.error.rate