XML export/import in 2.0
(ZBX-4867)
[ZBX-3531] Export/import basic functionality Created: 2011 Feb 14 Updated: 2012 Apr 11 Resolved: 2012 Apr 11 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Frontend (F) |
Affects Version/s: | 1.9.2 (alpha) |
Fix Version/s: | 2.0.0rc1 |
Type: | Sub-task | Priority: | Blocker |
Reporter: | Oleksii Zagorskyi | Assignee: | Alexey Fukalov |
Resolution: | Fixed | Votes: | 12 |
Labels: | xml | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
trunk rev 17688 |
Attachments: | export.inc.php.patch template1b-cut7.xml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Issue Links: |
|
Description |
Try to export a template or host - see to the XML. Specs: http://zabbix.org/wiki/Docs/specs/ZBX-3531 |
Comments |
Comment by justin phelps [ 2011 Apr 09 ] |
I've found this bug too. I've converted the old Zapcat Java_Template to the new jmx format. |
Comment by Alexey Serba [ 2011 Aug 09 ] |
Is there any workaround to make export template feature work in 1.9.4? |
Comment by richlv [ 2011 Aug 10 ] |
no, at this time xml export is not available in trunk |
Comment by Alexey Serba [ 2011 Aug 10 ] |
|
Comment by richlv [ 2011 Aug 10 ] |
1. not really anyway, it's alpha software... did you have any cats ? |
Comment by Alexey Serba [ 2011 Aug 10 ] |
Has Export/Import XML format changed with 2.0 release? If I manually generate XML file in 1.8.x format would Import work? |
Comment by richlv [ 2011 Aug 10 ] |
last i tried importing 1.8 xml format worked in trunk |
Comment by Alexey Serba [ 2011 Aug 16 ] |
Here's attached patch for export.inc.php script to fix export template feature (tested in 1.9.4). It seems the problem is that XML export class is expecting hosts attribute for items, but API::Item is returning hostid. I'm not sure if it's proper long term fix or if it breaks some other functionality, but it works for me. Attaching it in case others struggling with this bug and desperately waiting for some workaround. |
Comment by Oleksii Zagorskyi [ 2011 Aug 16 ] |
Alexey, regarding to your patch "export.inc.php.patch" maybe you are wrong in your last comment? |
Comment by Alexey Serba [ 2011 Nov 29 ] |
I'm not an expert in Zabbix codebase but with applied attached patch "export template" feature was working correctly in 1.9.4 - $item['hosts'] = zbx_toHash($item['hosts'], 'hostid'); - if(isset($item['hosts'][$host['hostid']])){ + #$item['hosts'] = zbx_toHash($item['hosts'], 'hostid'); + if(isset($item['hostid']) && $item['hostid'] == $host['hostid']){ So there's "hostid" mapping in "$item" hash map instead of "hosts". |
Comment by Alexei Vladishev [ 2011 Dec 19 ] |
A new XML specification document: http://zabbix.org/wiki/Docs/specs/ZBX-3531 |
Comment by Igor Danoshaites (Inactive) [ 2012 Feb 28 ] |
(1). "ERROR: Import failed" when importing xml with trigger dependencies in it. Details: Created: Trigger "1trigger1" on "FULL_TEST2". Dependency is defined in the following way: <dependency> >10</expression> <Vedmak> RESOLVED |
Comment by Alexey Fukalov [ 2012 Feb 28 ] |
(2). When trying to export network map is created xml file with the following content: Fatal error</b>: Call to undefined function prepareMapExport() in <b>C:\Program Files\Xampp\xampp\htdocs\Zabbix\ <Vedmak> RESOLVED |
Comment by Alexey Fukalov [ 2012 Feb 28 ] |
(3). When importing screen appears message "Imported successfully", but in the details are visible the following errors: Details Error in query [SELECT t.screenitemid,si.screenid FROM screens_items t WHERE (si.screenid IN ('2')) ] [Unknown column 'si.screenid' in 'field list'] <Vedmak> RESOLVED |
Comment by Igor Danoshaites (Inactive) [ 2012 Feb 28 ] |
(4). Error when trying to import netw map: ERROR: Import failed <Vedmak> this should be already fixed, is this in last branch revision? <CLOSED> |
Comment by Igor Danoshaites (Inactive) [ 2012 Feb 29 ] |
(5) Not a bug, but ... improvement Would be nice to have button for unchecking all checkboxes (maybe 2 buttons- one for "Update existing" and second for "Add missing" group of checkboxes) in the import form. Now we have 20 checkboxes in the Import form and by default all of them (except "Images" buttons) are checked. Yesteday Vedmak proposed the following idea: by default uncheck all checkboxes and let user to choose what to import by checking the appropriate checkbox. <Vedmak> RESOLVED <Igor> CLOSED, has been implemented several checkboxes in the import form for hosts, host groups, templates, items, triggers, etc and separately for "update existing" and "add missing" actions. |
Comment by Igor Danoshaites (Inactive) [ 2012 Feb 29 ] |
(6). When trying to import template with items, triggers, graphs, screens and discovery rules in it, finally on the screen will be visible "Imported successfully", will be created items, triggers, graphs, screens, but: (6.1). Discovery rules will be not created (but they are defined in the xml file (if required, I can provide such xml file for validation); dev branch rev # 25682. <Vedmak> RESOLVED <Igor> OK, now this is resolved, but item/trigger/graph prototypes are still not exported (they does not exist in the result xml) when exporting template, as a result are exported only items, triggers, graphs, screens, discovery rules without item & trigger & graph prototypes. <Vedmak> RESOLVED <Igor> Sorry, but in dev branch rev #25695 this is still not working, for me there are NO item/trigger/graph prototypes in discovery rule after importing such template. (as discussed, this occurs in case when there is also one more empty drule, without prototypes and in the export xml file will be only this empty discovery rule). <Vedmak> ye, there was problem, strange i couldn't reproduce it earlier, RESOLVED <Igor> Nice, now this is working fine! CLOSED |
Comment by Igor Danoshaites (Inactive) [ 2012 Feb 29 ] |
(7). ERROR: Import failed Details: Cannot find icon "open_source" for map "map2_in_host". How to reproduce: Import previously exported map with icon image inside it, then delete this image and map from the Zabbix config. <Vedmak> Were "Images" checkboxes checked in import form? <Igor> Yes, seems that I forgot to select these checkboxes. Now double checked - it is working fine, icon images and bgimages are imported/exported fine. <Igor> CLOSED |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 01 ] |
(8). ERROR: Cannot add trigger Details: =10". Occurs when trying to add trigger prototype to the second discovery rule in template. <Igor> OK, the same problem is in trunk (rev 25720) and there is already created ZBX issue for this problem: Closing this problem nr. 8. <Igor> CLOSED |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 01 ] |
(9). ERROR: Import failed This error occurs when trying to import only graphs (in the import form has been selected only "graphs") and using previously created export file for hosts. <Vedmak> RESOLVED <Igor> CLOSED (both for hosts and templates) |
Comment by Sergey Syreskin [ 2012 Mar 01 ] |
Error message should be more descriptive. |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 02 ] |
(10). ERROR: Import failed Error appears when trying to import xml file with exported screen "screen1" that contains another screen "Zabbix server" inside it. <Vedmak> RESOLVED <Igor> CLOSED |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 02 ] |
(11). ERROR: Import failed This error occur when trying to import screen in which there is map from another host and also in case when there are graphs/simple graphs from the same /another host. <Vedmak> RESOLVED <Igor> CLOSED |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 02 ] |
(12). ERROR: Import failed Error occurs because map "map3" does not exist any more (has been deleted from the config). In xml file there are no configuration of that map "map3". The same problem also appears for screens: when in one screen there is another screen, will appear the following error: ERROR: Import failed <Igor> For this problem has been created separate issue |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 05 ] |
(13). When importing xml file from 1.8 (v.1.8.9rc1) to 2.0, in the Details appears the following message: Imported successfully In the result host and template has not been created. <Igor> CLOSED, there was no such template on the destination host. |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 05 ] |
(14). When importing xml file from 1.8 (v.1.8.9rc1) into 1.9.10 appears the following error: ERROR: Import failed <Vedmak> RESOLVED <Igor> CLOSED, this occurred when importing IPMI items. |
Comment by Pavels Jelisejevs (Inactive) [ 2012 Mar 05 ] |
(15) I think the calls to CItemGeneral::checkExistingItems() should be moved from createReal() to checkInput() <Vedmak> agree, RESOLVED <pavels> I don't think we need two separate methods, it can be implemented in one. Just check if the passed item has an "itemid" field, if it does - check that it's itemid is different from the existing items. See CUserMacro::checkIfHostMacrosDontRepeat() as an example. <Vedmak> RESOLVED <pavels> CLOSED. |
Comment by Pavels Jelisejevs (Inactive) [ 2012 Mar 05 ] |
(16) The new code really needs more comments. <pavels> A couple of "TODO: comment:" comments left in CConfigurationExport.php <Vedmak> RESOLVED <pavels> CLOSED. |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 06 ] |
(17). After importing xml file with value mappings from 1.8.9rc1 into 1.9.10, value mapping will be not created, but in the exported xml file value mapping exists. <Vedmak> in 1.8 we have incorrect value map reference, export has real db id which is incorrect. From 2.0 -> 2.0 should work. <Igor> Import / export 2.0->2.0 with valuemaps is working fine. In v1.8.x we need to fix issue devoted to valuemaps in v1.8.x: |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 06 ] |
(18). Screen import 1.8 ->2.0: ERROR: Import failed In the xml file there are really no "hostgroupid" element. <Igor> Fixed in trunk, CLOSED |
Comment by Pavels Jelisejevs (Inactive) [ 2012 Mar 06 ] |
(19) the CXmlImportReader::read() method has old translation strings. <Vedmak> RESOLVED <pavels> CLOSED |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 07 ] |
(20). Does not directly relates to import/export, BUT in dev branch But in trunk branch can check / un-check this button and save screen configuration, but in trunk in the result xml file there are NO parameter "dynamic" at all. Similar to <Igor> In the latest trunk rev #25871, option "Dynamic item" always will be checked, not possible to uncheck it. Problem with screen cell config form. This will be fixed in trunk under the issue |
Comment by Pavels Jelisejevs (Inactive) [ 2012 Mar 07 ] |
(21) CConfigurationImport::processImages() performs API result checks which are unnecessary since we are expecting the API to throw exceptions. <Vedmak> RESOLVED <pavels> CLOSED. |
Comment by Pavels Jelisejevs (Inactive) [ 2012 Mar 07 ] |
(22) Shouldn't icon maps and other stuff be resolved through the CImportReferencer instead of plain API calls in CConfigurationImport::processMaps() <Vedmak> RESOLVED <pavels> CLOSED. |
Comment by Pavels Jelisejevs (Inactive) [ 2012 Mar 07 ] |
(23) Shouldn't there be something under the SYSMAP_ELEMENT_TYPE_IMAGE case in CConfigurationImport::processMaps()? <Vedmak> No, it shouldn't be there at all RESOLVED <pavels> CLOSED. |
Comment by Pavels Jelisejevs (Inactive) [ 2012 Mar 07 ] |
(24) I think "missed" and "exists" is a poor choice for option names, it's really unclear what they mean when you look at the code. I suggest you rename them to "add" and "update" respectfully. <Vedmak> "add" and "update" are not much better imo, because it's not clear what will be added and what updated. Probably best would be "addMissing" "updateExisting", what do you think? <pavels> Yes, that will work too. <Vedmak> RESOLVED <pavels> CLOSED. |
Comment by Pavels Jelisejevs (Inactive) [ 2012 Mar 07 ] |
(25) Shouldn't CConfigurationImport::processTemplateScreens() check for screen options before saving the objects? <Vedmak> added separate rules for template screens <pavels> The "template_screens", "discoveryrules" and "template_linkages" options should be converted to camel case. <Vedmak> RESOLVED <pavels> CLOSED. |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 07 ] |
(26). Now, when using rev #25859 from dev branch ERROR: Import failed Illegal offset type [include\classes\import\CConfigurationImport.php:242] <Vedmak> RESOLVED <Igor> CLOSED |
Comment by Pavels Jelisejevs (Inactive) [ 2012 Mar 07 ] |
(27) CConfigurationExportBuilder::formatMacros() should use order_macros() instead of order_result() for sorting macros. May this problems occurs in some other places as well. <Vedmak> RESOLVED <pavels> CLOSED. |
Comment by Pavels Jelisejevs (Inactive) [ 2012 Mar 07 ] |
(28) I guess the old export code can be removed from zbxXML. <Vedmak> RESOLVED <pavels> You could also me zbxXML to a separate file. <pavels> CLOSED. |
Comment by Pavels Jelisejevs (Inactive) [ 2012 Mar 07 ] |
(29) The ArrayHelper class should be moved to a separate file in the include/classes/helpers folder. <Vedmak> RESOLVED <pavels> CLOSED. |
Comment by Pavels Jelisejevs (Inactive) [ 2012 Mar 07 ] |
(30) CConfigurationImport::import() should now throw Exceptions inside a try/catch clause. <Vedmak> RESOLVED <pavels> CLOSED. |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 08 ] |
(31) ERROR: Import failed Details: Error occurs when trying to import template with jmx item (T_jmx:jmx[“java.lang:type=Memory”,”HeapMemoryUsage.used”]) second time. <Vedmak> RESOLVED <Igor> CLOSED, can not reproduce such error any more. |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 08 ] |
(32) New problem appears when trying to update item in the template linked to the host: ERROR: Cannot update item Details: <Vedmak> RESOLVED <Igor> CLOSED |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 08 ] |
(33) Error "Undefined index: templates [include\classes\class.cpagefilter.php:206]" in the bottom of the Conf->Hosts->Triggers page after updating trigger in the template, but trigger has been updated successfully. <Vedmak> RESOLVED <Igor> CLOSED, but appeared new problem, please see below |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 08 ] |
(34) Warning "Use of undefined constant S_GRAPHS_BIG - assumed 'S_GRAPHS_BIG' [graphs.php:405]" in the bottom of the Configuration->Templates->Graphs report, also after "Configuration of graphs" record appears non-replaced valuable: S_GRAPHS_BIG <Vedmak> RESOLVED <Igor> CLOSED |
Comment by richlv [ 2012 Mar 09 ] |
(35) i'd suggest changing "Template linkages" to "Template linkage" - this word doesn't sound too well in plural, and the plural here isn't really needed <Vedmak> RESOLVED <richlv> CLOSED |
Comment by richlv [ 2012 Mar 09 ] |
(36) invalid input file gets me "Incorrect import reader type." - if that's our message, can we make it somewhat... more meaningful ? <Vedmak> RESOLVED <richlv> apparently resolution was changing the message to something like : CLOSED |
Comment by richlv [ 2012 Mar 09 ] |
(37) dev branch rev 25917. see https://support.zabbix.com/secure/attachment/18321/template1b-cut7.xml <Vedmak> Strange, for me in latest revision it gives message "Item [Template_Windows2:network[3]] does not exists.". <Igor> For me the same "Item "Template_Windows2:network[3]" does not exists." error when trying to import this template. <Vedmak> btw you have <richlv> oh, nice catch. i'd suggest messages that tell where the invalid item reference was found. any other location i missed ? (feel free to adapt the messages to our style / better grammar ) <richlv> ok, after some discussion with Vedmak, new suggestions : <richlv> see (38), CLOSED |
Comment by richlv [ 2012 Mar 09 ] |
(38) see (37). error messages like these should provide context information - in this case, if we had both triggers and custom graphs in an xml, we wouldn't know which type is causing this message. the message should print out at least the context where we are encountering the data that it doesn't like. <richlv> split out as |
Comment by richlv [ 2012 Mar 09 ] |
(39) agent items in the exported xml still have things like allowed_hosts, snmp parameters, username/password, key and maybe other incorrect fields looks like all exported item fields should be reviewed <Vedmak> All fields should be reviewed, but we decided that at first step we export everything. RESOLVED <richlv> split out as |
Comment by richlv [ 2012 Mar 09 ] |
(40) documentation <richlv> split out as |
Comment by richlv [ 2012 Mar 09 ] |
(41) 'No icon for map element "New element"' - trailing dot is missing <Vedmak> RESOLVED <richlv> CLOSED |
Comment by richlv [ 2012 Mar 09 ] |
development branch is svn://svn.zabbix.com/dev/ZBX-3531 |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 09 ] |
(42) When deleting graph from the host: Deleted: Graph "graph1" on "test_ But in the result graph has been deleted. <Vedmak> RESOLVED <Igor> CLOSED |
Comment by Pavels Jelisejevs (Inactive) [ 2012 Mar 09 ] |
(43) In CConfigurationImport replace static variables with object properties. <Vedmak> RESOLVED <pavels> CLOSED. |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 09 ] |
(44) When importing xml with host configuration with valuemap definition, appears the following error: (can be visible in the "Details" of the import process, although import was successful, host has been created, but value map has not been created): Undefined index: valuemap [include\classes\import\CConfigurationImport.php:695] <Vedmak> RESOLVED <Igor> CLOSED |
Comment by Alexey Fukalov [ 2012 Mar 13 ] |
svn://svn.zabbix.com/trunk 26002 |
Comment by Igor Danoshaites (Inactive) [ 2012 Mar 13 ] |
(45). At this moment (trunk rev #26007), after merging src files from this DEV branch to the trunk branch, exported files do not have correct names. <Vedmak> RESOLVED <Igor> CLOSED, now in dev branch we will have files with names like zbx_export_hosts.xml, zbx_export_templates.xml, zbx_export_screens.xml, zbx_export_maps.xml. |
Comment by Alexey Fukalov [ 2012 Mar 13 ] |
(46) [GUI] <Vedmak> RESOLVED <Igor> CLOSED, now there are no anymore undefined index errors In Conf->Actions report. |
Comment by richlv [ 2012 Mar 19 ] |
there are several still open sub-problems, reopening |
Comment by richlv [ 2012 Mar 21 ] |
(47) S_GRAPH_TEMPLATE_HOST_CANNOT_OTHER_ITEMS_HOSTS_SMALL was removed from the old english locale file, but it's still used in api/classes/CGraphPrototype.php <Vedmak> fixed in rev. 26318. <richlv> CLOSED |
Comment by richlv [ 2012 Mar 21 ] |
(48) S_GRAPH_ITEM was removed from the old english locale file, but it's still used in popup_gitem.php <Vedmak> fixed in rev. 26318. <richlv> CLOSED |
Comment by richlv [ 2012 Apr 10 ] |
remaining subproblems have been split out in new issues, closing |
Comment by Alexey Fukalov [ 2012 Apr 11 ] |
Reopen to rename issue. |