Duplicate items of the same "itemid" and "description" will be shown multiple times (one for each group) when in configuration of items and when the host and associated templates are in the same host_group. The same item will be display several times.
For example:
In items.php there is a left join on hosts_groups causing the duplicate items to show up on the screen. Fix is as follows:
For example:
- Create a Child template with items and add it to group "TEST"
- Create a Parent Template with the Child template attached and add it to group "TEST"
- Create a host and attach the Parent Template to the host and add the host to group "TEST"
- Now go to configuration of the host items and you will see duplicate copies of the same item and key.
In items.php there is a left join on hosts_groups causing the duplicate items to show up on the screen. Fix is as follows:
Code:
diff -ruN zabbix-original/frontends/php/items.php zabbix/frontends/php/items.php
--- zabbix-original/frontends/php/items.php 2009-02-20 00:41:22.000000000 -0500
+++ zabbix/frontends/php/items.php 2009-02-20 02:02:23.000000000 -0500
@@ -995,13 +995,13 @@
$from_tables['i'] = 'items i'; /* NOTE: must be added as last element to use left join */
- $sql = 'SELECT DISTINCT th.host as template_host,th.hostid as template_hostid, h.host, h.hostid, hgg.groupid, i.* '.
- ' FROM '.implode(',', $from_tables).
- ' LEFT JOIN items ti ON i.templateid=ti.itemid '.
- ' LEFT JOIN hosts th ON ti.hostid=th.hostid '.
- ' LEFT JOIN hosts_groups hgg ON hgg.hostid=th.hostid '.
- ' WHERE '.implode(' AND ', $where_case).
- order_by('h.host,i.description,i.key_,i.delay,i.history,i.trends,i.type,i.status','i.itemid');
+ $sql = 'SELECT DISTINCT th.host as template_host,th.hostid as template_hostid, h.host, h.hostid, i.* '.
+ ' FROM '.implode(',', $from_tables).
+ ' LEFT JOIN items ti ON i.templateid=ti.itemid '.
+ ' LEFT JOIN hosts th ON ti.hostid=th.hostid '.
+ ' WHERE '.implode(' and ', $where_case).
+ order_by('h.host,i.description,i.key_,i.delay,i.history,i.trends,i.type,i.status','i.itemid');
+
$db_items = DBselect($sql);
while($db_item = DBfetch($db_items)){
$description = array();
Were registered as ZBX-710.
Comment