[ZBX-10325] Import of host prototypes is not working Created: 2016 Jan 29  Updated: 2017 May 30  Resolved: 2016 Feb 02

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 3.0.0beta1
Fix Version/s: 3.0.0rc1

Type: Incident report Priority: Critical
Reporter: Alexander Vladishev Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: hostprototypes, xml
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

C20ImportConverter module deletes all host prototypes. The method convertDiscoveryRules() has an error in the code:

if (!array_key_exists('st_prototypes', $discovery_rule)) { 
    $discovery_rule['host_prototypes'] = [];               
}                                                          

array_key_exists() checks for incorrect key 'st_prototypes'



 Comments   
Comment by Alexander Vladishev [ 2016 Jan 30 ]

Resolved in development branch svn://svn.zabbix.com/branches/dev/ZBX-10325 r58102.

Comment by Alexander Vladishev [ 2016 Jan 30 ]

(1) PHP error when host:key pair is invalid in tags:

../graph/ymin_item_key
../graph/ymax_item_key
../graph_elements/graph_elementN/item

frontends/php/include/classes/import/converters/C10ImportConverter.php:722
Undefined offset: 1

sasha RESOLVED in r58103

oleg.egorov CLOSED

Comment by Alexander Vladishev [ 2016 Jan 30 ]

(2) String changes:

Strings added:

  • "host:key" pair is expected
  • an empty string is expected

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2016 Feb 01 ]

(3) Undefined index if empty ymin_item_key

Part of graph XML

<ymin_type>2</ymin_type>
<ymin_item_key></ymin_item_key>

Result:

Undefined index: key [conf.import.php:173 → CFrontendApiWrapper->import() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CConfiguration->import() → CImportDataAdapter->load() → CConverterChain->convert() → C20ImportConverter->convert() → C20ImportConverter->convertGraphs() in include\classes\import\converters\C20ImportConverter.php:323]
Undefined index: host [conf.import.php:173 → CFrontendApiWrapper->import() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CConfiguration->import() → CConfigurationImport->import() → CConfigurationImport->gatherReferences() in include\classes\import\CConfigurationImport.php:298]
Undefined index: host [conf.import.php:173 → CFrontendApiWrapper->import() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CConfiguration->import() → CConfigurationImport->import() → CConfigurationImport->gatherReferences() in include\classes\import\CConfigurationImport.php:298]
Undefined index: host [conf.import.php:173 → CFrontendApiWrapper->import() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CConfiguration->import() → CConfigurationImport->import() → CConfigurationImport->gatherReferences() in include\classes\import\CConfigurationImport.php:299]
Updated: Item "item" on "1.8_new".
Undefined index: host [conf.import.php:173 → CFrontendApiWrapper->import() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CConfiguration->import() → CConfigurationImport->import() → CConfigurationImport->processGraphs() in include\classes\import\CConfigurationImport.php:1198]
Undefined index: host [conf.import.php:173 → CFrontendApiWrapper->import() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CConfiguration->import() → CConfigurationImport->import() → CConfigurationImport->processGraphs() in include\classes\import\CConfigurationImport.php:1205]
Cannot find item "" on "" used as the Y axis MIN value for graph "Graph normal_min_max". [conf.import.php:173 → CFrontendApiWrapper->import() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CConfiguration->import() → CConfigurationImport->import() → CConfigurationImport->processGraphs() in include\classes\import\CConfigurationImport.php:127]

oleg.egorov RESOLVED by sasha in r58137

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2016 Feb 01 ]

(4) Please review minor coding style improvement in r58152, r58153

sasha Many thanks! CLOSED

Comment by Oleg Egorov (Inactive) [ 2016 Feb 01 ]

TESTED
But please close (4) before merge

Comment by Alexander Vladishev [ 2016 Feb 02 ]

Fixed in pre-3.0.0rc1 r58181.

Generated at Thu Apr 25 04:05:07 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.