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

template_app_cloudflare_http.yaml « cloudflare_http « app « templates - github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4a413303256bd6f367f38e40c1489b0990fc021b (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
zabbix_export:
  version: '6.2'
  date: '2022-04-06T19:54:13Z'
  groups:
    -
      uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
      name: Templates/Applications
  templates:
    -
      uuid: 08ef3d687d754b0aba17e1dcbd77d4bd
      template: 'Cloudflare by HTTP'
      name: 'Cloudflare by HTTP'
      description: |
        The template to monitor Cloudflare to see your web traffic and DNS metrics. It works without any external scripts and uses Script item.
        
        Template tooling version used: 0.41
      groups:
        -
          name: Templates/Applications
      items:
        -
          uuid: 2be79391779a4cd395723e62694262e8
          name: 'Cloudflare: Total bandwidth'
          type: DEPENDENT
          key: cloudflare.bandwidth.all
          delay: '0'
          history: 7d
          units: B
          description: 'The volume of all data.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.bandwidth.all
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: bandwidth
        -
          uuid: 7f5900d6c707405789624f84f502b042
          name: 'Cloudflare: Cached bandwidth'
          type: DEPENDENT
          key: cloudflare.bandwidth.cached
          delay: '0'
          history: 7d
          units: B
          description: 'The volume of cached data.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.bandwidth.cached
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: bandwidth
        -
          uuid: c5ab8cc281ff4f75bd4ada79d2c0d1e8
          name: 'Cloudflare: Cache hit ratio of bandwidth'
          type: DEPENDENT
          key: cloudflare.bandwidth.cache_hit_ratio
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: '%'
          description: 'The ratio of the amount cached bandwidth to the bandwidth in percentage.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.bandwidth.cache_hit_ratio
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: bandwidth
          triggers:
            -
              uuid: acf573785c394924aae8ef74b2683fd1
              expression: 'max(/Cloudflare by HTTP/cloudflare.bandwidth.cache_hit_ratio,#3) < {$CLOUDFLARE.CACHED_BANDWIDTH.MIN.WARN}'
              name: 'Cloudflare: Cached bandwidth is too low'
              event_name: 'Cloudflare: Cached bandwidth is too low (less than {$CLOUDFLARE.CACHED_BANDWIDTH.MIN.WARN}% for 3 last measurements)'
              opdata: 'Current value: {ITEM.LASTVALUE1}'
              priority: WARNING
              tags:
                -
                  tag: scope
                  value: performance
        -
          uuid: 901db6b121c7473485c91b0f27e7cf50
          name: 'Cloudflare: SSL encrypted bandwidth'
          type: DEPENDENT
          key: cloudflare.bandwidth.ssl.encrypted
          delay: '0'
          history: 7d
          units: B
          description: 'The volume of encrypted data.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.bandwidth.encrypted
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: bandwidth
        -
          uuid: 4637d88e62204f9d8fb9fc0f179c5319
          name: 'Cloudflare: Unencrypted bandwidth'
          type: DEPENDENT
          key: cloudflare.bandwidth.ssl.unencrypted
          delay: '0'
          history: 7d
          units: B
          description: 'The volume of unencrypted data.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.bandwidth.unencrypted
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: bandwidth
        -
          uuid: 96e88a64df014997b8c675cbc4bb97a1
          name: 'Cloudflare: Uncached bandwidth'
          type: DEPENDENT
          key: cloudflare.bandwidth.uncached
          delay: '0'
          history: 7d
          units: B
          description: 'The volume of uncached data.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.bandwidth.uncached
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: bandwidth
        -
          uuid: 6eff62f2786d42a7925bd516a1c2a958
          name: 'Cloudflare: DNS queries'
          type: DEPENDENT
          key: cloudflare.dns.query.all
          delay: '0'
          history: 7d
          units: conn
          description: 'The amount of all DNS queries.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.dns.query.all
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: dns
        -
          uuid: 4612a834ef054740ba5fea529a08e220
          name: 'Cloudflare: Stale DNS queries'
          type: DEPENDENT
          key: cloudflare.dns.query.stale
          delay: '0'
          history: 7d
          units: conn
          description: 'The number of stale DNS queries.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.dns.query.stale
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: dns
        -
          uuid: 4aeb289b631a402390a833e3c5227d38
          name: 'Cloudflare: Uncached DNS queries'
          type: DEPENDENT
          key: cloudflare.dns.query.uncached
          delay: '0'
          history: 7d
          units: conn
          description: 'The number of uncached DNS queries.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.dns.query.uncached
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: dns
        -
          uuid: 9450a68208fd4cb8bde009296d722064
          name: 'Cloudflare: Get data'
          type: SCRIPT
          key: cloudflare.get
          delay: 0;m01
          history: '0'
          trends: '0'
          value_type: TEXT
          params: |
            var Cloudflare = {
                params: {},
            
                setParams: function (params) {
                    ['api_endpoint', 'token', 'zone'].forEach(function (field) {
                        if (typeof params !== 'object' || typeof params[field] === 'undefined'
                                || params[field] === '') {
                            throw 'Required param is not set: "' + field + '".';
                        }
                    });
            
                    Cloudflare.params = params;
                    if (typeof Cloudflare.params.api_endpoint === 'string') {
                        if (!Cloudflare.params.api_endpoint.endsWith('/')) {
                            Cloudflare.params.api_endpoint += '/';
                        }
                    }
                },
            
                request: function (method, query, data) {
                    var response,
                        request = new HttpRequest(),
                        url = Cloudflare.params.api_endpoint + query;
            
                    request.addHeader('Content-Type: application/json');
                    request.addHeader('Authorization: Bearer ' + Cloudflare.params.token);
            
                    if (typeof data !== 'undefined') {
                        data = JSON.stringify(data);
                    }
            
                    Zabbix.log(4, '[ Cloudflare ] Sending request: ' + url + ((typeof data === 'string') ? ('\n' + data) : ''));
            
                    switch (method) {
                        case 'get':
                            response = request.get(url, data);
                            break;
            
                        case 'post':
                            response = request.post(url, data);
                            break;
            
                        default:
                            throw 'Unsupported HTTP request method: ' + method;
                    }
            
                    Zabbix.log(4, '[ Cloudflare ] Received response with status code ' + request.getStatus() + ': ' + response);
            
                    if (request.getStatus() < 200 || request.getStatus() >= 300) {
                        throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
                    }
            
                    if (response !== null) {
                        try {
                            response = JSON.parse(response);
                        }
                        catch (error) {
                            throw 'Failed to parse response received from Cloudflare. Check debug log for more information.';
                        }
                    }
            
                    if (query === 'graphql/' && request.getStatus() == 200 && typeof response.errors !== 'undefined'
                            && Array.isArray(response.errors)) {
                        throw 'Request failed with error "' + (getField(response, 'errors.0.message') || 'unknown') + '"';
                    }
            
                    return {
                        status: request.getStatus(),
                        response: response
                    };
                }
            }
            
            function getField(object, field, def) {
                var names = field.split('.');
                var name = names.shift();
            
                while (typeof name !== 'undefined') {
                    if (typeof object === undefined || typeof object[name] === 'undefined') {
                        return def;
                    }
            
                    object = object[name];
                    name = names.shift();
                }
            
                return object;
            }
            
            try {
                Cloudflare.setParams(JSON.parse(value));
            
                var datetime_end = new Date(),
                    datetime_start = new Date();
            
                datetime_start.setTime(datetime_end.getTime() - 3600000);
                datetime_start.setMinutes(0, 0, 0);
                datetime_end.setTime(datetime_start.getTime());
                datetime_end.setMinutes(59, 59, 0);
            
                var datetime_start_str = datetime_start.toISOString(),
                    datetime_end_str = datetime_end.toISOString();
            
                var data = {
                    "query": "{viewer {zones(filter: {zoneTag: " + Cloudflare.params.zone + "}) {\
                    httpRequests1hGroups(limit: 100 filter: {\
                        datetime_geq: \"" + datetime_start_str + "\",  datetime_leq: \"" + datetime_end_str + "\"\
                        }) {\
                            sum{\
                                requests\
                                cachedRequests\
                                encryptedRequests\
                                responseStatusMap{ requests edgeResponseStatus }\
                                bytes\
                                cachedBytes\
                                encryptedBytes\
                                threats\
                                pageViews\
                            }\
                            uniq{uniques}\
                            }\
                        }}}", "variables": {}
                }
                var result = Cloudflare.request('post', 'graphql/', data),
                    cloudflare = {},
                    res = getField(result.response, 'data.viewer.zones.0.httpRequests1hGroups.0.sum');
            
                if (typeof res === 'object') {
                    cloudflare = {
                        requests: {
                            all: res.requests || 0,
                            cached: res.cachedRequests || 0,
                            encrypted: res.encryptedRequests || 0,
                            cache_hit_ratio: 0,
                            success_ratio: 0,
                            others_ratio: 0,
                            response_100: 0,
                            response_200: 0,
                            response_300: 0,
                            response_400: 0,
                            response_500: 0
                        },
                        bandwidth: {
                            all: res.bytes || 0,
                            cached: res.cachedBytes || 0,
                            cache_hit_ratio: 0,
                            encrypted: res.encryptedBytes || 0,
                        },
                        threats: {
                            all: res.threats || 0
                        },
                        pageviews: {
                            all: res.pageViews || 0
                        }
                    }
            
                    cloudflare.requests.uncached = res.requests - res.cachedRequests;
                    cloudflare.requests.unencrypted = cloudflare.requests.all - cloudflare.requests.encrypted;
                    cloudflare.bandwidth.uncached = cloudflare.bandwidth.all - cloudflare.bandwidth.cached;
                    cloudflare.bandwidth.unencrypted = cloudflare.bandwidth.all - cloudflare.bandwidth.encrypted;
            
                    if (Array.isArray(res.responseStatusMap)) {
                        res.responseStatusMap.forEach(function (element) {
                            var group = Math.floor((element.edgeResponseStatus / 100)) * 100;
                            cloudflare.requests['response_' + group] += element.requests;
                        });
                    }
            
                    if (cloudflare.requests.all > 0) {
                        cloudflare.requests.success_ratio = (cloudflare.requests.response_200
                            / cloudflare.requests.all * 100).toFixed(2);
                        cloudflare.requests.others_ratio = ((cloudflare.requests.all - cloudflare.requests.response_200)
                            / cloudflare.requests.all * 100).toFixed(2);
                        cloudflare.requests.cache_hit_ratio = (cloudflare.requests.cached
                            / cloudflare.requests.all * 100).toFixed(2);
                    }
            
                    if (cloudflare.bandwidth.all > 0) {
                        cloudflare.bandwidth.cache_hit_ratio = (cloudflare.bandwidth.cached / cloudflare.bandwidth.all * 100).toFixed(2);
                    }
            
                    res = getField(result.response, 'data.viewer.zones.0.httpRequests1hGroups.0.uniq');
            
                    if (typeof res === 'object') {
                        cloudflare.uniques = {
                            all: res.uniques || 0
                        }
                    }
            
                    result = Cloudflare.request('get', 'zones/' + encodeURIComponent(Cloudflare.params.zone)
                        + '/dns_analytics/report?dimensions=queryName&metrics=queryCount,uncachedCount,staleCount&since='
                        + encodeURIComponent(datetime_start_str) + '&until=' + encodeURIComponent(datetime_end_str));
            
                    res = getField(result.response, 'result.totals');
            
                    if (typeof result.response.result === 'object') {
                        cloudflare.dns = {
                            query: {
                                all: res.queryCount || 0,
                                uncached: res.uncachedCount || 0,
                                stale: res.staleCount || 0
                            }
                        }
                    }
                }
            
                return JSON.stringify(cloudflare);
            }
            catch (error) {
                error += (String(error).endsWith('.')) ? '' : '.';
                Zabbix.log(3, '[ Cloudflare ] ERROR: ' + error);
                throw 'Requesting failed: ' + error;
            }
          description: 'The JSON with result of Cloudflare API request.'
          timeout: '{$CLOUDFLARE.GET_DATA.TIMEOUT}'
          parameters:
            -
              name: token
              value: '{$CLOUDFLARE.API.TOKEN}'
            -
              name: zone
              value: '{$CLOUDFLARE.ZONE_ID}'
            -
              name: api_endpoint
              value: '{$CLOUDFLARE.API.URL}'
          tags:
            -
              tag: component
              value: raw
        -
          uuid: 71efacd9f1dc46a7aa29876c8bf7906c
          name: 'Cloudflare: Total page views'
          type: DEPENDENT
          key: cloudflare.pageviews.all
          delay: '0'
          history: 7d
          units: pg
          description: 'The amount of all pageviews.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.pageviews.all
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: pageviews
        -
          uuid: d4a7431b1f6a4d3ab11551a36c98fbf7
          name: 'Cloudflare: Total requests'
          type: DEPENDENT
          key: cloudflare.requests.all
          delay: '0'
          history: 7d
          units: req
          description: 'The amount of all requests.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.requests.all
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: requests
        -
          uuid: cc9d651cdec94afeb12ead87b3c3e8f3
          name: 'Cloudflare: Cached requests'
          type: DEPENDENT
          key: cloudflare.requests.cached
          delay: '0'
          history: 7d
          units: req
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.requests.cached
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: requests
        -
          uuid: e1c2a1280d25439f8020b3ebc451d892
          name: 'Cloudflare: Cache hit ratio % over time'
          type: DEPENDENT
          key: cloudflare.requests.cache_hit_ratio
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: '%'
          description: 'The ratio of the amount cached requests to all requests in percentage.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.requests.cache_hit_ratio
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: requests
        -
          uuid: 228912bdae724d70b1abe79510b69082
          name: 'Cloudflare: Non-2xx responses ratio'
          type: DEPENDENT
          key: cloudflare.requests.others_ratio
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: '%'
          description: 'The ratio of the amount requests with non-2xx response codes to all requests in percentage.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.requests.others_ratio
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: requests
          triggers:
            -
              uuid: e76f4a61dd094419b6e0af706758e545
              expression: 'min(/Cloudflare by HTTP/cloudflare.requests.others_ratio,#3) > {$CLOUDFLARE.ERRORS.MAX.WARN}'
              name: 'Cloudflare: Ratio of non-2xx responses is too high'
              event_name: 'Cloudflare: Ratio of non-2xx responses is too high (more than {$CLOUDFLARE.ERRORS.MAX.WARN}% for 3 last measurements)'
              opdata: 'Current value: {ITEM.LASTVALUE1}'
              priority: AVERAGE
              description: 'A large number of errors can indicate a malfunction of the site.'
              tags:
                -
                  tag: scope
                  value: performance
        -
          uuid: 0f427419265a4ef09f052a03c539125d
          name: 'Cloudflare: Response codes 1xx'
          type: DEPENDENT
          key: cloudflare.requests.response_100
          delay: '0'
          history: 7d
          units: req
          description: 'The number requests with 1xx response codes.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.requests.response_100
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: requests
        -
          uuid: 3ade3e726d314382a3e841b3d5cb5834
          name: 'Cloudflare: Response codes 2xx'
          type: DEPENDENT
          key: cloudflare.requests.response_200
          delay: '0'
          history: 7d
          units: req
          description: 'The number requests with 2xx response codes.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.requests.response_200
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: requests
        -
          uuid: 2caff86e7ca5400889f3b2bd4b6ba986
          name: 'Cloudflare: Response codes 3xx'
          type: DEPENDENT
          key: cloudflare.requests.response_300
          delay: '0'
          history: 7d
          units: req
          description: 'The number requests with 3xx response codes.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.requests.response_300
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: requests
        -
          uuid: b3510ec2adc74e10824365012c13250f
          name: 'Cloudflare: Response codes 4xx'
          type: DEPENDENT
          key: cloudflare.requests.response_400
          delay: '0'
          history: 7d
          units: req
          description: 'The number requests with 4xx response codes.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.requests.response_400
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: requests
        -
          uuid: 714ef2cbecbe4a93b20988a0bc6863a7
          name: 'Cloudflare: Response codes 5xx'
          type: DEPENDENT
          key: cloudflare.requests.response_500
          delay: '0'
          history: 7d
          units: req
          description: 'The number requests with 5xx response codes.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.requests.response_500
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: requests
        -
          uuid: d39fcd4fdc594257bea91de0890d326b
          name: 'Cloudflare: SSL encrypted requests'
          type: DEPENDENT
          key: cloudflare.requests.ssl.encrypted
          delay: '0'
          history: 7d
          units: req
          description: 'The number of encrypted requests.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.requests.encrypted
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: requests
        -
          uuid: acbbc431dfc3431583123380edb6da38
          name: 'Cloudflare: Unencrypted requests'
          type: DEPENDENT
          key: cloudflare.requests.ssl.unencrypted
          delay: '0'
          history: 7d
          units: req
          description: 'The number of unencrypted requests.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.requests.unencrypted
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: requests
        -
          uuid: 6100ff50001543ae83e84ab2c47260f3
          name: 'Cloudflare: 2xx responses ratio'
          type: DEPENDENT
          key: cloudflare.requests.success_ratio
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: '%'
          description: 'The ratio of the amount requests with 2xx response codes to all requests in percentage.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.requests.success_ratio
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: requests
        -
          uuid: 7907f68e795b40fca1bd520556ea1fff
          name: 'Cloudflare: Uncached requests'
          type: DEPENDENT
          key: cloudflare.requests.uncached
          delay: '0'
          history: 7d
          units: req
          description: 'The number of uncached requests.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.requests.uncached
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: requests
        -
          uuid: 328051a78529494e943edda567aa0e24
          name: 'Cloudflare: Total threats'
          type: DEPENDENT
          key: cloudflare.threats.all
          delay: '0'
          history: 7d
          description: 'The number of all threats.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.threats.all
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: threats
        -
          uuid: d1a2ec213b084701805f3f974af25a21
          name: 'Cloudflare: Unique visitors'
          type: DEPENDENT
          key: cloudflare.uniques.all
          delay: '0'
          history: 7d
          units: conn
          description: 'The number of all visitors IPs.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.uniques.all
          master_item:
            key: cloudflare.get
          tags:
            -
              tag: component
              value: uniques
      tags:
        -
          tag: class
          value: service
        -
          tag: target
          value: cloudflare
      macros:
        -
          macro: '{$CLOUDFLARE.API.TOKEN}'
          value: '<change>'
          description: 'Your Cloudflare API Token.'
        -
          macro: '{$CLOUDFLARE.API.URL}'
          value: 'https://api.cloudflare.com/client/v4'
          description: 'The URL of Cloudflare API endpoint.'
        -
          macro: '{$CLOUDFLARE.CACHED_BANDWIDTH.MIN.WARN}'
          value: '50'
          description: 'Minimum of cached bandwidth in %.'
        -
          macro: '{$CLOUDFLARE.ERRORS.MAX.WARN}'
          value: '30'
          description: 'Maximum responses with errors in %.'
        -
          macro: '{$CLOUDFLARE.GET_DATA.TIMEOUT}'
          value: 3s
          description: 'Response timeout for Cloudflare API.'
        -
          macro: '{$CLOUDFLARE.ZONE_ID}'
          value: '<change>'
          description: 'Your Cloudflare Site Zone ID.'
      dashboards:
        -
          uuid: 51f1013e8a3d492faed27fe80b68fc53
          name: Overview
          pages:
            -
              widgets:
                -
                  type: GRAPH_CLASSIC
                  width: '12'
                  height: '5'
                  fields:
                    -
                      type: INTEGER
                      name: source_type
                      value: '0'
                    -
                      type: GRAPH
                      name: graphid
                      value:
                        name: 'Cloudflare: Bandwidth'
                        host: 'Cloudflare by HTTP'
                -
                  type: GRAPH_CLASSIC
                  x: '12'
                  width: '12'
                  height: '5'
                  fields:
                    -
                      type: INTEGER
                      name: source_type
                      value: '0'
                    -
                      type: GRAPH
                      name: graphid
                      value:
                        name: 'Cloudflare: Web requests'
                        host: 'Cloudflare by HTTP'
                -
                  type: GRAPH_CLASSIC
                  'y': '5'
                  width: '12'
                  height: '5'
                  fields:
                    -
                      type: INTEGER
                      name: source_type
                      value: '0'
                    -
                      type: GRAPH
                      name: graphid
                      value:
                        name: 'Cloudflare: DNS requests'
                        host: 'Cloudflare by HTTP'
                -
                  type: GRAPH_CLASSIC
                  x: '12'
                  'y': '5'
                  width: '12'
                  height: '5'
                  fields:
                    -
                      type: INTEGER
                      name: source_type
                      value: '0'
                    -
                      type: GRAPH
                      name: graphid
                      value:
                        name: 'Cloudflare: Caching'
                        host: 'Cloudflare by HTTP'
                -
                  type: GRAPH_CLASSIC
                  'y': '10'
                  width: '12'
                  height: '5'
                  fields:
                    -
                      type: INTEGER
                      name: source_type
                      value: '0'
                    -
                      type: GRAPH
                      name: graphid
                      value:
                        name: 'Cloudflare: HTTP responses ratio over time'
                        host: 'Cloudflare by HTTP'
                -
                  type: GRAPH_CLASSIC
                  x: '12'
                  'y': '10'
                  width: '12'
                  height: '5'
                  fields:
                    -
                      type: INTEGER
                      name: source_type
                      value: '0'
                    -
                      type: GRAPH
                      name: graphid
                      value:
                        name: 'Cloudflare: IPs and threats'
                        host: 'Cloudflare by HTTP'
                -
                  type: GRAPH_CLASSIC
                  'y': '15'
                  width: '12'
                  height: '5'
                  fields:
                    -
                      type: INTEGER
                      name: source_type
                      value: '0'
                    -
                      type: GRAPH
                      name: graphid
                      value:
                        name: 'Cloudflare: HTTP response codes over time'
                        host: 'Cloudflare by HTTP'
  graphs:
    -
      uuid: 09e113216680490c9dd15805474bcac7
      name: 'Cloudflare: Bandwidth'
      graph_items:
        -
          color: 1A7C11
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.bandwidth.all
        -
          sortorder: '1'
          color: 2774A4
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.bandwidth.cached
        -
          sortorder: '2'
          color: F63100
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.bandwidth.uncached
        -
          sortorder: '3'
          color: A54F10
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.bandwidth.ssl.encrypted
        -
          sortorder: '4'
          color: FC6EA3
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.bandwidth.ssl.unencrypted
    -
      uuid: ed4ef5ce4a6a4c5692c22079d8879e0e
      name: 'Cloudflare: Caching'
      graph_items:
        -
          color: 1A7C11
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.requests.cache_hit_ratio
        -
          sortorder: '1'
          color: 2774A4
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.bandwidth.cache_hit_ratio
    -
      uuid: 25df26cece41403d864f1ced5901bffa
      name: 'Cloudflare: DNS requests'
      graph_items:
        -
          color: 1A7C11
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.dns.query.all
        -
          sortorder: '1'
          color: 2774A4
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.dns.query.stale
        -
          sortorder: '2'
          color: F63100
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.dns.query.uncached
    -
      uuid: 3fb3b089a115420bbc051c14fcd2f3aa
      name: 'Cloudflare: HTTP response codes over time'
      graph_items:
        -
          color: 1A7C11
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.requests.response_100
        -
          sortorder: '1'
          color: 2774A4
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.requests.response_200
        -
          sortorder: '2'
          color: F63100
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.requests.response_300
        -
          sortorder: '3'
          color: A54F10
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.requests.response_400
        -
          sortorder: '4'
          color: FC6EA3
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.requests.response_500
    -
      uuid: c9e1708427a84182a406faec327bb6f1
      name: 'Cloudflare: HTTP responses ratio over time'
      graph_items:
        -
          color: 1A7C11
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.requests.others_ratio
        -
          sortorder: '1'
          color: 2774A4
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.requests.success_ratio
    -
      uuid: 6a0da78eec23423ab084a0760f1691be
      name: 'Cloudflare: IPs and threats'
      graph_items:
        -
          color: 1A7C11
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.threats.all
        -
          sortorder: '1'
          color: 2774A4
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.uniques.all
    -
      uuid: 659df99629a341449c77baf7a9b99b77
      name: 'Cloudflare: Web requests'
      graph_items:
        -
          color: 1A7C11
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.requests.all
        -
          sortorder: '1'
          color: 2774A4
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.requests.cached
        -
          sortorder: '2'
          color: F63100
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.requests.uncached
        -
          sortorder: '3'
          color: A54F10
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.requests.ssl.encrypted
        -
          sortorder: '4'
          color: FC6EA3
          item:
            host: 'Cloudflare by HTTP'
            key: cloudflare.requests.ssl.unencrypted