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

template_net_meraki_http.yaml « meraki_http « net « templates - github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3d0c7d70f9c6401ad757385357cf9158c26fe6b3 (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
zabbix_export:
  version: '6.4'
  date: '2022-11-01T21:40:45Z'
  template_groups:
    -
      uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
      name: Templates/Applications
    -
      uuid: 36bff6c29af64692839d077febfc7079
      name: 'Templates/Network devices'
  host_groups:
    -
      uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
      name: Applications
  templates:
    -
      uuid: 2fca6b60914b4fa98132b1a7885ab014
      template: 'Cisco Meraki dashboard by HTTP'
      name: 'Cisco Meraki dashboard by HTTP'
      description: |
        Template for monitoring Cisco Meraki dashboard https://meraki.cisco.com/products/meraki-dashboard/
        
        You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/
        
        Template tooling version used: 0.42
      groups:
        -
          name: Templates/Applications
        -
          name: 'Templates/Network devices'
      items:
        -
          uuid: d1a5f3c79a604bae98c314d2aed64ff4
          name: 'Meraki: Get data'
          type: SCRIPT
          key: meraki.get.data
          delay: 1h
          history: '0'
          trends: '0'
          value_type: TEXT
          params: |
            var params = JSON.parse(value);
            
            var request = new HttpRequest();
            
            request.addHeader('X-Cisco-Meraki-API-Key:' + params.token);
            
            var response,
                error_msg = '',
                organizations = [],
                devices = [];
            
            function getHttpData(url) {
                response = request.get(url);
                Zabbix.log(4, '[ Meraki API ] [ ' + url + ' ] Received response with status code ' + request.getStatus() + ': ' + response);
            
                if (response !== null) {
                    try {
                        response = JSON.parse(response);
                    }
                    catch (error) {
                        throw 'Failed to parse response received from Meraki API. Check debug log for more information.';
                    }
                }
            
                if (request.getStatus() !== 200) {
                    if (response.errors) {
                        throw response.errors.join(', ');
                    } else {
                        throw 'Failed to receive data: invalid response status code.';
                    }
                }
            
                if (typeof (response) !== 'object' || response === null) {
                    throw 'Cannot process response data: received data is not an object.';
                }
            
                return response;
            };
            
            try {
            
                if (params.token === '{' + '$MERAKI.TOKEN}') {
                    throw 'Please change {' + '$MERAKI.TOKEN} macro with the proper value.';
                }
            
                if (params.url.indexOf('http://') === -1 && params.url.indexOf('https://') === -1) {
                    params.url = 'https://' + params.url;
                }
            
                if (!params.url.endsWith('/')) {
                    params.url += '/';
                }
            
                if (typeof params.httpproxy !==  'undefined' && params.httpproxy !== '') {
                    request.setProxy(params.httpproxy);
                }
            
                organizations = getHttpData(params.url + 'organizations');
            
                if (Array.isArray(organizations) && organizations.length > 0) {
                    for (i in organizations) {
                        if ('id' in organizations[i]) {
                            organization_devices = getHttpData(params.url + 'organizations/' + encodeURIComponent(organizations[i].id) + '/devices');
            
                            if (Array.isArray(organization_devices) && organization_devices.length > 0) {
                                for (j in organization_devices) {
                                    organization_devices[j].organizationId = organizations[i].id;
            
                                    devices.push(organization_devices[j]);
                                }
                            }
                        }
                    }
                }
            
            } catch (error) {
                error_msg = error;
            };
            
            return JSON.stringify({
              'organizations': organizations,
              'devices': devices,
              'error': error_msg.toString()
            });
          description: 'Item for gathering all the organizations and devices from Meraki API"'
          timeout: 60s
          parameters:
            -
              name: token
              value: '{$MERAKI.TOKEN}'
            -
              name: url
              value: '{$MERAKI.API.URL}'
            -
              name: httpproxy
              value: '{$MERAKI.HTTP_PROXY}'
          tags:
            -
              tag: component
              value: raw
        -
          uuid: 6fdd764d820341e7bd2a24f42802c58a
          name: 'Meraki: Data item errors'
          type: DEPENDENT
          key: meraki.get.data.errors
          delay: '0'
          history: 7d
          trends: '0'
          value_type: TEXT
          description: 'Item for gathering all the data item errors.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.error
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: meraki.get.data
          tags:
            -
              tag: component
              value: error
          triggers:
            -
              uuid: 2bf9355f548e4e9b9b8581fb43f175fe
              expression: 'length(last(/Cisco Meraki dashboard by HTTP/meraki.get.data.errors))>0'
              name: 'Meraki: There are errors in ''Get data'' metric'
              priority: WARNING
              tags:
                -
                  tag: scope
                  value: availability
      discovery_rules:
        -
          uuid: 6488b49e692e4fe8b6a1c57f56b6ba7d
          name: 'Devices discovery'
          type: DEPENDENT
          key: meraki.devices.discovery
          delay: '0'
          filter:
            conditions:
              -
                macro: '{#NAME}'
                value: '{$MERAKI.DEVICE.NAME.MATCHES}'
                formulaid: A
              -
                macro: '{#NAME}'
                value: '{$MERAKI.DEVICE.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
                formulaid: B
          host_prototypes:
            -
              uuid: 86d599f384d94b368508a170911213ec
              host: '{#NAME}'
              name: '[{#PRODUCT_TYPE}] {#NAME}'
              group_links:
                -
                  group:
                    name: Applications
              templates:
                -
                  name: 'Cisco Meraki device by HTTP'
              macros:
                -
                  macro: '{$MAC}'
                  value: '{#MAC}'
                  description: 'MAC address of the device.'
                -
                  macro: '{$NETWORK.ID}'
                  value: '{#NETWORK.ID}'
                  description: 'Network ID of the device.'
                -
                  macro: '{$ORGANIZATION_ID}'
                  value: '{#ORGANIZATION_ID}'
                  description: 'Organization ID of the device.'
                -
                  macro: '{$SERIAL}'
                  value: '{#SERIAL}'
                  description: 'Serial number of the device.'
              tags:
                -
                  tag: model
                  value: '{#MODEL}'
                -
                  tag: serial-number
                  value: '{#SERIAL}'
          master_item:
            key: meraki.get.data
          timeout: 30s
          lld_macro_paths:
            -
              lld_macro: '{#MAC}'
              path: $.mac
            -
              lld_macro: '{#MODEL}'
              path: $.model
            -
              lld_macro: '{#NAME}'
              path: $.name
            -
              lld_macro: '{#NETWORK.ID}'
              path: $.networkId
            -
              lld_macro: '{#ORGANIZATION_ID}'
              path: $.organizationId
            -
              lld_macro: '{#PRODUCT_TYPE}'
              path: $.productType
            -
              lld_macro: '{#SERIAL}'
              path: $.serial
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.devices
        -
          uuid: 30f38d19659646009ca436d48f9598b0
          name: 'Organizations discovery'
          type: DEPENDENT
          key: meraki.organization.discovery
          delay: '0'
          filter:
            conditions:
              -
                macro: '{#NAME}'
                value: '{$MERAKI.ORGANIZATION.NAME.MATCHES}'
                formulaid: A
              -
                macro: '{#NAME}'
                value: '{$MERAKI.ORGANIZATION.NAME.NOT_MATCHES}'
                operator: NOT_MATCHES_REGEX
                formulaid: B
          host_prototypes:
            -
              uuid: 59cd2e995b814d7e9f8411dbc7420c76
              host: '{#NAME}'
              name: '[{#REGION}] {#NAME}'
              group_links:
                -
                  group:
                    name: Applications
              group_prototypes:
                -
                  name: '{#REGION}'
              templates:
                -
                  name: 'Cisco Meraki organization by HTTP'
              macros:
                -
                  macro: '{$ID}'
                  value: '{#ID}'
                  description: 'ID of the organization.'
          master_item:
            key: meraki.get.data
          lld_macro_paths:
            -
              lld_macro: '{#ID}'
              path: $.id
            -
              lld_macro: '{#NAME}'
              path: $.name
            -
              lld_macro: '{#REGION}'
              path: $.cloud.region.name
            -
              lld_macro: '{#URL}'
              path: $.url
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.organizations
      tags:
        -
          tag: class
          value: network
        -
          tag: target
          value: cisco-meraki-dashboard
      macros:
        -
          macro: '{$MERAKI.API.URL}'
          value: api.meraki.com/api/v1
          description: 'Cisco Meraki Dashboard API URL. e.g api.meraki.com/api/v1'
        -
          macro: '{$MERAKI.DEVICE.NAME.MATCHES}'
          value: .+
          description: 'This macro is used in devices discovery. Can be overridden on the host or linked template level.'
        -
          macro: '{$MERAKI.DEVICE.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'This macro is used in devices discovery. Can be overridden on the host or linked template level.'
        -
          macro: '{$MERAKI.HTTP_PROXY}'
          description: 'HTTP proxy for API requests. You can specify it using the format [protocol://][username[:password]@]proxy.example.com[:port]. See documentation at https://www.zabbix.com/documentation/6.4/manual/config/items/itemtypes/http'
        -
          macro: '{$MERAKI.ORGANIZATION.NAME.MATCHES}'
          value: .+
          description: 'This macro is used in organizations discovery. Can be overridden on the host or linked template level.'
        -
          macro: '{$MERAKI.ORGANIZATION.NAME.NOT_MATCHES}'
          value: CHANGE_IF_NEEDED
          description: 'This macro is used in organizations discovery. Can be overridden on the host or linked template level.'
        -
          macro: '{$MERAKI.TOKEN}'
          type: SECRET_TEXT
          description: 'Cisco Meraki Dashboard API Token.'
    -
      uuid: 2cae7d2eeca04e6fa7419759ac9ad814
      template: 'Cisco Meraki device by HTTP'
      name: 'Cisco Meraki device by HTTP'
      description: 'Template tooling version used: 0.42'
      groups:
        -
          name: Templates/Applications
        -
          name: 'Templates/Network devices'
      items:
        -
          uuid: 2280b9212c474d99835ec1334ff780eb
          name: 'Meraki: public ip'
          type: DEPENDENT
          key: meraki.device.public.ip
          delay: '0'
          history: 7d
          trends: '0'
          value_type: CHAR
          description: |
            Device public ip
            Network: {$NETWORK.ID} 
            MAC: {$MAC}
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$.device[0].publicIp'
          master_item:
            key: meraki.get.device
          tags:
            -
              tag: component
              value: network
        -
          uuid: 324b748bfe2e4383927176046e246acb
          name: 'Meraki: status'
          type: DEPENDENT
          key: meraki.device.status
          delay: '0'
          history: 7d
          description: |
            Device operational status
            Network: {$NETWORK.ID} 
            MAC: {$MAC}
          valuemap:
            name: 'Device status'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - '$.device[0].status'
            -
              type: JAVASCRIPT
              parameters:
                - |
                  switch (value) {
                      case 'offline':
                          return 0
                      case 'online':
                          return 1
                      case 'dormant':
                          return 2
                      default:
                          return 10
                  }
          master_item:
            key: meraki.get.device
          tags:
            -
              tag: component
              value: health
          triggers:
            -
              uuid: 00583ac9e9824f7db22a1685421f0be9
              expression: 'last(/Cisco Meraki device by HTTP/meraki.device.status)<>1'
              name: 'Meraki: Status is not online'
              priority: WARNING
              tags:
                -
                  tag: scope
                  value: availability
        -
          uuid: e4963b68cdde453f91767ff9e3a31d16
          name: 'Meraki: Get device data'
          type: SCRIPT
          key: meraki.get.device
          delay: 3m
          history: '0'
          trends: '0'
          value_type: TEXT
          params: |
            var params = JSON.parse(value);
            
            var request = new HttpRequest();
            
            request.addHeader('X-Cisco-Meraki-API-Key:' + params.token);
            
            var response,
                error_msg = '',
                device = [],
                uplinksLL = [];
            
            function getHttpData(url) {
                response = request.get(url);
                Zabbix.log(4, '[ Meraki API ] [ ' + url + ' ] Received response with status code ' + request.getStatus() + ': ' + response);
            
                if (response !== null) {
                    try {
                        response = JSON.parse(response);
                    }
                    catch (error) {
                        throw 'Failed to parse response received from Meraki API. Check debug log for more information.';
                    }
                }
            
                if (request.getStatus() !== 200) {
                    if (response.errors) {
                        throw response.errors.join(', ');
                    } else {
                        throw 'Failed to receive data: invalid response status code.';
                    }
                }
            
                if (typeof (response) !== 'object' || response === null) {
                    throw 'Cannot process response data: received data is not an object.';
                }
            
                return response;
            };
            
            try {
            
                if (params.token === '{' + '$MERAKI.TOKEN}') {
                    throw 'Please change {' + '$MERAKI.TOKEN} macro with the proper value.';
                }
            
                if (params.url.indexOf('http://') === -1 && params.url.indexOf('https://') === -1) {
                    params.url = 'https://' + params.url;
                }
            
                if (!params.url.endsWith('/')) {
                    params.url += '/';
                }
            
                if (typeof params.httpproxy !==  'undefined' && params.httpproxy !== '') {
                    request.setProxy(params.httpproxy);
                }
            
                device = getHttpData(params.url + 'organizations/' + encodeURIComponent(params.organizationId) + '/devices/statuses?serials[]=' + encodeURIComponent(params.serial));
                uplinksLL = getHttpData(params.url + 'organizations/' + encodeURIComponent(params.organizationId) + '/devices/uplinksLossAndLatency?timespan=60');
            
                if (uplinksLL.length > 0) {
                    uplinks = uplinksLL.filter(function(device) {
                        return device.serial == params.serial;
                    });
                }
            
            } catch (error) {
                error_msg = error;
            };
            
            return JSON.stringify({
                'device': device,
                'uplinksLL': uplinks,
                'error': error_msg.toString()
            });
          description: 'Item for gathering device data from Meraki API.'
          timeout: 60s
          parameters:
            -
              name: token
              value: '{$MERAKI.TOKEN}'
            -
              name: url
              value: '{$MERAKI.API.URL}'
            -
              name: organizationId
              value: '{$ORGANIZATION_ID}'
            -
              name: httpproxy
              value: '{$MERAKI.HTTP_PROXY}'
            -
              name: serial
              value: '{$SERIAL}'
          tags:
            -
              tag: component
              value: raw
        -
          uuid: b673516073354c9aaaf60cf3ce2e2fa6
          name: 'Meraki: Device data item errors'
          type: DEPENDENT
          key: meraki.get.device.errors
          delay: '0'
          history: 7d
          trends: '0'
          value_type: TEXT
          description: 'Item for gathering errors of the device item.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.error
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: meraki.get.device
          tags:
            -
              tag: component
              value: error
          triggers:
            -
              uuid: c8f8af6c92f14dc0bcdf426b124c7344
              expression: 'length(last(/Cisco Meraki device by HTTP/meraki.get.device.errors))>0'
              name: 'Meraki: There are errors in ''Get Device data'' metric'
              priority: WARNING
              tags:
                -
                  tag: scope
                  value: availability
      discovery_rules:
        -
          uuid: 9c7e5d2ccad7416b8d58237be4218154
          name: 'Uplinks loss and quality discovery'
          type: DEPENDENT
          key: meraki.device.uplinks.discovery
          delay: '0'
          item_prototypes:
            -
              uuid: abf642b1bb944d16bebf90dcf58dbd86
              name: 'Uplink [{#IP}]: [{#UPLINK}]: Latency'
              type: DEPENDENT
              key: 'meraki.device.latency[{#IP},{#UPLINK}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: s
              description: |
                Latency of the device uplink. 
                Network: {#NETWORK.ID}. 
                Device serial: {#SERIAL}.
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$.uplinksLL[?(@.ip == ''{#IP}'' && @.uplink== ''{#UPLINK}'')].timeSeries.[0].latencyMs.first()'
                -
                  type: JAVASCRIPT
                  parameters:
                    - 'return value === "" ? -1000 : value'
                -
                  type: MULTIPLIER
                  parameters:
                    - '0.001'
              master_item:
                key: meraki.get.device
              tags:
                -
                  tag: component
                  value: network
                -
                  tag: ip
                  value: '{#IP}'
                -
                  tag: network
                  value: '{#NETWORK.ID}'
                -
                  tag: serial-number
                  value: '{#SERIAL}'
                -
                  tag: uplink
                  value: '{#UPLINK}'
              trigger_prototypes:
                -
                  uuid: b559ad94b15848089d89e85e4d9db7ff
                  expression: 'min(/Cisco Meraki device by HTTP/meraki.device.latency[{#IP},{#UPLINK}],#3)>{$MERAKI.DEVICE.LATENCY}'
                  name: 'Uplink [{#IP}]: [{#UPLINK}]: latency > {$MERAKI.DEVICE.LATENCY}'
                  priority: WARNING
                  tags:
                    -
                      tag: scope
                      value: performance
            -
              uuid: bded34f64113486ab0672210e5a8eb1d
              name: 'Uplink [{#IP}]: [{#UPLINK}]: Loss, %'
              type: DEPENDENT
              key: 'meraki.device.loss.pct[{#IP},{#UPLINK}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: '%'
              description: |
                Loss percent of the device uplink. 
                Network: {#NETWORK.ID}. 
                Device serial: {#SERIAL}.
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$.uplinksLL[?(@.ip == ''{#IP}'' && @.uplink== ''{#UPLINK}'')].timeSeries.[0].lossPercent.first()'
                -
                  type: JAVASCRIPT
                  parameters:
                    - 'return value === "" ? -1 : value'
              master_item:
                key: meraki.get.device
              tags:
                -
                  tag: component
                  value: network
                -
                  tag: ip
                  value: '{#IP}'
                -
                  tag: network
                  value: '{#NETWORK.ID}'
                -
                  tag: serial-number
                  value: '{#SERIAL}'
                -
                  tag: uplink
                  value: '{#UPLINK}'
              trigger_prototypes:
                -
                  uuid: 1309e71025614ce4bb4242e6e291ae48
                  expression: 'min(/Cisco Meraki device by HTTP/meraki.device.loss.pct[{#IP},{#UPLINK}],#3)>{$MERAKI.DEVICE.LOSS}'
                  name: 'Uplink [{#IP}]: [{#UPLINK}]: loss > {$MERAKI.DEVICE.LOSS}%'
                  priority: WARNING
                  tags:
                    -
                      tag: scope
                      value: performance
          graph_prototypes:
            -
              uuid: 4e9d84e08b32489c8c3a2cbbd4c6119a
              name: 'Uplink [{#IP}]: [{#UPLINK}]: Latency'
              ymin_type_1: FIXED
              graph_items:
                -
                  color: 1A7C11
                  item:
                    host: 'Cisco Meraki device by HTTP'
                    key: 'meraki.device.latency[{#IP},{#UPLINK}]'
            -
              uuid: ebf262afc6d94d29b9831d418fb07edb
              name: 'Uplink [{#IP}]: [{#UPLINK}]: Loss'
              ymin_type_1: FIXED
              graph_items:
                -
                  color: 1A7C11
                  item:
                    host: 'Cisco Meraki device by HTTP'
                    key: 'meraki.device.loss.pct[{#IP},{#UPLINK}]'
          master_item:
            key: meraki.get.device
          timeout: 30s
          lld_macro_paths:
            -
              lld_macro: '{#IP}'
              path: $.ip
            -
              lld_macro: '{#NETWORK.ID}'
              path: $.networkId
            -
              lld_macro: '{#SERIAL}'
              path: $.serial
            -
              lld_macro: '{#UPLINK}'
              path: $.uplink
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.uplinksLL
      tags:
        -
          tag: class
          value: network
        -
          tag: target
          value: cisco-meraki-dashboard
      macros:
        -
          macro: '{$MERAKI.API.URL}'
          value: api.meraki.com/api/v1
          description: 'Cisco Meraki Dashboard API URL. e.g api.meraki.com/api/v1'
        -
          macro: '{$MERAKI.DEVICE.LATENCY}'
          value: '0.15'
          description: 'Devices uplink latency threshold in seconds.'
        -
          macro: '{$MERAKI.DEVICE.LOSS}'
          value: '15'
          description: 'Devices uplink loss threshold in percents.'
        -
          macro: '{$MERAKI.HTTP_PROXY}'
          description: 'HTTP proxy for API requests. You can specify it using the format [protocol://][username[:password]@]proxy.example.com[:port]. See documentation at https://www.zabbix.com/documentation/6.4/manual/config/items/itemtypes/http'
        -
          macro: '{$MERAKI.TOKEN}'
          type: SECRET_TEXT
          description: 'Cisco Meraki Dashboard API Token.'
      valuemaps:
        -
          uuid: 24967dff65a048578eae18b2485907cb
          name: 'Device status'
          mappings:
            -
              value: '0'
              newvalue: offline
            -
              value: '1'
              newvalue: online
            -
              value: '2'
              newvalue: dormant
            -
              value: '10'
              newvalue: unknown
    -
      uuid: 39e2f742d0b24ea489b7f61d27a5df1c
      template: 'Cisco Meraki organization by HTTP'
      name: 'Cisco Meraki organization by HTTP'
      description: 'Template tooling version used: 0.42'
      groups:
        -
          name: Templates/Applications
        -
          name: 'Templates/Network devices'
      items:
        -
          uuid: 25f8f61ddf964f39b39cc38b23b017b9
          name: 'Meraki: Get list of adaptive policy aggregate statistics'
          type: HTTP_AGENT
          key: meraki.get.adaptive.policy
          delay: 20m
          history: '0'
          trends: '0'
          value_type: TEXT
          description: 'Item for adaptive policy aggregate statistics for an organization.'
          timeout: 30s
          url: 'https://{$MERAKI.API.URL}/organizations/{$ID}/adaptivePolicy/overview'
          http_proxy: '{$MERAKI.HTTP_PROXY}'
          headers:
            -
              name: X-Cisco-Meraki-API-Key
              value: '{$MERAKI.TOKEN}'
          tags:
            -
              tag: component
              value: raw
        -
          uuid: f2a65bce3adf4511a3f37ed4caa66b3d
          name: 'Meraki: Get list of configuration changes'
          type: HTTP_AGENT
          key: meraki.get.configuration.changes
          delay: '{$MERAKI.CONFIG.CHANGE.TIMESPAN}'
          history: 7d
          trends: '0'
          value_type: TEXT
          description: 'Item for viewing the Change Log for your organization.\nGathering once per 20m by default.'
          preprocessing:
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 2h
          timeout: 30s
          url: 'https://{$MERAKI.API.URL}/organizations/{$ID}/configurationChanges?timespan={$MERAKI.CONFIG.CHANGE.TIMESPAN}'
          http_proxy: '{$MERAKI.HTTP_PROXY}'
          headers:
            -
              name: X-Cisco-Meraki-API-Key
              value: '{$MERAKI.TOKEN}'
          tags:
            -
              tag: component
              value: log
          triggers:
            -
              uuid: 2fc56ad4baef4796a3ad7d097cad918f
              expression: 'length(last(/Cisco Meraki organization by HTTP/meraki.get.configuration.changes))>3'
              name: 'Meraki: Configuration has been changed'
              priority: WARNING
              tags:
                -
                  tag: scope
                  value: security
        -
          uuid: 3306da0ec0d749829db2f5f42e4e7876
          name: 'Meraki: Get licenses info'
          type: HTTP_AGENT
          key: meraki.get.licenses
          delay: 12h
          history: '0'
          trends: '0'
          value_type: TEXT
          description: 'Return an overview of the license state for an organization.'
          timeout: 30s
          url: 'https://{$MERAKI.API.URL}/organizations/{$ID}/licenses/overview'
          http_proxy: '{$MERAKI.HTTP_PROXY}'
          headers:
            -
              name: X-Cisco-Meraki-API-Key
              value: '{$MERAKI.TOKEN}'
          tags:
            -
              tag: component
              value: raw
        -
          uuid: efe8853443d44eed8daeecee5ab9e481
          name: 'Meraki: Get list of the networks'
          type: SCRIPT
          key: meraki.get.networks
          delay: 3m
          history: '0'
          trends: '0'
          value_type: TEXT
          params: |
            var params = JSON.parse(value);
            
            var request = new HttpRequest();
            
            request.addHeader('X-Cisco-Meraki-API-Key:' + params.token);
            
            var response,
                error_msg = '',
                networks = [],
                uplinks = [];
            
            function getHttpData(url) {
                response = request.get(url);
                Zabbix.log(4, '[ Meraki API ] [ ' + url + ' ] Received response with status code ' + request.getStatus() + ': ' + response);
            
                if (response !== null) {
                    try {
                        response = JSON.parse(response);
                    }
                    catch (error) {
                        throw 'Failed to parse response received from Meraki API. Check debug log for more information.';
                    }
                }
            
                if (request.getStatus() !== 200) {
                    if (response.errors) {
                        throw response.errors.join(', ');
                    } else {
                        throw 'Failed to receive data: invalid response status code.';
                    }
                }
            
                if (typeof (response) !== 'object' || response === null) {
                    throw 'Cannot process response data: received data is not an object.';
                }
            
                return response;
            };
            
            try {
            
                if (params.token === '{' + '$MERAKI.TOKEN}') {
                    throw 'Please change {' + '$MERAKI.TOKEN} macro with the proper value.';
                }
            
                if (params.url.indexOf('http://') === -1 && params.url.indexOf('https://') === -1) {
                    params.url = 'https://' + params.url;
                }
            
                if (!params.url.endsWith('/')) {
                    params.url += '/';
                }
            
                if (typeof params.httpproxy !==  'undefined' && params.httpproxy !== '') {
                    request.setProxy(params.httpproxy);
                }
            
                networks = getHttpData(params.url + 'organizations/' + encodeURIComponent(params.organizationId) + '/networks');
            
                responseUplinks = getHttpData(params.url + 'organizations/' + encodeURIComponent(params.organizationId) + '/appliance/uplink/statuses');
            
                if (typeof responseUplinks !== 'undefined' && Array.isArray(responseUplinks)) {
                    for (var i in responseUplinks) {
                        if ('networkId' in responseUplinks[i] && typeof networks !== 'undefined' && Array.isArray(networks)) {
                            network = networks.filter(function (x) { return x.id == responseUplinks[i].networkId; });
                        }
            
                        if (typeof responseUplinks[i].uplinks !== 'undefined' && Array.isArray(responseUplinks[i].uplinks)) {
                            for (var p in responseUplinks[i].uplinks) {
                                if (typeof network[0].name !== 'undefined') {
                                    responseUplinks[i].uplinks[p].networkName = network[0].name;
                                }
                                if (typeof network[0].timeZone !== 'undefined') {
                                    responseUplinks[i].uplinks[p].timeZone = network[0].timeZone;
                                }
                                if ('highAvailability' in responseUplinks[i] && 'role' in responseUplinks[i].highAvailability) {
                                    responseUplinks[i].uplinks[p].role = responseUplinks[i].highAvailability.role;
                                }
                                if ('serial' in responseUplinks[i]) {
                                    responseUplinks[i].uplinks[p].serial = responseUplinks[i].serial;
                                }
            
                                uplinks.push(responseUplinks[i].uplinks[p]);
                            }
                        }
                    }
                }
            
            
            } catch (error) {
                error_msg = error;
            };
            
            return JSON.stringify({
                'uplinks': uplinks,
                'networks': networks,
                'error': error_msg.toString()
            });
          description: 'Item for gathering all the networks of organization from Meraki API.'
          timeout: 30s
          parameters:
            -
              name: token
              value: '{$MERAKI.TOKEN}'
            -
              name: url
              value: '{$MERAKI.API.URL}'
            -
              name: organizationId
              value: '{$ID}'
            -
              name: httpproxy
              value: '{$MERAKI.HTTP_PROXY}'
          tags:
            -
              tag: component
              value: raw
        -
          uuid: b2bb422b7d794a03a93c8d46209cd3fb
          name: 'Meraki: Networks item errors'
          type: DEPENDENT
          key: meraki.get.networks.errors
          delay: '0'
          history: 7d
          trends: '0'
          value_type: TEXT
          description: 'Item for gathering all the networks item errors.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.error
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: meraki.get.networks
          tags:
            -
              tag: component
              value: error
          triggers:
            -
              uuid: c149d21e19f3453b8e569c549ed2c78a
              expression: 'length(last(/Cisco Meraki organization by HTTP/meraki.get.networks.errors))>0'
              name: 'Meraki: There are errors in ''Get networks'' metric'
              priority: WARNING
              tags:
                -
                  tag: scope
                  value: availability
        -
          uuid: bb653e6dba3f489494a7143b74fe8f4f
          name: 'Meraki: Get list of the vpn stats'
          type: SCRIPT
          key: meraki.get.vpn.stats
          delay: 3m
          history: '0'
          trends: '0'
          value_type: TEXT
          params: |
            var params = JSON.parse(value);
            
            var request = new HttpRequest();
            
            request.addHeader('X-Cisco-Meraki-API-Key:' + params.token);
            
            var response,
                error_msg = '',
                vpnStats = [],
                result = [];
            
            function getHttpData(url) {
                response = request.get(url);
                Zabbix.log(4, '[ Meraki API ] [ ' + url + ' ] Received response with status code ' + request.getStatus() + ': ' + response);
            
                if (response !== null) {
                    try {
                        response = JSON.parse(response);
                    }
                    catch (error) {
                        throw 'Failed to parse response received from Meraki API. Check debug log for more information.';
                    }
                }
            
                if (request.getStatus() !== 200) {
                    if (response.errors) {
                        throw response.errors.join(', ');
                    } else {
                        throw 'Failed to receive data: invalid response status code.';
                    }
                }
            
                if (typeof (response) !== 'object' || response === null) {
                    throw 'Cannot process response data: received data is not an object.';
                }
            
                return response;
            };
            
            try {
            
                if (params.token === '{' + '$MERAKI.TOKEN}') {
                    throw 'Please change {' + '$MERAKI.TOKEN} macro with the proper value.';
                }
            
                if (params.url.indexOf('http://') === -1 && params.url.indexOf('https://') === -1) {
                    params.url = 'https://' + params.url;
                }
            
                if (!params.url.endsWith('/')) {
                    params.url += '/';
                }
            
                if (typeof params.httpproxy !==  'undefined' && params.httpproxy !== '') {
                    request.setProxy(params.httpproxy);
                }
            
                vpnStats = getHttpData(params.url + 'organizations/' + encodeURIComponent(params.organizationId) + '/appliance/vpn/stats');
            
                for (i in vpnStats) {
                    if (typeof vpnStats[i].merakiVpnPeers !== 'undefined' && Array.isArray(vpnStats[i].merakiVpnPeers)) {
                        for (u in vpnStats[i].merakiVpnPeers) {
                            if (typeof vpnStats[i].merakiVpnPeers[u].latencySummaries !== 'undefined' && Array.isArray(vpnStats[i].merakiVpnPeers[u].latencySummaries)) {
                                for (l in vpnStats[i].merakiVpnPeers[u].latencySummaries) {
                                    result = vpnStats[i].merakiVpnPeers[u].latencySummaries.map(function (x) {
            
                                        lps = vpnStats[i].merakiVpnPeers[u].lossPercentageSummaries.filter(function (y) { return y.senderUplink == x.senderUplink && y.receiverUplink == x.receiverUplink; });
                                        js = vpnStats[i].merakiVpnPeers[u].jitterSummaries.filter(function (y) { return y.senderUplink == x.senderUplink && y.receiverUplink == x.receiverUplink; });
                                        ms = vpnStats[i].merakiVpnPeers[u].mosSummaries.filter(function (y) { return y.senderUplink == x.senderUplink && y.receiverUplink == x.receiverUplink; });
                                        Object.assign(x, lps[0], js[0], ms[0]);
            
                                        if ('networkId' in vpnStats[i]) {
                                            x.networkId = vpnStats[i].networkId;
                                        }
                                        if ('networkName' in vpnStats[i]) {
                                            x.networkName = vpnStats[i].networkName;
                                        }
            
                                        if ('networkId' in vpnStats[i].merakiVpnPeers[u]) {
                                            x.peerNetworkId = vpnStats[i].merakiVpnPeers[u].networkId;
                                        }
                                        if ('networkName' in vpnStats[i].merakiVpnPeers[u]) {
                                            x.peerNetworkName = vpnStats[i].merakiVpnPeers[u].networkName;
                                        }
            
                                        return x;
                                    });
                                }
                            }
                        }
                    }
                }
            
            
            } catch (error) {
                error_msg = error;
            };
            
            return JSON.stringify({
                'vpnStats': result,
                'error': error_msg.toString()
            });
          description: 'Item for gathering all the vpn stats of the organization.'
          timeout: 30s
          parameters:
            -
              name: token
              value: '{$MERAKI.TOKEN}'
            -
              name: url
              value: '{$MERAKI.API.URL}'
            -
              name: organizationId
              value: '{$ID}'
            -
              name: httpproxy
              value: '{$MERAKI.HTTP_PROXY}'
          tags:
            -
              tag: component
              value: raw
        -
          uuid: a5106f644c4e46fc963cc953dafaeb4e
          name: 'Meraki: VPN item errors'
          type: DEPENDENT
          key: meraki.get.vpn.stats.errors
          delay: '0'
          history: 7d
          trends: '0'
          value_type: TEXT
          description: 'Item for gathering all the vpn item errors.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.error
            -
              type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: meraki.get.vpn.stats
          tags:
            -
              tag: component
              value: error
          triggers:
            -
              uuid: f65ff582e1a84f5a9e9d6a9c0501b013
              expression: 'length(last(/Cisco Meraki organization by HTTP/meraki.get.vpn.stats.errors))>0'
              name: 'Meraki: There are errors in ''Get VPNs'' metric'
              priority: WARNING
              tags:
                -
                  tag: scope
                  value: availability
        -
          uuid: bd6eca7b707a4bee8e2302765afa6074
          name: 'Meraki: License expire'
          type: DEPENDENT
          key: meraki.license.expire
          delay: '0'
          history: 7d
          value_type: FLOAT
          units: s
          description: 'Meraki license expire time in seconds left.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.expirationDate
            -
              type: JAVASCRIPT
              parameters:
                - |
                  function parseDate(date) {
                      months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
                      date = date.split(',');
                      date[1] = date[1].match(/[0-9]{4}/)[0];
                      date = date.concat(date[0].split(' '));
                      month = 1 + months.indexOf(date[2]);
                      return Date.parse(date[1] + "-" + month + "-" + date[3]);
                  }
                  
                  if (value === "N/A") {
                      return -1;
                  } else {
                      value = parseDate(value);
                      now = Date.now();
                      return Math.floor((value - now) / 1000);
                  }
          master_item:
            key: meraki.get.licenses
          tags:
            -
              tag: component
              value: license
          triggers:
            -
              uuid: 8694c7fc18904004978a3ce46f06a67e
              expression: 'last(/Cisco Meraki organization by HTTP/meraki.license.expire)<{$MERAKI.LICENSE.EXPIRE} and last(/Cisco Meraki organization by HTTP/meraki.license.expire)>=0'
              name: 'Meraki: License expires in less than {$MERAKI.LICENSE.EXPIRE} seconds'
              priority: WARNING
              tags:
                -
                  tag: scope
                  value: availability
        -
          uuid: 2b8e2c4093074dbaa88db3df57eb2cd1
          name: 'Meraki: License status'
          type: DEPENDENT
          key: meraki.license.status
          delay: '0'
          history: 7d
          description: 'Meraki license status.'
          valuemap:
            name: 'License status'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.status
            -
              type: JAVASCRIPT
              parameters:
                - |
                  switch (value) {
                      case 'License Required':
                          return 0
                      case 'OK':
                          return 1
                      default:
                          return 10
                  }
          master_item:
            key: meraki.get.licenses
          tags:
            -
              tag: component
              value: license
          triggers:
            -
              uuid: d4f71dd53bf8495789b53e063db3555b
              expression: 'last(/Cisco Meraki organization by HTTP/meraki.license.status)<>1'
              name: 'Meraki: License status is not OK'
              priority: WARNING
              tags:
                -
                  tag: scope
                  value: availability
        -
          uuid: e18f69d27fcb4b949d5744aebef97ffb
          name: 'Meraki: Policies'
          type: DEPENDENT
          key: meraki.policies
          delay: '0'
          history: 7d
          description: 'Meraki adaptive policies count.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.counts.policies
          master_item:
            key: meraki.get.adaptive.policy
          tags:
            -
              tag: component
              value: policy
        -
          uuid: 8a8369134eff4153aba32d9c435786f3
          name: 'Meraki: Allow policies'
          type: DEPENDENT
          key: meraki.policies.allow
          delay: '0'
          history: 7d
          description: 'Meraki adaptive allow policies count.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.counts.allowPolicies
          master_item:
            key: meraki.get.adaptive.policy
          tags:
            -
              tag: component
              value: policy
        -
          uuid: f85b33412a2a41b39c33d64f3c641232
          name: 'Meraki: Custom ACLs'
          type: DEPENDENT
          key: meraki.policies.custom.acls
          delay: '0'
          history: 7d
          description: 'Meraki adaptive policy custom ACLs count.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.counts.customAcls
          master_item:
            key: meraki.get.adaptive.policy
          tags:
            -
              tag: component
              value: policy
        -
          uuid: 8b9e13124628460584668dbe5cd1b92b
          name: 'Meraki: Deny policies'
          type: DEPENDENT
          key: meraki.policies.deny
          delay: '0'
          history: 7d
          description: 'Meraki adaptive deny policies count.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.counts.denyPolicies
          master_item:
            key: meraki.get.adaptive.policy
          tags:
            -
              tag: component
              value: policy
        -
          uuid: a4918ea4d6954b5f829e5533117c109a
          name: 'Meraki: Groups'
          type: DEPENDENT
          key: meraki.policies.groups
          delay: '0'
          history: 7d
          description: 'Meraki adaptive policy groups count.'
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.counts.groups
          master_item:
            key: meraki.get.adaptive.policy
          tags:
            -
              tag: component
              value: policy
      discovery_rules:
        -
          uuid: 03d6aeb2bc3d473b9aab87acd0e08f8c
          name: 'Uplinks discovery'
          type: DEPENDENT
          key: meraki.uplinks.discovery
          delay: '0'
          item_prototypes:
            -
              uuid: 7600f662dd044d1f857a6ffd9898277c
              name: 'Uplink [{#INTERFACE}]: [{#UPLINK.ROLE}]: [{#NETWORK.NAME}]: status'
              type: DEPENDENT
              key: 'meraki.uplink.status[{#NETWORK.NAME}, {#INTERFACE}, {#UPLINK.ROLE}]'
              delay: '0'
              history: 7d
              description: 'Network uplink status.'
              valuemap:
                name: 'Uplink status'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$.uplinks[?(@.networkName== ''{#NETWORK.NAME}'' && @.interface== ''{#INTERFACE}'' && @.role== ''{#UPLINK.ROLE}'' )].status.first()'
                -
                  type: JAVASCRIPT
                  parameters:
                    - |
                      switch (value) {
                          case 'failed':
                              return 0
                          case 'active':
                              return 1
                          case 'ready':
                              return 2
                          case 'not connected':
                              return 3
                          default:
                              return 10
                      }
              master_item:
                key: meraki.get.networks
              tags:
                -
                  tag: component
                  value: network
                -
                  tag: component
                  value: uplink
                -
                  tag: interface
                  value: '{#INTERFACE}'
                -
                  tag: network
                  value: '{#NETWORK.NAME}'
                -
                  tag: serial-number
                  value: '{#UPLINK.DEVICE.SERIAL}'
              trigger_prototypes:
                -
                  uuid: b1f3cbb8f3024c3f8cd6a8eaf7a5df52
                  expression: 'last(/Cisco Meraki organization by HTTP/meraki.uplink.status[{#NETWORK.NAME}, {#INTERFACE}, {#UPLINK.ROLE}])=0'
                  name: 'Uplink [{#INTERFACE}]: [{#UPLINK.ROLE}]: [{#NETWORK.NAME}]: status is failed'
                  priority: WARNING
                  tags:
                    -
                      tag: scope
                      value: availability
          master_item:
            key: meraki.get.networks
          timeout: 30s
          lld_macro_paths:
            -
              lld_macro: '{#INTERFACE}'
              path: $.interface
            -
              lld_macro: '{#NETWORK.NAME}'
              path: $.networkName
            -
              lld_macro: '{#PRIVATE.IP}'
              path: $.ip
            -
              lld_macro: '{#PUBLIC.IP}'
              path: $.publicIp
            -
              lld_macro: '{#UPLINK.DEVICE.SERIAL}'
              path: $.serial
            -
              lld_macro: '{#UPLINK.ROLE}'
              path: $.role
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.uplinks
        -
          uuid: 34052749bd3c46fd9083d738ddeee216
          name: 'VPN stats discovery'
          type: DEPENDENT
          key: meraki.vpn.stats.discovery
          delay: '0'
          item_prototypes:
            -
              uuid: 6e38c9538ad4489ea08b6d21fc8a8bd3
              name: 'VPN [{#NETWORK.NAME}][{#SENDER.UPLINK}]=>[{#PEER.NETWORK.NAME}][{#RECEIVER.UPLINK}]: jitter avg'
              type: DEPENDENT
              key: 'meraki.vpn.stat.jitter.avg[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              delay: '0'
              history: 7d
              description: 'VPN connection jitter avg.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.avgJitter
              master_item:
                key: 'meraki.vpn.stat.raw[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              tags:
                -
                  tag: component
                  value: vpn
            -
              uuid: c676fc71415d4e199f257f165fc56163
              name: 'VPN [{#NETWORK.NAME}][{#SENDER.UPLINK}]=>[{#PEER.NETWORK.NAME}][{#RECEIVER.UPLINK}]: jitter max'
              type: DEPENDENT
              key: 'meraki.vpn.stat.jitter.max[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              delay: '0'
              history: 7d
              description: 'VPN connection jitter max.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.maxJitter
              master_item:
                key: 'meraki.vpn.stat.raw[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              tags:
                -
                  tag: component
                  value: vpn
            -
              uuid: c0d392d7ca2b42df9a967ffb2dcfa80d
              name: 'VPN [{#NETWORK.NAME}][{#SENDER.UPLINK}]=>[{#PEER.NETWORK.NAME}][{#RECEIVER.UPLINK}]: jitter min'
              type: DEPENDENT
              key: 'meraki.vpn.stat.jitter.min[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              delay: '0'
              history: 7d
              description: 'VPN connection jitter min.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.minJitter
              master_item:
                key: 'meraki.vpn.stat.raw[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              tags:
                -
                  tag: component
                  value: vpn
            -
              uuid: 6f56db10935641b0bf416ae3402ddb17
              name: 'VPN [{#NETWORK.NAME}][{#SENDER.UPLINK}]=>[{#PEER.NETWORK.NAME}][{#RECEIVER.UPLINK}]: latency avg'
              type: DEPENDENT
              key: 'meraki.vpn.stat.latency.avg[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              delay: '0'
              history: 7d
              units: ms
              description: 'VPN connection avg latency.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.avgLatencyMs
              master_item:
                key: 'meraki.vpn.stat.raw[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              tags:
                -
                  tag: component
                  value: vpn
            -
              uuid: 626ca25322e9413ca0e5bee2c8760c73
              name: 'VPN [{#NETWORK.NAME}][{#SENDER.UPLINK}]=>[{#PEER.NETWORK.NAME}][{#RECEIVER.UPLINK}]: latency max'
              type: DEPENDENT
              key: 'meraki.vpn.stat.latency.max[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              delay: '0'
              history: 7d
              units: ms
              description: 'VPN connection max latency.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.maxLatencyMs
              master_item:
                key: 'meraki.vpn.stat.raw[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              tags:
                -
                  tag: component
                  value: vpn
            -
              uuid: 56a0ea96051a4b45af7db3da1af3e4a4
              name: 'VPN [{#NETWORK.NAME}][{#SENDER.UPLINK}]=>[{#PEER.NETWORK.NAME}][{#RECEIVER.UPLINK}]: latency min'
              type: DEPENDENT
              key: 'meraki.vpn.stat.latency.min[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              delay: '0'
              history: 7d
              units: ms
              description: 'VPN connection min latency.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.minLatencyMs
              master_item:
                key: 'meraki.vpn.stat.raw[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              tags:
                -
                  tag: component
                  value: vpn
            -
              uuid: a56018615c9540b58b8b074ccc8a05bd
              name: 'VPN [{#NETWORK.NAME}][{#SENDER.UPLINK}]=>[{#PEER.NETWORK.NAME}][{#RECEIVER.UPLINK}]: loss avg, %'
              type: DEPENDENT
              key: 'meraki.vpn.stat.loss.avg[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: '%'
              description: 'VPN connection loss avg.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.avgLossPercentage
              master_item:
                key: 'meraki.vpn.stat.raw[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              tags:
                -
                  tag: component
                  value: vpn
            -
              uuid: 7dccf9e43d944c37934a1dded9999756
              name: 'VPN [{#NETWORK.NAME}][{#SENDER.UPLINK}]=>[{#PEER.NETWORK.NAME}][{#RECEIVER.UPLINK}]: loss max, %'
              type: DEPENDENT
              key: 'meraki.vpn.stat.loss.max[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: '%'
              description: 'VPN connection loss max.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.maxLossPercentage
              master_item:
                key: 'meraki.vpn.stat.raw[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              tags:
                -
                  tag: component
                  value: vpn
            -
              uuid: eb835ef592a24e43bc918c4299b9f6e7
              name: 'VPN [{#NETWORK.NAME}][{#SENDER.UPLINK}]=>[{#PEER.NETWORK.NAME}][{#RECEIVER.UPLINK}]: loss min, %'
              type: DEPENDENT
              key: 'meraki.vpn.stat.loss.min[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              units: '%'
              description: 'VPN connection loss min.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.minLossPercentage
              master_item:
                key: 'meraki.vpn.stat.raw[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              tags:
                -
                  tag: component
                  value: vpn
            -
              uuid: 1f26cdd09e5f45da9e8b0e679faa3425
              name: 'VPN [{#NETWORK.NAME}][{#SENDER.UPLINK}]=>[{#PEER.NETWORK.NAME}][{#RECEIVER.UPLINK}]: mos avg'
              type: DEPENDENT
              key: 'meraki.vpn.stat.mos.avg[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              description: 'VPN connection mos avg.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.avgMos
              master_item:
                key: 'meraki.vpn.stat.raw[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              tags:
                -
                  tag: component
                  value: vpn
            -
              uuid: bf28a0ead40046c8b08399775836be4e
              name: 'VPN [{#NETWORK.NAME}][{#SENDER.UPLINK}]=>[{#PEER.NETWORK.NAME}][{#RECEIVER.UPLINK}]: mos max'
              type: DEPENDENT
              key: 'meraki.vpn.stat.mos.max[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              description: 'VPN connection mos max.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.maxMos
              master_item:
                key: 'meraki.vpn.stat.raw[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              tags:
                -
                  tag: component
                  value: vpn
            -
              uuid: 9fee72321a23448983bd6cac7803600c
              name: 'VPN [{#NETWORK.NAME}][{#SENDER.UPLINK}]=>[{#PEER.NETWORK.NAME}][{#RECEIVER.UPLINK}]: mos min'
              type: DEPENDENT
              key: 'meraki.vpn.stat.mos.min[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              delay: '0'
              history: 7d
              value_type: FLOAT
              description: 'VPN connection mos min.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - $.minMos
              master_item:
                key: 'meraki.vpn.stat.raw[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              tags:
                -
                  tag: component
                  value: vpn
            -
              uuid: 2c968e21c8a34c73a17ed0fc4e2756b5
              name: 'VPN [{#NETWORK.NAME}]=>[{#PEER.NETWORK.NAME}]: stats raw'
              type: DEPENDENT
              key: 'meraki.vpn.stat.raw[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
              delay: '0'
              history: '0'
              trends: '0'
              value_type: TEXT
              description: 'VPN connection stats raw.'
              preprocessing:
                -
                  type: JSONPATH
                  parameters:
                    - '$.vpnStats[?(@.networkId==''{#NETWORK.ID}'' && @.senderUplink==''{#SENDER.UPLINK}'' && @.peerNetworkId==''{#PEER.NETWORK.ID}'' && @.receiverUplink==''{#RECEIVER.UPLINK}'')].first()'
              master_item:
                key: meraki.get.vpn.stats
              tags:
                -
                  tag: Application
                  value: Meraki
          graph_prototypes:
            -
              uuid: 0794dc9d06844ee89099322f60382fc7
              name: 'VPN [{#NETWORK.NAME}][{#SENDER.UPLINK}]=>[{#PEER.NETWORK.NAME}][{#RECEIVER.UPLINK}]: jitter'
              ymin_type_1: FIXED
              graph_items:
                -
                  color: 1A7C11
                  item:
                    host: 'Cisco Meraki organization by HTTP'
                    key: 'meraki.vpn.stat.jitter.avg[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
                -
                  sortorder: '1'
                  color: 2774A4
                  item:
                    host: 'Cisco Meraki organization by HTTP'
                    key: 'meraki.vpn.stat.jitter.max[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
                -
                  sortorder: '2'
                  color: F63100
                  item:
                    host: 'Cisco Meraki organization by HTTP'
                    key: 'meraki.vpn.stat.jitter.min[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
            -
              uuid: dd05787b5e0e4b4b870258b25c1a0503
              name: 'VPN [{#NETWORK.NAME}][{#SENDER.UPLINK}]=>[{#PEER.NETWORK.NAME}][{#RECEIVER.UPLINK}]: latency'
              ymin_type_1: FIXED
              graph_items:
                -
                  color: 1A7C11
                  item:
                    host: 'Cisco Meraki organization by HTTP'
                    key: 'meraki.vpn.stat.latency.avg[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
                -
                  sortorder: '1'
                  color: 2774A4
                  item:
                    host: 'Cisco Meraki organization by HTTP'
                    key: 'meraki.vpn.stat.latency.max[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
                -
                  sortorder: '2'
                  color: F63100
                  item:
                    host: 'Cisco Meraki organization by HTTP'
                    key: 'meraki.vpn.stat.latency.min[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
            -
              uuid: c0ff7a5798cd4aa181223763d8962229
              name: 'VPN [{#NETWORK.NAME}][{#SENDER.UPLINK}]=>[{#PEER.NETWORK.NAME}][{#RECEIVER.UPLINK}]: loss'
              ymin_type_1: FIXED
              graph_items:
                -
                  color: 1A7C11
                  item:
                    host: 'Cisco Meraki organization by HTTP'
                    key: 'meraki.vpn.stat.loss.avg[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
                -
                  sortorder: '1'
                  color: 2774A4
                  item:
                    host: 'Cisco Meraki organization by HTTP'
                    key: 'meraki.vpn.stat.loss.max[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
                -
                  sortorder: '2'
                  color: F63100
                  item:
                    host: 'Cisco Meraki organization by HTTP'
                    key: 'meraki.vpn.stat.loss.min[{#NETWORK.ID}, {#SENDER.UPLINK}, {#PEER.NETWORK.ID}, {#RECEIVER.UPLINK}]'
          master_item:
            key: meraki.get.vpn.stats
          timeout: 30s
          lld_macro_paths:
            -
              lld_macro: '{#NETWORK.ID}'
              path: $.networkId
            -
              lld_macro: '{#NETWORK.NAME}'
              path: $.networkName
            -
              lld_macro: '{#PEER.NETWORK.ID}'
              path: $.peerNetworkId
            -
              lld_macro: '{#PEER.NETWORK.NAME}'
              path: $.peerNetworkName
            -
              lld_macro: '{#RECEIVER.UPLINK}'
              path: $.receiverUplink
            -
              lld_macro: '{#SENDER.UPLINK}'
              path: $.senderUplink
          preprocessing:
            -
              type: JSONPATH
              parameters:
                - $.vpnStats
      tags:
        -
          tag: class
          value: network
        -
          tag: target
          value: cisco-meraki-dashboard
      macros:
        -
          macro: '{$MERAKI.API.URL}'
          value: api.meraki.com/api/v1
          description: 'Cisco Meraki Dashboard API URL. e.g api.meraki.com/api/v1'
        -
          macro: '{$MERAKI.CONFIG.CHANGE.TIMESPAN}'
          value: '1200'
          description: 'Timespan for gathering config change log. Used in metric config and in URL query.'
        -
          macro: '{$MERAKI.HTTP_PROXY}'
          description: 'HTTP proxy for API requests. You can specify it using the format [protocol://][username[:password]@]proxy.example.com[:port]. See documentation at https://www.zabbix.com/documentation/6.4/manual/config/items/itemtypes/http'
        -
          macro: '{$MERAKI.LICENSE.EXPIRE}'
          value: '86400'
          description: 'Time in seconds for license to expire.'
        -
          macro: '{$MERAKI.TOKEN}'
          type: SECRET_TEXT
          description: 'Cisco Meraki Dashboard API Token.'
      valuemaps:
        -
          uuid: af92df09c58c4c9287fe294b7b90e193
          name: 'License status'
          mappings:
            -
              value: '0'
              newvalue: 'License Required'
            -
              value: '1'
              newvalue: OK
            -
              value: '10'
              newvalue: unknown
        -
          uuid: e16992443a614d81a7f4186622709971
          name: 'Uplink status'
          mappings:
            -
              value: '0'
              newvalue: failed
            -
              value: '1'
              newvalue: active
            -
              value: '2'
              newvalue: ready
            -
              value: '3'
              newvalue: 'not connected'
            -
              value: '10'
              newvalue: unknown