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

template_db_clickhouse_http.yaml « clickhouse_http « db « templates - github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 95bfdd9146f6a1622942c17b95f75957a8b58c45 (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
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
zabbix_export:
  version: '6.2'
  date: '2022-04-06T19:54:13Z'
  groups:
    -
      uuid: 748ad4d098d447d492bb935c907f652f
      name: Templates/Databases
  templates:
    -
      uuid: 95f2053c21094ad4968440b562cc7ea2
      template: 'ClickHouse by HTTP'
      name: 'ClickHouse by HTTP'
      description: |
        Get node metrics from ClickHouse HTTP interface using HTTP agent.
        
        Template tooling version used: 0.41
      groups:
        -
          name: Templates/Databases
      items:
        -
          uuid: 595446e408b844519e8db1ea91543134
          name: 'ClickHouse: Current distribute connections'
          type: DEPENDENT
          key: clickhouse.connections.distribute
          delay: '0'
          history: 7d
          description: 'Number of connections to remote servers sending data that was INSERTed into Distributed tables.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "DistributedSend")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: connections
        -
          uuid: d2d72a607672442b957228f0bea8dcca
          name: 'ClickHouse: Current HTTP connections'
          type: DEPENDENT
          key: clickhouse.connections.http
          delay: '0'
          history: 7d
          description: 'Number of connections to HTTP server.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "HTTPConnection")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: connections
        -
          uuid: 0829591332244c75a219f3b811ebf9ce
          name: 'ClickHouse: Current Interserver connections'
          type: DEPENDENT
          key: clickhouse.connections.interserver
          delay: '0'
          history: 7d
          description: 'Number of connections from other replicas to fetch parts.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "InterserverConnection")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: connections
        -
          uuid: 88d4855d22604d79927d40c0d3b106c5
          name: 'ClickHouse: Current MySQL connections'
          type: DEPENDENT
          key: clickhouse.connections.mysql
          delay: '0'
          history: 7d
          description: 'Number of connections to MySQL server.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "MySQLConnection")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: connections
        -
          uuid: 11786fff830d4d79b914a22c5f85da7f
          name: 'ClickHouse: Current TCP connections'
          type: DEPENDENT
          key: clickhouse.connections.tcp
          delay: '0'
          history: 7d
          description: 'Number of connections to TCP server (clients with native interface).'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "TCPConnection")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: connections
        -
          uuid: 46d8ed7374274d71a06119f50463f26c
          name: 'ClickHouse: Get dictionaries info'
          type: HTTP_AGENT
          key: clickhouse.dictionaries
          history: '0'
          trends: '0'
          value_type: TEXT
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.data
          url: '{$CLICKHOUSE.SCHEME}://{HOST.CONN}:{$CLICKHOUSE.PORT}/'
          query_fields:
            -
              name: query
              value: 'SELECT * FROM system.dictionaries format JSON'
          headers:
            -
              name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            -
              name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            -
              tag: component
              value: dictionaries
            -
              tag: component
              value: raw
        -
          uuid: b7bbca72bbd14b20930e60c3c1cdcb8e
          name: 'ClickHouse: Current distributed files to insert'
          type: DEPENDENT
          key: clickhouse.distributed.files
          delay: '0'
          history: 7d
          description: 'Number of pending files to process for asynchronous insertion into Distributed tables. Number of files for every shard is summed.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "DistributedFilesToInsert")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: system
          triggers:
            -
              uuid: 4ecadb993aa74126a807df3af4b892ed
              expression: 'min(/ClickHouse by HTTP/clickhouse.distributed.files,5m)>{$CLICKHOUSE.DELAYED.FILES.DISTRIBUTED.COUNT.MAX.WARN}'
              name: 'ClickHouse: Too many distributed files to insert'
              event_name: 'ClickHouse: Too many distributed files to insert (over {$CLICKHOUSE.DELAYED.FILES.DISTRIBUTED.COUNT.MAX.WARN} for 5 min)'
              priority: WARNING
              description: |
                "Clickhouse servers and <remote_servers> in config.xml
                https://clickhouse.tech/docs/en/operations/table_engines/distributed/"
              manual_close: 'YES'
              tags:
                -
                  tag: scope
                  value: capacity
        -
          uuid: e056f8519dec4c8dace036bf993a6d47
          name: 'ClickHouse: Distributed connection fail with retry per second'
          type: DEPENDENT
          key: clickhouse.distributed.files.fail.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: '"Connection failures after all retries in replicated DB connection pool"'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "DistributedConnectionFailAtAll")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: clickhouse.system.events
          tags:
            -
              tag: component
              value: connections
        -
          uuid: 3859c5ee6f25419f9da7e7899c9a71af
          name: 'ClickHouse: Distributed connection fail with retry per second'
          type: DEPENDENT
          key: clickhouse.distributed.files.retry.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Connection retries in replicated DB connection pool'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "DistributedConnectionFailTry")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: clickhouse.system.events
          tags:
            -
              tag: component
              value: connections
        -
          uuid: 81130b88e0b04b9ea677a80b6fd6ce22
          name: 'ClickHouse: Delayed insert queries'
          type: DEPENDENT
          key: clickhouse.insert.delay
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: '"Number of INSERT queries that are throttled due to high number of active data parts for partition in a MergeTree table."'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "DelayedInserts")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: queries
          triggers:
            -
              uuid: 164dc9841cdd4b77a650792cf1bac701
              expression: 'min(/ClickHouse by HTTP/clickhouse.insert.delay,5m)>{$CLICKHOUSE.DELAYED.INSERTS.MAX.WARN}'
              name: 'ClickHouse: Too many throttled insert queries'
              event_name: 'ClickHouse: Too many throttled insert queries (over {$CLICKHOUSE.DELAYED.INSERTS.MAX.WARN) for 5 min)'
              priority: WARNING
              description: 'Clickhouse have INSERT queries that are throttled due to high number of active data parts for partition in a MergeTree, please decrease INSERT frequency'
              manual_close: 'YES'
              tags:
                -
                  tag: scope
                  value: performance
        -
          uuid: e2477dd38510489c8ea7509e9a37cb50
          name: 'ClickHouse: Inserted bytes per second'
          type: DEPENDENT
          key: clickhouse.inserted_bytes.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Bps
          description: 'The number of uncompressed bytes inserted in all tables.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.event == "InsertedBytes")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: clickhouse.system.events
          tags:
            -
              tag: component
              value: network
        -
          uuid: e09cfd7db8be48a485bda8c5f033d210
          name: 'ClickHouse: Inserted rows per second'
          type: DEPENDENT
          key: clickhouse.inserted_rows.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'The number of rows inserted in all tables.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.event == "InsertedRows")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: clickhouse.system.events
          tags:
            -
              tag: component
              value: system
        -
          uuid: 410f7ee66ee84e3eb27940312ddf23d2
          name: 'ClickHouse: New INSERT queries per second'
          type: DEPENDENT
          key: clickhouse.insert_query.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Number of INSERT queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.event == "InsertQuery")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: clickhouse.system.events
          tags:
            -
              tag: component
              value: queries
        -
          uuid: 04c970694a6f40c89e4d3b53f27b7530
          name: 'ClickHouse: Allocated bytes'
          type: DEPENDENT
          key: clickhouse.jemalloc.allocated
          delay: '0'
          history: 7d
          units: B
          description: '"Total number of bytes allocated by the application."'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "jemalloc.allocated")].value.first()'
          master_item:
            key: clickhouse.system.asynchronous_metrics
          tags:
            -
              tag: component
              value: memory
        -
          uuid: 7aa71031aec74fbb9a2ec126076705a2
          name: 'ClickHouse: Mapped memory'
          type: DEPENDENT
          key: clickhouse.jemalloc.mapped
          delay: '0'
          history: 7d
          units: B
          description: '"Total number of bytes in active extents mapped by the allocator."'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "jemalloc.mapped")].value.first()'
          master_item:
            key: clickhouse.system.asynchronous_metrics
          tags:
            -
              tag: component
              value: memory
        -
          uuid: 32cc450854e94c6a9adbdde3c76b94d7
          name: 'ClickHouse: Resident memory'
          type: DEPENDENT
          key: clickhouse.jemalloc.resident
          delay: '0'
          history: 7d
          units: B
          description: |
            Maximum number of bytes in physically resident data pages mapped by the allocator,
            comprising all pages dedicated to allocator metadata, pages backing active allocations,
            and unused dirty pages.
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "jemalloc.resident")].value.first()'
          master_item:
            key: clickhouse.system.asynchronous_metrics
          tags:
            -
              tag: component
              value: memory
        -
          uuid: c99265c296f14189aaf65bf68b7d5037
          name: 'ClickHouse: Max count of parts per partition across all tables'
          type: DEPENDENT
          key: clickhouse.max.part.count.for.partition
          delay: '0'
          history: 7d
          description: |
            Clickhouse MergeTree table engine split each INSERT query to partitions (PARTITION BY expression) and add one or more PARTS per INSERT inside each partition,
            after that background merge process run.
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "MaxPartCountForPartition")].value.first()'
          master_item:
            key: clickhouse.system.asynchronous_metrics
          tags:
            -
              tag: component
              value: system
          triggers:
            -
              uuid: 21e6d3c6047145c59cbd00032699ee99
              expression: 'min(/ClickHouse by HTTP/clickhouse.max.part.count.for.partition,5m)>{$CLICKHOUSE.PARTS.PER.PARTITION.WARN} * 0.9'
              name: 'ClickHouse: Too many MergeTree parts'
              event_name: 'ClickHouse: Too many MergeTree parts (over 90% of {$CLICKHOUSE.PARTS.PER.PARTITION.WARN})'
              priority: WARNING
              description: |
                Descease INSERT queries frequency.
                Clickhouse MergeTree table engine split each INSERT query to partitions (PARTITION BY expression)
                and add one or more PARTS per INSERT inside each partition,
                after that background merge process run, and when you have too much unmerged parts inside partition,
                SELECT queries performance can significate degrade, so clickhouse try delay insert, or abort it.
              manual_close: 'YES'
              tags:
                -
                  tag: scope
                  value: performance
        -
          uuid: a4344162643142c9be3b09439b466a5d
          name: 'ClickHouse: Memory used for queries'
          type: DEPENDENT
          key: clickhouse.memory.tracking
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: B
          description: '"Total amount of memory (bytes) allocated in currently executing queries."'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "MemoryTracking")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: memory
        -
          uuid: 921670c46d9a4e5b85f2049d64298ab4
          name: 'ClickHouse: Memory used for background merges'
          type: DEPENDENT
          key: clickhouse.memory.tracking.background
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: B
          description: |
            "Total amount of memory (bytes) allocated in background processing pool (that is dedicated for background merges, mutations and fetches).
             Note that this value may include a drift when the memory was allocated in a context of background processing pool and freed in other context or vice-versa. This happens naturally due to caches for tables indexes and doesn't indicate memory leaks."
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "MemoryTrackingInBackgroundProcessingPool")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: memory
        -
          uuid: f881ea3cb2a2434d9cfac0d0896279f5
          name: 'ClickHouse: Memory used for background moves'
          type: DEPENDENT
          key: clickhouse.memory.tracking.background.moves
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: B
          description: |
            "Total amount of memory (bytes) allocated in background processing pool (that is dedicated for background moves). Note that this value may include a drift when the memory was allocated in a context of background processing pool and freed in other context or vice-versa.
             This happens naturally due to caches for tables indexes and doesn't indicate memory leaks."
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "MemoryTrackingInBackgroundMoveProcessingPool")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: memory
        -
          uuid: 3cd23448136c4ea8892483b1fbacec82
          name: 'ClickHouse: Memory used for merges'
          type: DEPENDENT
          key: clickhouse.memory.tracking.merges
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: B
          description: |
            Total amount of memory (bytes) allocated for background merges. Included in MemoryTrackingInBackgroundProcessingPool. Note that this value may include a drift when the memory was allocated in a context of background processing pool and freed in other context or vice-versa.
            This happens naturally due to caches for tables indexes and doesn't indicate memory leaks.
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "MemoryTrackingForMerges")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: memory
        -
          uuid: 1f4641ef040546e0afcccc818f4d3471
          name: 'ClickHouse: Memory used for background schedule pool'
          type: DEPENDENT
          key: clickhouse.memory.tracking.schedule.pool
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: B
          description: '"Total amount of memory (bytes) allocated in background schedule pool (that is dedicated for bookkeeping tasks of Replicated tables)."'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "MemoryTrackingInBackgroundSchedulePool")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: memory
        -
          uuid: 5e98b9c4f1ee42238f363d76354ef537
          name: 'ClickHouse: Current running merges'
          type: DEPENDENT
          key: clickhouse.merge.current
          delay: '0'
          history: 7d
          description: 'Number of executing background merges'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "Merge")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: queries
        -
          uuid: 50e33e8fc1904870bdc6d7f13d16943d
          name: 'ClickHouse: Uncompressed bytes merged per second'
          type: DEPENDENT
          key: clickhouse.merge_bytes.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Bps
          description: 'Uncompressed bytes that were read for background merges'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.event == "MergedUncompressedBytes")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: clickhouse.system.events
          tags:
            -
              tag: component
              value: system
        -
          uuid: a2afbf66601344bdb5ab72a7374bbe8b
          name: 'ClickHouse: Merged rows per second'
          type: DEPENDENT
          key: clickhouse.merge_rows.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Rows read for background merges.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.event == "MergedRows")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: clickhouse.system.events
          tags:
            -
              tag: component
              value: system
        -
          uuid: 83061f56dce24364906cae761419b148
          name: 'ClickHouse: Network errors per second'
          type: DEPENDENT
          key: clickhouse.network.error.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Network errors (timeouts and connection failures) during query execution, background pool tasks and DNS cache update.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.event == "NetworkErrors")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: clickhouse.system.events
          tags:
            -
              tag: component
              value: network
          triggers:
            -
              uuid: d49b9e8978bd416f81ea01b935879d81
              expression: 'min(/ClickHouse by HTTP/clickhouse.network.error.rate,5m)>{$CLICKHOUSE.NETWORK.ERRORS.MAX.WARN}'
              name: 'ClickHouse: Too many network errors'
              event_name: 'ClickHouse: Too many network errors (over {$CLICKHOUSE.NETWORK.ERRORS.MAX.WARN} in 5m)'
              priority: WARNING
              description: 'Number of errors (timeouts and connection failures) during query execution, background pool tasks and DNS cache update is too high.'
              tags:
                -
                  tag: scope
                  value: availability
        -
          uuid: cb40b0cf1296436d9a4e41062d1b3fa9
          name: 'ClickHouse: Ping'
          type: HTTP_AGENT
          key: clickhouse.ping
          history: 7d
          valuemap:
            name: 'Service state'
          preprocessing:
            -
              type: REGEX
              parameters:
                - Ok\.
                - '1'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 10m
          url: '{$CLICKHOUSE.SCHEME}://{HOST.CONN}:{$CLICKHOUSE.PORT}/ping'
          tags:
            -
              tag: component
              value: health
            -
              tag: component
              value: network
        -
          uuid: 4fb14efc757542c1b50605bdfb2e23cb
          name: 'ClickHouse: Longest currently running query time'
          type: HTTP_AGENT
          key: clickhouse.process.elapsed
          history: 7d
          value_type: FLOAT
          units: s
          description: 'Get longest running query.'
          url: '{$CLICKHOUSE.SCHEME}://{HOST.CONN}:{$CLICKHOUSE.PORT}/'
          query_fields:
            -
              name: query
              value: 'SELECT max(elapsed) FROM system.processes'
          headers:
            -
              name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            -
              name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            -
              tag: component
              value: queries
          triggers:
            -
              uuid: 2410e7b63c8340b6b08ec729d7093be6
              expression: 'last(/ClickHouse by HTTP/clickhouse.process.elapsed)>{$CLICKHOUSE.QUERY_TIME.MAX.WARN}'
              name: 'ClickHouse: There are queries running is long'
              event_name: 'ClickHouse: There are queries running more than {$CLICKHOUSE.QUERY_TIME.MAX.WARN} seconds'
              priority: AVERAGE
              manual_close: 'YES'
              tags:
                -
                  tag: scope
                  value: performance
        -
          uuid: 071ae233708b417b97cfeced5021c139
          name: 'ClickHouse: Current running queries'
          type: DEPENDENT
          key: clickhouse.query.current
          delay: '0'
          history: 7d
          description: 'Number of executing queries'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "Query")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: queries
        -
          uuid: 0fb342f6a494443c8389f79439e94791
          name: 'ClickHouse: New queries per second'
          type: DEPENDENT
          key: clickhouse.query.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Number of queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.data.event == "Query")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: clickhouse.system.events
          tags:
            -
              tag: component
              value: queries
        -
          uuid: fb671accbbaa4bd58a107dc3661419af
          name: 'ClickHouse: Read syscalls in fly'
          type: DEPENDENT
          key: clickhouse.read
          delay: '0'
          history: 7d
          description: 'Number of read (read, pread, io_getevents, etc.) syscalls in fly'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "Read")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: system
        -
          uuid: eb4c47501d9c4cdf9e55347ccc9a38bd
          name: 'ClickHouse: Read bytes per second'
          type: DEPENDENT
          key: clickhouse.read_bytes.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: Bps
          description: '"Number of bytes (the number of bytes before decompression) read from compressed sources (files, network)."'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.event == "ReadCompressedBytes")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: clickhouse.system.events
          tags:
            -
              tag: component
              value: network
        -
          uuid: 3793962be3494772832796c932947e1d
          name: 'ClickHouse: Get replicas info'
          type: HTTP_AGENT
          key: clickhouse.replicas
          history: '0'
          trends: '0'
          value_type: TEXT
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.data
          url: '{$CLICKHOUSE.SCHEME}://{HOST.CONN}:{$CLICKHOUSE.PORT}/'
          query_fields:
            -
              name: query
              value: 'SELECT database, table, is_readonly, is_session_expired, future_parts, parts_to_check, queue_size, inserts_in_queue, merges_in_queue, log_max_index, log_pointer, total_replicas, active_replicas, log_max_index - log_pointer as replica_lag FROM system.replicas format JSON'
          headers:
            -
              name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            -
              name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            -
              tag: component
              value: raw
            -
              tag: component
              value: replicas
        -
          uuid: 78ed9728eb634df1807c64637c862f9a
          name: 'ClickHouse: Replication lag across all tables'
          type: DEPENDENT
          key: clickhouse.replicas.max.absolute.delay
          delay: '0'
          history: 7d
          units: s
          description: 'Maximum replica queue delay relative to current time'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "ReplicasMaxAbsoluteDelay")].value.first()'
          master_item:
            key: clickhouse.system.asynchronous_metrics
          tags:
            -
              tag: component
              value: replication
          triggers:
            -
              uuid: fc47a407b15744e79b70088ec249951a
              expression: 'min(/ClickHouse by HTTP/clickhouse.replicas.max.absolute.delay,5m)>{$CLICKHOUSE.REPLICA.MAX.WARN}'
              name: 'ClickHouse: Replication lag is too high'
              event_name: 'ClickHouse: Replication lag is too high (over {$CLICKHOUSE.REPLICA.MAX.WARN} sec for 5min)'
              priority: WARNING
              description: |
                When replica have too much lag, it can be skipped from Distributed SELECT Queries without errors
                and you will have wrong query results.
              manual_close: 'YES'
              tags:
                -
                  tag: scope
                  value: performance
        -
          uuid: dd61675348374d2ea06cdde144fe4e26
          name: 'ClickHouse: Total number read-only Replicas'
          type: DEPENDENT
          key: clickhouse.replicas.readonly.total
          delay: '0'
          history: 7d
          description: |
            Number of Replicated tables that are currently in readonly state
            due to re-initialization after ZooKeeper session loss
            or due to startup without ZooKeeper configured.
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "ReadonlyReplica")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: replication
        -
          uuid: 5d2a35daf81a49888e3dfab916fab8be
          name: 'ClickHouse: Total replication tasks in queue'
          type: DEPENDENT
          key: clickhouse.replicas.sum.queue.size
          delay: '0'
          history: 7d
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "ReplicasSumQueueSize")].value.first()'
          master_item:
            key: clickhouse.system.asynchronous_metrics
          tags:
            -
              tag: component
              value: replication
        -
          uuid: 572036e5b2c74197bd61afc753f6e759
          name: 'ClickHouse: Revision'
          type: DEPENDENT
          key: clickhouse.revision
          delay: '0'
          history: 7d
          description: 'Revision of the server.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "Revision")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: application
        -
          uuid: f89f3e27ca4f4e109ae6fe6b74dcc2ca
          name: 'ClickHouse: New SELECT queries per second'
          type: DEPENDENT
          key: clickhouse.select_query.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Number of SELECT queries to be interpreted and potentially executed. Does not include queries that failed to parse or were rejected due to AST size limits, quota limits or limits on the number of simultaneously running queries. May include internal queries initiated by ClickHouse itself. Does not count subqueries.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.event == "SelectQuery")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: clickhouse.system.events
          tags:
            -
              tag: component
              value: queries
        -
          uuid: 6c84e0abd186467882d2d3842749f937
          name: 'ClickHouse: Get system.asynchronous_metrics'
          type: HTTP_AGENT
          key: clickhouse.system.asynchronous_metrics
          history: '0'
          trends: '0'
          value_type: TEXT
          description: 'Get metrics that are calculated periodically in the background'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.data
          url: '{$CLICKHOUSE.SCHEME}://{HOST.CONN}:{$CLICKHOUSE.PORT}/'
          query_fields:
            -
              name: query
              value: 'select metric, value from system.asynchronous_metrics format JSON'
          headers:
            -
              name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            -
              name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            -
              tag: component
              value: asynchronous-metrics
            -
              tag: component
              value: raw
        -
          uuid: 8aa612d27547446e9457aeaf6e94e320
          name: 'ClickHouse: Get system.events'
          type: HTTP_AGENT
          key: clickhouse.system.events
          history: '0'
          trends: '0'
          value_type: TEXT
          description: 'Get information about the number of events that have occurred in the system.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.data
          url: '{$CLICKHOUSE.SCHEME}://{HOST.CONN}:{$CLICKHOUSE.PORT}/'
          query_fields:
            -
              name: query
              value: 'select event, value from system.events format JSON'
          headers:
            -
              name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            -
              name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            -
              tag: component
              value: raw
            -
              tag: component
              value: system-events
        -
          uuid: 2193464b67724392905deef21f2f7c20
          name: 'ClickHouse: Get system.metrics'
          type: HTTP_AGENT
          key: clickhouse.system.metrics
          history: '0'
          trends: '0'
          value_type: TEXT
          description: 'Get metrics which can be calculated instantly, or have a current value format JSONEachRow'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.data
          url: '{$CLICKHOUSE.SCHEME}://{HOST.CONN}:{$CLICKHOUSE.PORT}/'
          query_fields:
            -
              name: query
              value: 'select metric, value from system.metrics format JSON'
          headers:
            -
              name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            -
              name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            -
              tag: component
              value: raw
            -
              tag: component
              value: system-metrics
        -
          uuid: 88c843c6d4fd43c794d1447109146312
          name: 'ClickHouse: Get system.settings'
          type: HTTP_AGENT
          key: clickhouse.system.settings
          history: '0'
          trends: '0'
          value_type: TEXT
          description: 'Get information about settings that are currently in use.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.data
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          url: '{$CLICKHOUSE.SCHEME}://{HOST.CONN}:{$CLICKHOUSE.PORT}/'
          query_fields:
            -
              name: query
              value: 'select name, value from system.settings format JSON'
          headers:
            -
              name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            -
              name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            -
              tag: component
              value: raw
            -
              tag: component
              value: system-settings
          triggers:
            -
              uuid: dfd9500636824ebf9d51d93650d62613
              expression: 'last(/ClickHouse by HTTP/clickhouse.system.settings,#1)<>last(/ClickHouse by HTTP/clickhouse.system.settings,#2) and length(last(/ClickHouse by HTTP/clickhouse.system.settings))>0'
              name: 'ClickHouse: Configuration has been changed'
              event_name: 'ClickHouse: Version has changed (new version: {ITEM.VALUE})'
              priority: INFO
              description: 'ClickHouse configuration has been changed. Ack to close.'
              manual_close: 'YES'
              tags:
                -
                  tag: scope
                  value: notice
        -
          uuid: 042f4b688cfe488fbd0e80f40f51ce78
          name: 'ClickHouse: Get tables info'
          type: HTTP_AGENT
          key: clickhouse.tables
          history: '0'
          trends: '0'
          value_type: TEXT
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.data
          url: '{$CLICKHOUSE.SCHEME}://{HOST.CONN}:{$CLICKHOUSE.PORT}/'
          query_fields:
            -
              name: query
              value: 'select database, table, sum(bytes) as bytes, count() as parts, sum(rows) as rows from system.parts where active = 1 group by database, table format JSON'
          headers:
            -
              name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            -
              name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            -
              tag: component
              value: raw
            -
              tag: component
              value: tables
        -
          uuid: 99b894b181b44a4f8ef10280b881b273
          name: 'ClickHouse: Uptime'
          type: DEPENDENT
          key: clickhouse.uptime
          delay: '0'
          history: 7d
          units: s
          description: 'Number of seconds since ClickHouse server start'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "Uptime")].value.first()'
          master_item:
            key: clickhouse.system.asynchronous_metrics
          tags:
            -
              tag: component
              value: application
          triggers:
            -
              uuid: 975cebc1b4324f83b5a8853fd666a179
              expression: 'nodata(/ClickHouse by HTTP/clickhouse.uptime,30m)=1'
              name: 'ClickHouse: Failed to fetch info data'
              event_name: 'ClickHouse: Failed to fetch info data (or no data for 30m)'
              priority: WARNING
              description: 'Zabbix has not received data for items for the last 30 minutes'
              manual_close: 'YES'
              dependencies:
                -
                  name: 'ClickHouse: Service is down'
                  expression: 'last(/ClickHouse by HTTP/clickhouse.ping)=0 or last(/ClickHouse by HTTP/net.tcp.service[{$CLICKHOUSE.SCHEME},"{HOST.CONN}","{$CLICKHOUSE.PORT}"]) = 0'
              tags:
                -
                  tag: scope
                  value: notice
            -
              uuid: e1316d3a83174cc49ab96ad90c46150b
              expression: 'last(/ClickHouse by HTTP/clickhouse.uptime)<10m'
              name: 'ClickHouse: has been restarted'
              event_name: 'ClickHouse: has been restarted (uptime < 10m)'
              priority: INFO
              description: 'Uptime is less than 10 minutes'
              manual_close: 'YES'
              tags:
                -
                  tag: scope
                  value: notice
        -
          uuid: d09b77c25dfd45249df05fc3f6d45b7b
          name: 'ClickHouse: Version'
          type: HTTP_AGENT
          key: clickhouse.version
          history: 7d
          trends: '0'
          value_type: CHAR
          description: 'Version of the server'
          preprocessing:
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1d
          url: '{$CLICKHOUSE.SCHEME}://{HOST.CONN}:{$CLICKHOUSE.PORT}/'
          query_fields:
            -
              name: query
              value: 'SELECT version()'
          headers:
            -
              name: X-ClickHouse-User
              value: '{$CLICKHOUSE.USER}'
            -
              name: X-ClickHouse-Key
              value: '{$CLICKHOUSE.PASSWORD}'
          tags:
            -
              tag: component
              value: application
          triggers:
            -
              uuid: 244dcf8dc8584e1686585160c261ef85
              expression: 'last(/ClickHouse by HTTP/clickhouse.version,#1)<>last(/ClickHouse by HTTP/clickhouse.version,#2) and length(last(/ClickHouse by HTTP/clickhouse.version))>0'
              name: 'ClickHouse: Version has changed'
              event_name: 'ClickHouse: Version has changed (new version: {ITEM.VALUE})'
              priority: INFO
              description: 'ClickHouse version has changed. Ack to close.'
              manual_close: 'YES'
              tags:
                -
                  tag: scope
                  value: notice
        -
          uuid: 5bac794c8c7e438c924cd16b708dc281
          name: 'ClickHouse: Write syscalls in fly'
          type: DEPENDENT
          key: clickhouse.write
          delay: '0'
          history: 7d
          description: 'Number of write (write, pwrite, io_getevents, etc.) syscalls in fly'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "Write")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: system
        -
          uuid: 381805a8145a48c2a1f2586996b66a94
          name: 'ClickHouse: ZooKeeper exceptions per second'
          type: DEPENDENT
          key: clickhouse.zookeper.exceptions.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Count of ZooKeeper exceptions that does not belong to user/hardware exceptions.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.event == "ZooKeeperOtherExceptions")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: clickhouse.system.events
          tags:
            -
              tag: component
              value: zookeper
        -
          uuid: f8e6a866d8c745d39ed124f19afe8041
          name: 'ClickHouse: ZooKeeper hardware exceptions per second'
          type: DEPENDENT
          key: clickhouse.zookeper.hw_exceptions.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Count of ZooKeeper exceptions caused by session moved/expired, connection loss, marshalling error, operation timed out and invalid zhandle state.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.event == "ZooKeeperHardwareExceptions")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: clickhouse.system.events
          tags:
            -
              tag: component
              value: zookeper
        -
          uuid: 071fb0471b8e40c3a5bb79c694cecce0
          name: 'ClickHouse: ZooKeeper requests'
          type: DEPENDENT
          key: clickhouse.zookeper.request
          delay: '0'
          history: 7d
          description: 'Number of requests to ZooKeeper in progress.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "ZooKeeperRequest")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: zookeper
        -
          uuid: 3e344ea728a54bc38b4098e7f6e2d087
          name: 'ClickHouse: ZooKeeper sessions'
          type: DEPENDENT
          key: clickhouse.zookeper.session
          delay: '0'
          history: 7d
          description: 'Number of sessions (connections) to ZooKeeper. Should be no more than one.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "ZooKeeperSession")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: zookeper
          triggers:
            -
              uuid: 655622aa6c5c48c8b38d5a519602ef05
              expression: 'min(/ClickHouse by HTTP/clickhouse.zookeper.session,5m)>1'
              name: 'ClickHouse: Too many ZooKeeper sessions opened'
              priority: WARNING
              description: |
                Number of sessions (connections) to ZooKeeper.
                Should be no more than one, because using more than one connection to ZooKeeper may lead to bugs due to lack of linearizability (stale reads) that ZooKeeper consistency model allows.
              tags:
                -
                  tag: scope
                  value: performance
        -
          uuid: 4931797c1034488fb9a2fc01e22b599c
          name: 'ClickHouse: ZooKeeper user exceptions per second'
          type: DEPENDENT
          key: clickhouse.zookeper.user_exceptions.rate
          delay: '0'
          history: 7d
          value_type: FLOAT
          description: 'Count of ZooKeeper exceptions caused by no znodes, bad version, node exists, node empty and no children for ephemeral.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.event == "ZooKeeperUserExceptions")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: clickhouse.system.events
          tags:
            -
              tag: component
              value: zookeper
        -
          uuid: b9fbc2f76b9c4de3b196ffc82ec10209
          name: 'ClickHouse: ZooKeeper wait time'
          type: DEPENDENT
          key: clickhouse.zookeper.wait.time
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: s
          description: 'Time spent in waiting for ZooKeeper operations.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.event == "ZooKeeperWaitMicroseconds")].value.first()'
              error_handler: CUSTOM_VALUE
              error_handler_params: '0'
            -
              type: MULTIPLIER
              parameters:
                - '0.000001'
            -
              type: CHANGE_PER_SECOND
              parameters:
                - ''
          master_item:
            key: clickhouse.system.events
          tags:
            -
              tag: component
              value: zookeper
        -
          uuid: 696aa071a9b24b29acbce2f1b5c49da3
          name: 'ClickHouse: ZooKeeper watches'
          type: DEPENDENT
          key: clickhouse.zookeper.watch
          delay: '0'
          history: 7d
          description: 'Number of watches (e.g., event subscriptions) in ZooKeeper.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$[?(@.metric == "ZooKeeperWatch")].value.first()'
          master_item:
            key: clickhouse.system.metrics
          tags:
            -
              tag: component
              value: zookeper
        -
          uuid: 68d1e19a6ec2401ba0dd509de7df2812
          name: 'ClickHouse: Check port availability'
          type: SIMPLE
          key: 'net.tcp.service[{$CLICKHOUSE.SCHEME},"{HOST.CONN}","{$CLICKHOUSE.PORT}"]'
          history: 7d
          valuemap:
            name: 'Service state'
          preprocessing:
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 10m
          tags:
            -
              tag: component
              value: health
            -
              tag: component
              value: network
          triggers:
            -
              uuid: 1d4b9842b66b4da9ab3750944b2fa050
              expression: 'last(/ClickHouse by HTTP/net.tcp.service[{$CLICKHOUSE.SCHEME},"{HOST.CONN}","{$CLICKHOUSE.PORT}"])=0'
              name: 'ClickHouse: Port {$CLICKHOUSE.PORT} is unavailable'
              priority: AVERAGE
              manual_close: 'YES'
              tags:
                -
                  tag: scope
                  value: availability
      discovery_rules:
        -
          uuid: add428c918e34dc9aeb58f946f16cbd2
          name: Dictionaries
          type: DEPENDENT
          key: clickhouse.dictionaries.discovery
          delay: '0'
          filter:
            evaltype: AND
            conditions:
              -
                macro: '{#NAME}'
                value: '{$CLICKHOUSE.LLD.FILTER.DICT.MATCHES}'
                formulaid: A
              -
                macro: '{#NAME}'
                value: '{$CLICKHOUSE.LLD.FILTER.DICT.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
                formulaid: B
          description: 'Info about dictionaries'
          item_prototypes:
            -
              uuid: 18cc050ff9c84d01ab61df1283fcce97
              name: 'ClickHouse: Dictionary {#NAME}: Bytes allocated'
              type: DEPENDENT
              key: 'clickhouse.dictionary.bytes_allocated["{#NAME}"]'
              delay: '0'
              history: 7d
              units: B
              description: 'The amount of RAM the dictionary uses.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name == "{#NAME}")].bytes_allocated.first()'
              master_item:
                key: clickhouse.dictionaries
              tags:
                -
                  tag: component
                  value: dictionaries
                -
                  tag: dictionary
                  value: '{#NAME}'
            -
              uuid: fa4efa26e3f64fc89c9d7dad39a610ca
              name: 'ClickHouse: Dictionary {#NAME}: Element count'
              type: DEPENDENT
              key: 'clickhouse.dictionary.element_count["{#NAME}"]'
              delay: '0'
              history: 7d
              description: 'Number of items stored in the dictionary.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name == "{#NAME}")].element_count.first()'
              master_item:
                key: clickhouse.dictionaries
              tags:
                -
                  tag: component
                  value: dictionaries
                -
                  tag: dictionary
                  value: '{#NAME}'
            -
              uuid: d9e333b7c1694ef482683679275dcd8d
              name: 'ClickHouse: Dictionary {#NAME}: Load factor'
              type: DEPENDENT
              key: 'clickhouse.dictionary.load_factor["{#NAME}"]'
              delay: '0'
              history: 7d
              units: '%'
              description: 'The percentage filled in the dictionary (for a hashed dictionary, the percentage filled in the hash table).'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.name == "{#NAME}")].bytes_allocated.first()'
                -
                  type: MULTIPLIER
                  parameters:
                    - '100'
              master_item:
                key: clickhouse.dictionaries
              tags:
                -
                  tag: component
                  value: dictionaries
                -
                  tag: dictionary
                  value: '{#NAME}'
          master_item:
            key: clickhouse.dictionaries
          lld_macro_paths:
            -
              lld_macro: '{#NAME}'
              path: $.name
        -
          uuid: ddb7c8c688264a5a8907fbdd6974d395
          name: Replicas
          type: DEPENDENT
          key: clickhouse.replicas.discovery
          delay: '0'
          filter:
            evaltype: AND
            conditions:
              -
                macro: '{#DB}'
                value: '{$CLICKHOUSE.LLD.FILTER.DB.MATCHES}'
                formulaid: A
              -
                macro: '{#DB}'
                value: '{$CLICKHOUSE.LLD.FILTER.DB.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
                formulaid: B
          description: 'Info about replicas'
          item_prototypes:
            -
              uuid: be577e21420244cb9d47c9fb9e23904a
              name: 'ClickHouse: {#DB}.{#TABLE}: Active replicas'
              type: DEPENDENT
              key: 'clickhouse.replica.active_replicas["{#DB}.{#TABLE}"]'
              delay: '0'
              history: 7d
              description: 'Number of replicas of this table that have a session in ZooKeeper (i.e., the number of functioning replicas). (Have a non-zero value only where there is an active session with ZooKeeper).'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].active_replicas.first()'
              master_item:
                key: clickhouse.replicas
              tags:
                -
                  tag: component
                  value: replication
                -
                  tag: database
                  value: '{#DB}'
                -
                  tag: table
                  value: '{#TABLE}'
            -
              uuid: 0a84f6788b3f447d958e031df0e2301c
              name: 'ClickHouse: {#DB}.{#TABLE}: Replica future parts'
              type: DEPENDENT
              key: 'clickhouse.replica.future_parts["{#DB}.{#TABLE}"]'
              delay: '0'
              history: 7d
              description: 'Number of data parts that will appear as the result of INSERTs or merges that haven''t been done yet.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].future_parts.first()'
              master_item:
                key: clickhouse.replicas
              tags:
                -
                  tag: component
                  value: replication
                -
                  tag: database
                  value: '{#DB}'
                -
                  tag: table
                  value: '{#TABLE}'
            -
              uuid: 6b49a71fcf244b8cb88e21423ac92ae2
              name: 'ClickHouse: {#DB}.{#TABLE}: Replica queue inserts size'
              type: DEPENDENT
              key: 'clickhouse.replica.inserts_in_queue["{#DB}.{#TABLE}"]'
              delay: '0'
              history: 7d
              description: 'Number of inserts of blocks of data that need to be made.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].inserts_in_queue.first()'
              master_item:
                key: clickhouse.replicas
              tags:
                -
                  tag: component
                  value: replication
                -
                  tag: database
                  value: '{#DB}'
                -
                  tag: table
                  value: '{#TABLE}'
            -
              uuid: 29977fdd52c64c4ca0b3565187365a0c
              name: 'ClickHouse: {#DB}.{#TABLE}: Replica readonly'
              type: DEPENDENT
              key: 'clickhouse.replica.is_readonly["{#DB}.{#TABLE}"]'
              delay: '0'
              history: 7d
              description: |
                Whether the replica is in read-only mode.
                This mode is turned on if the config doesn't have sections with ZooKeeper, if an unknown error occurred when re-initializing sessions in ZooKeeper, and during session re-initialization in ZooKeeper.
              valuemap:
                name: 'Replicas state'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].is_readonly.first()'
              master_item:
                key: clickhouse.replicas
              tags:
                -
                  tag: component
                  value: replication
                -
                  tag: database
                  value: '{#DB}'
                -
                  tag: table
                  value: '{#TABLE}'
              trigger_prototypes:
                -
                  uuid: 7cfd2342d3654407a941cb56fde5c6bf
                  expression: 'min(/ClickHouse by HTTP/clickhouse.replica.is_readonly["{#DB}.{#TABLE}"],5m)=1'
                  name: 'ClickHouse: {#DB}.{#TABLE} Replica is readonly'
                  priority: WARNING
                  description: 'This mode is turned on if the config doesn''t have sections with ZooKeeper, if an unknown error occurred when re-initializing sessions in ZooKeeper, and during session re-initialization in ZooKeeper.'
                  tags:
                    -
                      tag: scope
                      value: availability
            -
              uuid: a889475b8ddf48109af3dd2b7ed58627
              name: 'ClickHouse: {#DB}.{#TABLE}: Replica session expired'
              type: DEPENDENT
              key: 'clickhouse.replica.is_session_expired["{#DB}.{#TABLE}"]'
              delay: '0'
              history: 7d
              description: 'True if the ZooKeeper session expired'
              valuemap:
                name: 'Replicas state'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].is_session_expired.first()'
              master_item:
                key: clickhouse.replicas
              tags:
                -
                  tag: component
                  value: replication
                -
                  tag: database
                  value: '{#DB}'
                -
                  tag: table
                  value: '{#TABLE}'
              trigger_prototypes:
                -
                  uuid: 765475cc0be84ce1b85d1f026d08c326
                  expression: 'min(/ClickHouse by HTTP/clickhouse.replica.is_session_expired["{#DB}.{#TABLE}"],5m)=1'
                  name: 'ClickHouse: {#DB}.{#TABLE} Replica session is expired'
                  priority: WARNING
                  description: 'This mode is turned on if the config doesn''t have sections with ZooKeeper, if an unknown error occurred when re-initializing sessions in ZooKeeper, and during session re-initialization in ZooKeeper.'
                  tags:
                    -
                      tag: scope
                      value: performance
            -
              uuid: 8acd6e2195064708886d9944af264c32
              name: 'ClickHouse: {#DB}.{#TABLE}: Replica lag'
              type: DEPENDENT
              key: 'clickhouse.replica.lag["{#DB}.{#TABLE}"]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              description: 'Difference between log_max_index and log_pointer'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].replica_lag.first()'
              master_item:
                key: clickhouse.replicas
              tags:
                -
                  tag: component
                  value: replication
                -
                  tag: database
                  value: '{#DB}'
                -
                  tag: table
                  value: '{#TABLE}'
              trigger_prototypes:
                -
                  uuid: 0b06b448c0ad433c94c2a3788ca53e1a
                  expression: 'min(/ClickHouse by HTTP/clickhouse.replica.lag["{#DB}.{#TABLE}"],5m) > {$CLICKHOUSE.LOG_POSITION.DIFF.MAX.WARN}'
                  name: 'ClickHouse: {#DB}.{#TABLE}: Difference between log_max_index and log_pointer is too high'
                  event_name: 'ClickHouse: {#DB}.{#TABLE}: Difference between log_max_index and log_pointer is too high (More than {$CLICKHOUSE.LOG_POSITION.DIFF.MAX.WARN} for 5m)'
                  priority: WARNING
                  tags:
                    -
                      tag: scope
                      value: availability
            -
              uuid: 267603d761864e4cbf764558520ed83c
              name: 'ClickHouse: {#DB}.{#TABLE}: Replica log max index'
              type: DEPENDENT
              key: 'clickhouse.replica.log_max_index["{#DB}.{#TABLE}"]'
              delay: '0'
              history: 7d
              description: 'Maximum entry number in the log of general activity. (Have a non-zero value only where there is an active session with ZooKeeper).'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].log_max_index.first()'
              master_item:
                key: clickhouse.replicas
              tags:
                -
                  tag: component
                  value: replication
                -
                  tag: database
                  value: '{#DB}'
                -
                  tag: table
                  value: '{#TABLE}'
            -
              uuid: 93bf89b0befa4c238f2143c1841ef629
              name: 'ClickHouse: {#DB}.{#TABLE}: Replica log pointer'
              type: DEPENDENT
              key: 'clickhouse.replica.log_pointer["{#DB}.{#TABLE}"]'
              delay: '0'
              history: 7d
              description: 'Maximum entry number in the log of general activity that the replica copied to its execution queue, plus one. (Have a non-zero value only where there is an active session with ZooKeeper).'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].log_pointer.first()'
              master_item:
                key: clickhouse.replicas
              tags:
                -
                  tag: component
                  value: replication
                -
                  tag: database
                  value: '{#DB}'
                -
                  tag: table
                  value: '{#TABLE}'
            -
              uuid: 7b0da84f1e3f4705a209c6be025fc738
              name: 'ClickHouse: {#DB}.{#TABLE}: Replica queue merges size'
              type: DEPENDENT
              key: 'clickhouse.replica.merges_in_queue["{#DB}.{#TABLE}"]'
              delay: '0'
              history: 7d
              description: 'Number of merges waiting to be made.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].merges_in_queue.first()'
              master_item:
                key: clickhouse.replicas
              tags:
                -
                  tag: component
                  value: replication
                -
                  tag: database
                  value: '{#DB}'
                -
                  tag: table
                  value: '{#TABLE}'
            -
              uuid: 51a83465b90e4c82835030fec4f79b6f
              name: 'ClickHouse: {#DB}.{#TABLE}: Replica parts to check'
              type: DEPENDENT
              key: 'clickhouse.replica.parts_to_check["{#DB}.{#TABLE}"]'
              delay: '0'
              history: 7d
              description: 'Number of data parts in the queue for verification. A part is put in the verification queue if there is suspicion that it might be damaged.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].parts_to_check.first()'
              master_item:
                key: clickhouse.replicas
              tags:
                -
                  tag: component
                  value: replication
                -
                  tag: database
                  value: '{#DB}'
                -
                  tag: table
                  value: '{#TABLE}'
            -
              uuid: 52ef1c26f14842868424f0c5bf81b35b
              name: 'ClickHouse: {#DB}.{#TABLE}: Replica queue size'
              type: DEPENDENT
              key: 'clickhouse.replica.queue_size["{#DB}.{#TABLE}"]'
              delay: '0'
              history: 7d
              description: 'Size of the queue for operations waiting to be performed.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].queue_size.first()'
              master_item:
                key: clickhouse.replicas
              tags:
                -
                  tag: component
                  value: replication
                -
                  tag: database
                  value: '{#DB}'
                -
                  tag: table
                  value: '{#TABLE}'
              trigger_prototypes:
                -
                  uuid: 6fe0a15168db4abfa1cd2a2ee45d62ad
                  expression: 'min(/ClickHouse by HTTP/clickhouse.replica.queue_size["{#DB}.{#TABLE}"],5m)>{$CLICKHOUSE.QUEUE.SIZE.MAX.WARN:"{#TABLE}"}'
                  name: 'ClickHouse: {#DB}.{#TABLE}: Too many operations in queue'
                  event_name: 'ClickHouse: {#DB}.{#TABLE}: Too many operations in queue (over {$CLICKHOUSE.QUEUE.SIZE.MAX.WARN} for 5m)'
                  priority: WARNING
                  tags:
                    -
                      tag: scope
                      value: performance
            -
              uuid: 0fc2781f4be44f0e85176e5ed05dc05e
              name: 'ClickHouse: {#DB}.{#TABLE}: Total replicas'
              type: DEPENDENT
              key: 'clickhouse.replica.total_replicas["{#DB}.{#TABLE}"]'
              delay: '0'
              history: 7d
              description: 'Total number of known replicas of this table. (Have a non-zero value only where there is an active session with ZooKeeper).'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].total_replicas.first()'
              master_item:
                key: clickhouse.replicas
              tags:
                -
                  tag: component
                  value: replication
                -
                  tag: database
                  value: '{#DB}'
                -
                  tag: table
                  value: '{#TABLE}'
          trigger_prototypes:
            -
              uuid: f46f1b8d75c54129b6e2ff9ede2501b5
              expression: 'max(/ClickHouse by HTTP/clickhouse.replica.active_replicas["{#DB}.{#TABLE}"],5m) < last(/ClickHouse by HTTP/clickhouse.replica.total_replicas["{#DB}.{#TABLE}"])'
              name: 'ClickHouse: {#DB}.{#TABLE}: Number of active replicas less than number of total replicas'
              priority: WARNING
              tags:
                -
                  tag: scope
                  value: availability
          graph_prototypes:
            -
              uuid: 131e0d19c35f4d87aa62b7766e6e1db3
              name: 'ClickHouse: {#DB}.{#TABLE}: Replica log activity'
              graph_items:
                -
                  color: 1A7C11
                  item:
                    host: 'ClickHouse by HTTP'
                    key: 'clickhouse.replica.log_max_index["{#DB}.{#TABLE}"]'
                -
                  sortorder: '1'
                  color: 2774A4
                  item:
                    host: 'ClickHouse by HTTP'
                    key: 'clickhouse.replica.log_pointer["{#DB}.{#TABLE}"]'
            -
              uuid: 195f5d50a1f0488b9db5d2f1e6a6e8c3
              name: 'ClickHouse: {#DB}.{#TABLE}: Replica queues'
              graph_items:
                -
                  color: 1A7C11
                  item:
                    host: 'ClickHouse by HTTP'
                    key: 'clickhouse.replica.merges_in_queue["{#DB}.{#TABLE}"]'
                -
                  sortorder: '1'
                  color: 2774A4
                  item:
                    host: 'ClickHouse by HTTP'
                    key: 'clickhouse.replica.inserts_in_queue["{#DB}.{#TABLE}"]'
                -
                  sortorder: '2'
                  color: F63100
                  item:
                    host: 'ClickHouse by HTTP'
                    key: 'clickhouse.replica.queue_size["{#DB}.{#TABLE}"]'
                -
                  sortorder: '3'
                  color: A54F10
                  item:
                    host: 'ClickHouse by HTTP'
                    key: 'clickhouse.replica.future_parts["{#DB}.{#TABLE}"]'
                -
                  sortorder: '4'
                  color: FC6EA3
                  item:
                    host: 'ClickHouse by HTTP'
                    key: 'clickhouse.replica.parts_to_check["{#DB}.{#TABLE}"]'
          master_item:
            key: clickhouse.replicas
          lld_macro_paths:
            -
              lld_macro: '{#DB}'
              path: $.database
            -
              lld_macro: '{#TABLE}'
              path: $.table
        -
          uuid: a82f8d0f0a4b493dab0c2133b90113cc
          name: Tables
          type: DEPENDENT
          key: clickhouse.tables.discovery
          delay: '0'
          filter:
            evaltype: AND
            conditions:
              -
                macro: '{#DB}'
                value: '{$CLICKHOUSE.LLD.FILTER.DB.MATCHES}'
                formulaid: A
              -
                macro: '{#DB}'
                value: '{$CLICKHOUSE.LLD.FILTER.DB.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
                formulaid: B
          description: 'Info about tables'
          item_prototypes:
            -
              uuid: f7bb82b047a84c0185b5ca040a75e287
              name: 'ClickHouse: {#DB}: Bytes'
              type: DEPENDENT
              key: 'clickhouse.db.bytes["{#DB}"]'
              delay: '0'
              history: 7d
              units: B
              description: 'Database size in bytes.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}")].bytes.sum()'
              master_item:
                key: clickhouse.tables
              tags:
                -
                  tag: component
                  value: tables
                -
                  tag: database
                  value: '{#DB}'
                -
                  tag: table
                  value: '{#TABLE}'
            -
              uuid: 3075954290af4f35b1620a5f15d2947d
              name: 'ClickHouse: {#DB}.{#TABLE}: Bytes'
              type: DEPENDENT
              key: 'clickhouse.table.bytes["{#DB}.{#TABLE}"]'
              delay: '0'
              history: 7d
              units: B
              description: 'Table size in bytes. Database: {#DB}, table: {#TABLE}'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].bytes.first()'
              master_item:
                key: clickhouse.tables
              tags:
                -
                  tag: component
                  value: tables
                -
                  tag: database
                  value: '{#DB}'
                -
                  tag: table
                  value: '{#TABLE}'
            -
              uuid: e50e12adb7ef47e6ba40db01e7ae01e4
              name: 'ClickHouse: {#DB}.{#TABLE}: Parts'
              type: DEPENDENT
              key: 'clickhouse.table.parts["{#DB}.{#TABLE}"]'
              delay: '0'
              history: 7d
              description: 'Number of parts of the table. Database: {#DB}, table: {#TABLE}'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].parts.first()'
              master_item:
                key: clickhouse.tables
              tags:
                -
                  tag: component
                  value: tables
                -
                  tag: database
                  value: '{#DB}'
                -
                  tag: table
                  value: '{#TABLE}'
            -
              uuid: 0ba557c544854f47bcd9cc65d33f14e7
              name: 'ClickHouse: {#DB}.{#TABLE}: Rows'
              type: DEPENDENT
              key: 'clickhouse.table.rows["{#DB}.{#TABLE}"]'
              delay: '0'
              history: 7d
              description: 'Number of rows in the table. Database: {#DB}, table: {#TABLE}'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$[?(@.database == "{#DB}" && @.table == "{#TABLE}")].rows.first()'
              master_item:
                key: clickhouse.tables
              tags:
                -
                  tag: component
                  value: tables
                -
                  tag: database
                  value: '{#DB}'
                -
                  tag: table
                  value: '{#TABLE}'
          master_item:
            key: clickhouse.tables
          lld_macro_paths:
            -
              lld_macro: '{#DB}'
              path: $.database
            -
              lld_macro: '{#TABLE}'
              path: $.table
      tags:
        -
          tag: class
          value: database
        -
          tag: target
          value: clickhouse
      macros:
        -
          macro: '{$CLICKHOUSE.DELAYED.FILES.DISTRIBUTED.COUNT.MAX.WARN}'
          value: '600'
          description: 'Maximum size of distributed files queue to insert for trigger expression.'
        -
          macro: '{$CLICKHOUSE.DELAYED.INSERTS.MAX.WARN}'
          value: '0'
          description: 'Maximum number of delayed inserts for trigger expression.'
        -
          macro: '{$CLICKHOUSE.LLD.FILTER.DB.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable databases'
        -
          macro: '{$CLICKHOUSE.LLD.FILTER.DB.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter to exclude discovered databases'
        -
          macro: '{$CLICKHOUSE.LLD.FILTER.DICT.MATCHES}'
          value: '.*'
          description: 'Filter of discoverable dictionaries'
        -
          macro: '{$CLICKHOUSE.LLD.FILTER.DICT.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'Filter to exclude discovered dictionaries'
        -
          macro: '{$CLICKHOUSE.LOG_POSITION.DIFF.MAX.WARN}'
          value: '30'
          description: 'Maximum diff between log_pointer and log_max_index.'
        -
          macro: '{$CLICKHOUSE.NETWORK.ERRORS.MAX.WARN}'
          value: '5'
          description: 'Maximum number of smth for trigger expression'
        -
          macro: '{$CLICKHOUSE.PARTS.PER.PARTITION.WARN}'
          value: '300'
          description: 'Maximum number of parts per partition for trigger expression.'
        -
          macro: '{$CLICKHOUSE.PASSWORD}'
          value: zabbix_pass
        -
          macro: '{$CLICKHOUSE.PORT}'
          value: '8123'
          description: 'The port of ClickHouse HTTP endpoint'
        -
          macro: '{$CLICKHOUSE.QUERY_TIME.MAX.WARN}'
          value: '600'
          description: 'Maximum ClickHouse query time in seconds for trigger expression'
        -
          macro: '{$CLICKHOUSE.QUEUE.SIZE.MAX.WARN}'
          value: '20'
          description: 'Maximum size of the queue for operations waiting to be performed for trigger expression.'
        -
          macro: '{$CLICKHOUSE.REPLICA.MAX.WARN}'
          value: '600'
          description: 'Replication lag across all tables for trigger expression.'
        -
          macro: '{$CLICKHOUSE.SCHEME}'
          value: http
          description: 'Request scheme which may be http or https'
        -
          macro: '{$CLICKHOUSE.USER}'
          value: zabbix
      valuemaps:
        -
          uuid: 4d926c30529447b3816cec3f1440b47a
          name: 'Replicas state'
          mappings:
            -
              value: '0'
              newvalue: 'False'
            -
              value: '1'
              newvalue: 'True'
        -
          uuid: 94147888c7ad4f5bae864eb2698f0237
          name: 'Service state'
          mappings:
            -
              value: '0'
              newvalue: Down
            -
              value: '1'
              newvalue: Up
  triggers:
    -
      uuid: 803947a6de9340ed8596510dcbbeacac
      expression: 'last(/ClickHouse by HTTP/clickhouse.ping)=0 or last(/ClickHouse by HTTP/net.tcp.service[{$CLICKHOUSE.SCHEME},"{HOST.CONN}","{$CLICKHOUSE.PORT}"]) = 0'
      name: 'ClickHouse: Service is down'
      priority: AVERAGE
      manual_close: 'YES'
      dependencies:
        -
          name: 'ClickHouse: Port {$CLICKHOUSE.PORT} is unavailable'
          expression: 'last(/ClickHouse by HTTP/net.tcp.service[{$CLICKHOUSE.SCHEME},"{HOST.CONN}","{$CLICKHOUSE.PORT}"])=0'
      tags:
        -
          tag: scope
          value: availability
  graphs:
    -
      uuid: fc2f8de59c874876addb08ec633338d4
      name: 'ClickHouse: Current activity'
      graph_items:
        -
          drawtype: BOLD_LINE
          color: 1A7C11
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.query.current
        -
          sortorder: '1'
          drawtype: BOLD_LINE
          color: 2774A4
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.merge.current
    -
      uuid: b1b66d510e424965b7e82b902e0f2e58
      name: 'ClickHouse: Current connections'
      graph_items:
        -
          drawtype: BOLD_LINE
          color: 1A7C11
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.connections.tcp
        -
          sortorder: '1'
          drawtype: BOLD_LINE
          color: 2774A4
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.connections.http
        -
          sortorder: '2'
          drawtype: BOLD_LINE
          color: F63100
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.connections.mysql
        -
          sortorder: '3'
          drawtype: BOLD_LINE
          color: A54F10
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.connections.interserver
        -
          sortorder: '4'
          drawtype: BOLD_LINE
          color: FC6EA3
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.connections.distribute
    -
      uuid: 59935d9f612f468b97288d9a0dc62b26
      name: 'ClickHouse: Distributed'
      graph_items:
        -
          color: 1A7C11
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.distributed.files.retry.rate
        -
          sortorder: '1'
          color: 2774A4
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.distributed.files.fail.rate
        -
          sortorder: '2'
          drawtype: BOLD_LINE
          color: F63100
          yaxisside: RIGHT
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.distributed.files
    -
      uuid: edd18c769edd442cba00adf97ae4192a
      name: 'ClickHouse: Insert/Merge bytes rate'
      graph_items:
        -
          drawtype: BOLD_LINE
          color: 1A7C11
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.inserted_bytes.rate
        -
          sortorder: '1'
          drawtype: BOLD_LINE
          color: 2774A4
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.merge_bytes.rate
    -
      uuid: 0fd813049e7449b69366021ffa0d3ec7
      name: 'ClickHouse: Insert/Merge rows rate'
      graph_items:
        -
          drawtype: BOLD_LINE
          color: 1A7C11
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.inserted_rows.rate
        -
          sortorder: '1'
          drawtype: BOLD_LINE
          color: 2774A4
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.merge_rows.rate
    -
      uuid: 5a688818d4fa44f687aa8415abddc7c0
      name: 'ClickHouse: Memory Usage'
      graph_items:
        -
          color: 1A7C11
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.memory.tracking.merges
        -
          sortorder: '1'
          color: 2774A4
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.memory.tracking.schedule.pool
        -
          sortorder: '2'
          color: F63100
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.memory.tracking.background.moves
        -
          sortorder: '3'
          color: A54F10
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.memory.tracking.background
        -
          sortorder: '4'
          color: FC6EA3
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.memory.tracking
    -
      uuid: ba22cf13ef6f46299651d15fb860016d
      name: 'ClickHouse: Memory Utilization'
      graph_items:
        -
          drawtype: GRADIENT_LINE
          color: 1A7C11
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.jemalloc.allocated
        -
          sortorder: '1'
          drawtype: GRADIENT_LINE
          color: 2774A4
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.jemalloc.resident
        -
          sortorder: '2'
          drawtype: GRADIENT_LINE
          color: F63100
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.jemalloc.mapped
    -
      uuid: 9593c61ecdfa4c83ab9421ed85a82f36
      name: 'ClickHouse: Queries rate'
      graph_items:
        -
          drawtype: BOLD_LINE
          color: 1A7C11
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.query.rate
        -
          sortorder: '1'
          drawtype: BOLD_LINE
          color: 2774A4
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.select_query.rate
        -
          sortorder: '2'
          drawtype: BOLD_LINE
          color: F63100
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.insert_query.rate
    -
      uuid: eaa80cf006e84d26903cf1004a268a31
      name: 'ClickHouse: Syscalls in fly'
      graph_items:
        -
          drawtype: BOLD_LINE
          color: 1A7C11
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.read
        -
          sortorder: '1'
          drawtype: BOLD_LINE
          color: 2774A4
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.write
    -
      uuid: eda00404a372434ea4f511c219bf3295
      name: 'ClickHouse: Uptime'
      graph_items:
        -
          color: 1A7C11
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.uptime
    -
      uuid: c90d0b21105e42bd9f4399d77ba0a81a
      name: 'ClickHouse: Zookeeper exceptions rate'
      graph_items:
        -
          color: 1A7C11
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.zookeper.exceptions.rate
        -
          sortorder: '1'
          color: 2774A4
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.zookeper.hw_exceptions.rate
        -
          sortorder: '2'
          color: F63100
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.zookeper.user_exceptions.rate
        -
          sortorder: '3'
          drawtype: BOLD_LINE
          color: A54F10
          yaxisside: RIGHT
          item:
            host: 'ClickHouse by HTTP'
            key: clickhouse.zookeper.watch