[ZBX-19815] XML files exported with 2.0, 2.2 doesn't work for import in Zabbix 5.0 Created: 2021 Aug 16  Updated: 2024 Apr 10  Resolved: 2022 Jan 25

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 5.0.14
Fix Version/s: 5.0.20rc1, 5.4.10rc1, 6.0.0beta3, 6.0 (plan)

Type: Problem report Priority: Trivial
Reporter: Kim Jongkwon Assignee: Ivo Kurzemnieks
Resolution: Fixed Votes: 0
Labels: import/export
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: XML File template-minified.xml     XML File zbx_export_templates_TEST_ITEM_2.0.xml     XML File zbx_export_templates_TEST_ITEM_2.2.xml    
Issue Links:
Duplicate
Team: Team B
Sprint: Sprint 79 (Aug 2021), Sprint 80 (Sep 2021), Sprint 81 (Oct 2021), Sprint 82 (Nov 2021), Sprint 83 (Dec 2021), Sprint 84 (Jan 2022)
Story Points: 5

 Description   

XML Import tag validation in Zabbix 5.0 prevented the import of old XML.

Zabbix Versions: from => to

  • 2.0.21 => 5.0.14
    Invalid tag "/zabbix_export/templates/template(1)/items/item(1)": the tag "snmpv3_contextname" is missing. [conf.import.php:89 → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → CConfiguration->import() → CXmlValidator->validate() → C30XmlValidator->validate() → CXmlValidatorGeneral->doValidate() → CXmlValidatorGeneral->doValidateRecursive() → CXmlValidatorGeneral->doValidateRecursive() → CXmlValidatorGeneral->doValidateRecursive() → CXmlValidatorGeneral->doValidateRecursive() → CXmlValidatorGeneral->doValidateRecursive() in include/classes/import/validators/CXmlValidatorGeneral.php:205]
    
  • 2.2.0 => 5.0.14
    Invalid tag "/zabbix_export/templates/template(1)/items/item(1)": the tag "logtimefmt" is missing. [conf.import.php:89 → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → CConfiguration->import() → CXmlValidator->validate() → C30XmlValidator->validate() → CXmlValidatorGeneral->doValidate() → CXmlValidatorGeneral->doValidateRecursive() → CXmlValidatorGeneral->doValidateRecursive() → CXmlValidatorGeneral->doValidateRecursive() → CXmlValidatorGeneral->doValidateRecursive() → CXmlValidatorGeneral->doValidateRecursive() in include/classes/import/validators/CXmlValidatorGeneral.php:205]
    

(To 3.0.28, 4.0.26 is work )

Zabbix 5.0 documentation describes the "Version compatibility" of XML import:

Supported XML files
XML files, exported with 1.8, 2.0, 2.2, 2.4, 3.0, 3.2, 3.4, 4.0, 4.2 and 4.4 are supported for import in Zabbix 5.0.


 Comments   
Comment by Edgar Akhmetshin [ 2021 Aug 17 ]

Hello Kim,

Thank you for reporting the issue. Reproduced.

Regards,
Edgar

Comment by Ivo Kurzemnieks [ 2021 Sep 16 ]

Additional import problems were found.
For 4.0 import fixed only small issue with importing v1.8 files:
RESOLVED in feature/ZBX-19815-4.0
For 5.0 import (and this fix can be applied to 5.4+ as well) fixed multitude of issues including the one that was reported:
RESOLVED in feature/ZBX-19815-5.0

Fixed:

  • Fixed 1.8, 2.0 -> 4.0, 5.0 version import of IPMI IP field had DNS name instead of IP in the field;
  • fixed 1.8 -> 5.0 version import with no value maps assigned to items;
  • fixed 1.8 -> 5.0 version import with no proxies assigned to host;
  • fixed 1.8 -> 5.0 version import when SNMP items lost their references;
  • fixed 1.8 -> 5.0 version import with hosts and templates mixed up (import hosts in templates and vice versa);
  • fixed 2.0 -> 5.0 version import of SNMP v3 fields "snmpv3_contextname", "snmpv3_authprotocol", "snmpv3_privprotocol" and "logtimefmt" field;
  • fixed 2.0 -> 5.0 version import of unsupported LLD rules from 2.0 which resulted in undefined offsets;
  • fixed 2.0 -> 5.0 version import of templated screens;
  • partially fixed 2.0 -> 5.0 version import of SNMP trap items using same SNMP interfaces as SNMPv1, SNMPv2 or SNMPv3 items.

What is not fixed:

  • 1.8 import will still not fully work. In 4.0 one reason is that if items have value maps. They are not exported along with items. The destination DB IDs in could mismatch and import will fail with SQL errors. In 5.0 "valuemapid" is converted to "name". And since most likely there is no such value map with a numeric name that matches the ID, import will fail. This goes also to "proxy_hostid". It is also converted to name;
  • the 2.0 import to currently supported releases also will not work due to same reason - if user has assigned custom value maps to items. Or even built in "Host status" value map wich was renamed in 3.0 to "Host availability". And due to renaming it is not possible to import to latest fresh install versions;
  • the 2.0 import to latest versions is also unsupported because in 2.0 there were added few new LLD rule types, but in 2.2 they were removed. Now importing such rules, will result in error, since we cannot determine if this is intentionally broken XML or legitimate old version;
  • import from 3.2 to latest versions will not work if invalid web scenario variables and/or headers are given. They must follow a specific syntax, otherwise the import will fail;
  • importing anything less than 5.0 can result in many SNMP interfaces created. Even if item and item prototype previously used same interface, after importing to 5.0 there will be created two interfaces one for item, the other for item prototype. Assume this is how it's supposed to be;
  • multitude of other issues that will be reported separately as this task has grown out of scope:
    ZBX-19965, ZBX-19966, ZBX-19967, ZBX-19968. Each of the reported issues could contain more errors, since system stops on first available exception.

The issues mentioned above are not documented and will not be documented.

Comment by Ivo Kurzemnieks [ 2022 Jan 10 ]

Fixed in:

Generated at Sat Apr 12 08:41:26 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.