[ZBX-4407] Cannot import 1.8 template to 1.9 Created: 2011 Nov 29  Updated: 2017 May 30  Resolved: 2012 Jun 13

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 1.9.8 (beta)
Fix Version/s: 1.9.9 (beta)

Type: Incident report Priority: Major
Reporter: Marcel Hecko Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: comma, import
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

apache2.2



 Description   

Error in item key: "Invalid item key format.". when importing template/host with item of type "simple", key "tcp,1520"
after changing the comma to another character, the import works fine



 Comments   
Comment by Alexander Sorokin (Inactive) [ 2011 Nov 30 ]

Version 1.9 has new key format. You need to change keys manually.

Comment by Igor Danoshaites (Inactive) [ 2011 Nov 30 ]

More info about these changes are available here: http://www.zabbix.com/documentation/2.0/manual/config/items/itemtypes/4_simple_checks

Comment by richlv [ 2011 Nov 30 ]

awwww. we just have to support 1.8 xml as an absolute minimum, otherwise most templates would be unusable.

db upgrade patch converts such keys - frontend xml legacy import code (for 1.8) must convert those keys in the exact same way

Comment by Alexander Sorokin (Inactive) [ 2011 Dec 08 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-4407

Comment by richlv [ 2011 Dec 08 ]

(1) it changes (which is great) :
$host_db['profile_mode'] = isset($host_db['profile']) ? HOST_PROFILE_MANUAL : HOST_PROFILE_DISABLED;
$host_db['profile_mode'] = isset($host_db['profile']) ? HOST_INVENTORY_MANUAL : HOST_INVENTORY_DISABLED;

but maybe should also change profile_mode and "profile" ?

<pavels> I think $host_db['profile_mode'] should be changed to $host_db['inventory_mode'], but double check it please.

<sanja> RESOLVED

<richlv> i believe "isset($host_db['profile'])" should also be changed to 'inventory', but it should be doublechecked

<sanja> RESOLVED

<richlv>
// HOST PROFILES {{

{ ... // }

}} HOST PROFILES

<sanja> RESOLVED

<pavels> It's great that we fixed the notice, but profile data import doesn't work at all. Please, have a look.
<richlv> i split this out as (6)

<richlv> this is where i'd like to refer to DeepC presentation slides again
it would help us all if we all would try to understand what the issue is and fix it fully, properly and finally. in this case we did an issue pingpong for "profile_mode" and "profile" separately. then another round for "HOST PROFILES" - in this case it was even visible in the diff context for the two previous changes.

as such i would like to suggest using svn diff, and attempt to fix the issue so nobody could come and point at things missed (like i'm doing now )
i was ready to split out remaining renames in another issue, but as pavel noted that profile import doesn't work, let's do it here instead.

so instead of pointing at specific instances, let's just remove any reference to host profiles (except for 1.8 xml format, of course). please note that we shouldn't nuke user profiles in any way

<pavels> Yeah, that's I meant by "double check it please" =) I haven't tested the fix since then, so I've noticed the problem just now. Anyway, CLOSED.

<richlv> as discussed, let's be pedantic enough and clear this up completely
as in, no references to host profile should be anywhere in the code, they all should refer to "inventory" except 1.8 xml fields

<sanja> Can not find any references! Maybe You have found some before reopening this issue?

<richlv> there might be more that i missed, but here's one file with them :

./include/maps.inc.php: $hostsToGetProfiles = array();
./include/maps.inc.php: // if we have icon map applied, we need to get profiles for all hosts,
./include/maps.inc.php: $hostsToGetProfiles[] = $selement['elementid'];
./include/maps.inc.php: 'hostids' => $hostsToGetProfiles,
./include/maps.inc.php: $profiles = getHostInventories();

<sanja> Fixed that and 1 more.
RESOLVED

Comment by richlv [ 2011 Dec 08 ]

(2) function convertOldSimpleKey seems to be defined both in class.ctriggerexpression.php and export.inc.php - that scares me a bit... wouldn't it be better to define it only once ?

<pavels> Yes, that's very very wrong. Since this conversion is required only when importing, I suggest we move it into a protected method of zbxXML class and only perform the conversion there. Plus, it shouldn't be done when creating new triggers in the trunk, only when importing old ones.

<sanja> RESOLVED

<pavels> CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2011 Dec 09 ]

(4) Regarding in class.ctriggerexpression.php:235. I know we sometimes use references in foreach loops, but mostly in simple loops where we just need to perform some modifications on the arrays, like unsetting some keys. In more complex loops like this one, it's best not to use references, as it may cause unexpected problems.

<sanja> RESOLVED

<pavels> CLOSED.

Comment by richlv [ 2011 Dec 21 ]

(5) "Converts Simle key"
i also believe "$keyWithotPerf" is a typo
export.inc.php has lost trailing newline

<sanja> RESOLVED

<richlv> CLOSED

Comment by richlv [ 2011 Dec 22 ]

(6) <pavels> It's great that we fixed the notice, but profile data import doesn't work at all. Please, have a look.

<sanja> RESOLVED

<pavels> The new line character should be "\r\n" to work properly on mac and windows. And there are no name conflicts between host profile fields, so we don't need to combine them there. I've corrected it, please review r24209 and r24210. Otherwise, good.

<sanja> CLOSED

Comment by Pavels Jelisejevs (Inactive) [ 2011 Dec 23 ]

TESTED.

Before merging, please close (6).

Comment by richlv [ 2011 Dec 23 ]

we got a workflow problem here

rev 24216 merged this dev branch to trunk already, but rev 24221 did changes in the dev branch after that. these changes will be lost.

dev branch should be deleted, recreated, changes from rev 24221 reapplied and problem (1) fully fixed

<sanja> RESOLVED

<Sasha> REOPENED
in a new recreated branch no changes from a deleted ' svn di svn://svn.zabbix.com/branches/dev/ZBX-4407@24225 -c24221 ' branch

<sanja> RESOLVED

<Sasha> CLOSED

Pavels, please retest its branch. There are some changes.

Comment by Pavels Jelisejevs (Inactive) [ 2011 Dec 30 ]

TESTED again. Everything ok.

Comment by richlv [ 2012 Feb 11 ]

reopen to set proper "fix version"

Generated at Tue Apr 23 21:31:18 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.