-
Problem report
-
Resolution: Fixed
-
Critical
-
5.4.6
-
None
-
Sprint 82 (Nov 2021), Sprint 83 (Dec 2021)
-
0.25
Have an export file with 2 hosts assigned to different proxies.
Importing this file fails with error:
Proxy "1st test" for host "one" does not exist. [zabbix.php:22 → require_once() → ZBase->run() → ZBase->processRequest() → CController->run() → CControllerPopupImport->doAction() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → CConfiguration->import() → CConfigurationImport->import() → CConfigurationImport->processHosts() → CHostImporter->import() → CHostImporter->resolveHostReferences() in include/classes/import/importers/CHostImporter.php:63]
This wrong SQL is generated during import. Note "AND" in list of proxy names:
SELECT h.hostid,h.host FROM hosts h WHERE h.status IN (5,6) AND ((UPPER(h.host) LIKE '%1ST TEST%' ESCAPE '!' AND UPPER(h.host) LIKE '%2ND TEST%' ESCAPE '!'))
(also, I'm not sure is this ok to use % around names. why not an exact match is used?)
Here is proposed patch:
--- ui/include/classes/import/CImportReferencer.php 2021-10-25 13:42:22.862473343 +0200 +++ ui/include/classes/import/CImportReferencer.php.new 2021-10-25 13:42:16.234474134 +0200 @@ -1405,6 +1405,7 @@ $this->db_proxies = API::Proxy()->get([ 'output' => ['host'], 'search' => ['host' => array_keys($this->proxies)], + 'searchByAny' => true, 'preservekeys' => true ]);
- caused by
-
ZBXNEXT-6411 New uniqueness criteria for template elements
- Closed