File tree Expand file tree Collapse file tree 2 files changed +34
-9
lines changed
Expand file tree Collapse file tree 2 files changed +34
-9
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,6 @@ import a Zabbix v3.2 template into Zabbix v2.0.
77The script works by applying conversion rules to a template, which manipulate
88the template XML to match the desired Zabbix version template format.
99
10- To convert a Zabbix 3.2 template for import into v2.0:
11-
12- $ zabbix-template-convertor -o 2.0 my_template.xml > my_template-2.0.xml
13-
1410__ WARNING__ : This project is still under active development and not ready for
1511 release.
1612
@@ -35,6 +31,37 @@ optional arguments:
3531```
3632
3733
34+ ## Example
35+
36+ To convert a Zabbix 3.2 template for import into v2.0:
37+
38+ $ zabbix-template-convertor -o 2.0 my_template.xml > my_template-2.0.xml
39+
40+ A number of transformations will take place. For example, Discovery Rule
41+ filters will be downgraded from the multiple-filter format introduced in Zabbix 2.4, to a single filter expression as follows:
42+
43+ ``` xml
44+ <filter >
45+ <evaltype >0</evaltype >
46+ <formula />
47+ <conditions >
48+ <condition >
49+ <macro >{#IFNAME}</macro >
50+ <value >@Network interfaces for discovery</value >
51+ <operator >8</operator >
52+ <formulaid >A</formulaid >
53+ </condition >
54+ </conditions >
55+ </filter >
56+ ```
57+
58+ Becomes:
59+
60+ ``` xml
61+ <filter >{#IFNAME}:@Network interfaces for discovery</filter >
62+ ```
63+
64+
3865## Coverage
3966
4067This project relies heavily on the community to report incompatability problems
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import xml.etree.ElementTree as ET
33import argparse
44import re
55
6- __version__ = '1.1 .0'
6+ __version__ = '1.0 .0'
77
88# parse cmdline args
99parser = argparse .ArgumentParser (description = 'Migrate Zabbix templates between versions' )
@@ -168,7 +168,7 @@ class FixDiscoveryRuleFilters(ConversionRule):
168168
169169 elif len (conditions ) > 1 :
170170 # multi-filter has too many conditions
171- warn ('filter for discovery rule \' %s\' has multiple conditions and cannot be converted - dropping' % discovery_rule_name )
171+ warn ('Filter for discovery rule \' %s\' has multiple conditions and cannot be converted - dropping' % discovery_rule_name )
172172 node .clear ()
173173
174174 else :
@@ -231,12 +231,10 @@ class FixSNMPDiscovery(ConversionRule):
231231 m = re .search (r"^discovery\[(.*?,)([^,\]]+)" , node .text )
232232 if m is not None and len (m .groups ()) == 2 :
233233 node .text = m .group (2 )
234- if node .text .startswith ('disc' ):
235- warn (node .text )
236234 else :
237235 raise ValueError ('Unrecognised SNMP OID for discovery rule \' %s\' ' % discovery_rule .findtext ('name' ))
238236
239- class FixTriggerPrototypesDependencies (ConversionRule ):
237+ class FixTriggerPrototypeDependencies (ConversionRule ):
240238 """
241239 Rule to ensure trigger prototype dependencies are not exported before 2.5.0.
242240 See: ZBXNEXT-1229
You can’t perform that action at this time.
0 commit comments