Ad Widget

Collapse

Zabbix 1.5.1 (5638)- Dashboard and Application Groups Personal Profile

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aly
    ZABBIX developer
    • May 2007
    • 1126

    #16
    Already committed rev. 5697
    Zabbix | ex GUI developer

    Comment

    • Palmertree
      Senior Member
      • Sep 2005
      • 746

      #17
      Thanks. I will test and let you know my results.

      Comment

      • Palmertree
        Senior Member
        • Sep 2005
        • 746

        #18
        Aly, the fix works like a champ. Good work.

        Comment

        • Palmertree
          Senior Member
          • Sep 2005
          • 746

          #19
          This is sorta minor but I just thought I would mention this. If a user goes to latest data and selects a group and host and goes to the dashboard and back to latest data, the user is taken back to the group and host that they last selected previously. If a user goes and clicks on a graph that is in their favorites under the dashboard, the group and host id are reset back to all. Maybe this is by design. I wonder if the group and host should be saved with the favorites so that group=all and host=all do not get selected. When you have a lot of Hosts, Group-All and Host-all takes almost 30 secs to a minute for the screen to come up for latest data. Sorry for being so picky.

          Comment

          • Aly
            ZABBIX developer
            • May 2007
            • 1126

            #20
            I'll try to figure out something here.
            Zabbix | ex GUI developer

            Comment

            • Palmertree
              Senior Member
              • Sep 2005
              • 746

              #21
              Thanks Aly. Just an idea. I wonder if there is a way to select the first available group and available host instead of "All" but keep "All" in the list so that users will be able to select it if they want to. Here is something I did with latest data that seems to work pretty good. Also, thought about using something like this when selecting graph items too when making custom graphs.


              Code:
              diff -ruN zabbix-original/frontends/php/latest.php zabbix/frontends/php/latest.php
              --- zabbix-original/frontends/php/latest.php    2008-04-30 04:03:14.000000000 -0400
              +++ zabbix/frontends/php/latest.php     2008-05-12 08:57:22.000000000 -0400
              @@ -50,7 +50,7 @@
                      check_fields($fields);
                      validate_sort_and_sortorder('i.description',ZBX_SORT_UP);
              
              -       $options = array("allow_all_hosts","monitored_hosts","with_monitored_items");//,"always_select_first_host");
              +       $options = array("allow_all_hosts","monitored_hosts","with_monitored_items","always_select_first_host");
                      if(!$ZBX_WITH_SUBNODES) array_push($options,"only_current_node");
              
                      validate_group_with_host(PERM_READ_ONLY,$options);
              @@ -97,14 +97,56 @@
              
                      $r_form->AddVar("select",$_REQUEST["select"]);
              
              +       $available_groups= get_accessible_groups_by_user($USER_DETAILS,PERM_READ_LIST);
              +       $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_LIST);
              +
              +        $result=DBfetch(DBselect('SELECT DISTINCT g.groupid,g.name '.
              +                                        ' FROM groups g, hosts_groups hg, hosts h, items i '.
              +                                        ' WHERE g.groupid in ('.$available_groups.') '.
              +                                                ' AND hg.groupid=g.groupid '.
              +                                                ' AND h.status='.HOST_STATUS_MONITORED.
              +                                                ' AND h.hostid=i.hostid '.
              +                                                ' AND hg.hostid=h.hostid '.
              +                                                ' AND i.status='.ITEM_STATUS_ACTIVE.
              +                                        ' ORDER BY g.name'.
              +                                        ' LIMIT 1'));
              +
              +        if(str_in_array("always_select_first_host",$options) && $_REQUEST["groupid"] == 0)
              +          $_REQUEST["groupid"] = $result["groupid"];
              +
              +        if($_REQUEST['groupid'] > 0){
              +                 $sql='SELECT DISTINCT h.hostid,h.host '.
              +                         ' FROM hosts h,items i,hosts_groups hg '.
              +                         ' WHERE h.status='.HOST_STATUS_MONITORED.
              +                                 ' AND h.hostid=i.hostid '.
              +                                 ' AND hg.groupid='.$_REQUEST['groupid'].
              +                                 ' AND hg.hostid=h.hostid'.
              +                                 ' AND i.status='.ITEM_STATUS_ACTIVE.
              +                                 ' AND h.hostid in ('.$available_hosts.') '.
              +                         ' ORDER BY h.host'.
              +                         ' LIMIT 1';
              +        }
              +        else{
              +                 $sql='SELECT DISTINCT h.hostid,h.host '.
              +                         ' FROM hosts h,items i '.
              +                         ' WHERE h.status='.HOST_STATUS_MONITORED.
              +                                 ' AND i.status='.ITEM_STATUS_ACTIVE.
              +                                 ' AND h.hostid=i.hostid'.
              +                                 ' AND h.hostid in ('.$available_hosts.') '.
              +                         ' ORDER BY h.host'.
              +                         ' LIMIT 1';
              +        }
              +
              +        $result=DBfetch(DBselect($sql));
              +
              +        if(str_in_array("always_select_first_host",$options) && $_REQUEST["hostid"] == 0)
              +          $_REQUEST["hostid"] = $result["hostid"];
              +
                      $cmbGroup = new CComboBox("groupid",$_REQUEST["groupid"],"submit()");
                      $cmbHosts = new CComboBox("hostid",$_REQUEST["hostid"],"submit()");
              
                      $cmbGroup->AddItem(0,S_ALL_SMALL);
                      $cmbHosts->AddItem(0,S_ALL_SMALL);
              -
              -       $available_groups= get_accessible_groups_by_user($USER_DETAILS,PERM_READ_LIST);
              -       $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_LIST);
              
                      $result=DBselect('SELECT DISTINCT g.groupid,g.name '.
                                                      ' FROM groups g, hosts_groups hg, hosts h, items i '.
              @@ -220,12 +262,12 @@
                                                      order_by('h.host,h.hostid','a.name,a.applicationid'));
              
                      while($db_app = DBfetch($db_applications)){
              -               $db_items = DBselect('SELECT DISTINCT i.* '.
              -                                       ' FROM items i,items_applications ia'.
              -                                       ' WHERE ia.applicationid='.$db_app['applicationid'].
              -                                               ' AND i.itemid=ia.itemid'.
              -                                               ' AND i.status='.ITEM_STATUS_ACTIVE.
              -                                       order_by('i.description,i.itemid,i.lastclock'));
              +                $db_items = DBselect('SELECT DISTINCT i.itemid,i.description,i.lastclock,i.key_,i.lastvalue,i.prevvalue,i.value_type,i.units,i.valuemapid '.
              +                                        ' FROM items i,items_applications ia'.
              +                                        ' WHERE ia.applicationid='.$db_app['applicationid'].
              +                                                ' AND i.itemid=ia.itemid'.
              +                                                ' AND i.status='.ITEM_STATUS_ACTIVE.
              +                                        order_by('i.description,i.itemid,i.lastclock'));
              
                              $app_rows = array();
                              $item_cnt = 0;

              Comment

              • Aly
                ZABBIX developer
                • May 2007
                • 1126

                #22
                If you select hosts all groups all, it will be remembered. But on the first enter to latest data screens, first group and host will be selected. rev. 5713
                Zabbix | ex GUI developer

                Comment

                • Palmertree
                  Senior Member
                  • Sep 2005
                  • 746

                  #23
                  Thanks Aly. That is great news. :-) I will tested and let you know how it turns out.

                  Comment

                  Working...