Ad Widget

Collapse

Version Pre 1.7.0 Build 6763 -- Configuration -> Items -- Duplicate Items Displayed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Palmertree
    Senior Member
    • Sep 2005
    • 746

    #1

    Version Pre 1.7.0 Build 6763 -- Configuration -> Items -- Duplicate Items Displayed

    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:
    1. Create a Child template with items and add it to group "TEST"
    2. Create a Parent Template with the Child template attached and add it to group "TEST"
    3. Create a host and attach the Parent Template to the host and add the host to group "TEST"
    4. Now go to configuration of the host items and you will see duplicate copies of the same item and key.
    Fix:
    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();
  • Aly
    ZABBIX developer
    • May 2007
    • 1126

    #2
    This problem were due to duplicated entries in hosts_groups after import Were registered as ZBX-710.
    Zabbix | ex GUI developer

    Comment

    Working...