Hi Eli:

Good eye.

I have incorporated your patch and made an additional modification.
Previously if your meta sort order is "by down host:" and then you
click on a cluster, it would sort it by ascending order (I guess since
"ascending" is the first sort order).  Now I catch this and change the
sort order to descending (which is the default).

Please try this new patch if you have time.

If I do not hear any other comments by the end of the week, I will
commit this to trunk.

Thanks!

Bernard

On 4/6/07, Eli Stair <[EMAIL PROTECTED]> wrote:

Works fine for me, nice thoughtful hack for the grid view.

The only suggestion, and initial source of my confusion, would be to exclude 
this
from being present in the cluster-view sort menu.  Unless I'm being daft again, 
it
seems to have no effect on cluster sorting, and restricting it to 'meta' context
kicks it out of the spot where it has no effect (and does nothing else wrong 
that I
can see).

If header.php is modified like this is seems cleaner to me (attached):

> --- header.php.PRE-DOWNHOSTPATCH        2007-04-06 15:08:24.000000000 -0700
> +++ header.php  2007-04-06 15:26:45.000000000 -0700
> @@ -285,6 +285,13 @@
>        $tpl->assign("metric_menu", $metric_menu );
>     }
>
> +#
> +# Show sort order options for meta/grid context only:
> +#
> +if ($context == "meta" )
> +   {
> +      $context_sorts[]="by down host";
> +   }
>
>  #
>  # Show sort order if there is more than one physical machine present.


/eli




Bernard Li wrote:
> Hi Eli:
>
> It is quite possible that that was the behaviour from a while back,
> but as far as I can remember this has been the behaviour (downed hosts
> are shown up top).
>
> Anyways, if you have multiple data_sources in your grid, I would
> appreciate it if you can help me test it out and give me any feedback
> :-)
>
> Thanks,
>
> Bernard
>
> On 4/6/07, Eli Stair <[EMAIL PROTECTED]> wrote:
>  >
>  > I swear it used to be necessary to show a host as down, rather than
> just not
>  > displaying it.  It doesn't appear to be the case in at least 3.0.3+
> anymore, so
>  > perhaps I've been perpetuating something needlessly/false onto a
> public list. D'oh.
>  >
>  > Weird, suffice it for the moment to say that I can't explain anymore
> why I'm doing
>  > that ;)  Apparently the only thing missing is from my brain.
>  >
>  > /eli
>  >
>  >
>  > Bernard Li wrote:
>  > > Hi Eli:
>  > >
>  > > My patch actually does not change the behaviour of the cluster view,
>  > > only for grid (or "meta") view.  AFAIK in cluster view, by default
>  > > downed hosts always show up at the top of the list.
>  > >
>  > > Or am I missing something here? ;-)
>  > >
>  > > Thanks,
>  > >
>  > > Bernard
>  > >
>  > > On 4/6/07, Eli Stair <[EMAIL PROTECTED]> wrote:
>  > >  >
>  > >  > Cool, we hackily comment out the if $hosts_down ... return line in
>  > > host_view.php,
>  > >  > so they pop to the top of any host-view of a cluster.
>  > >  >
>  > >  > /eli
>  > >  >
>  > >  > > # No reason to go on if this node is down.
>  > >  > > if ($hosts_down)
>  > >  > >    {
>  > >  > >       $tpl->printToScreen();
>  > >  > >       return;
>  > >  > >    }
>  > >  > > */
>  > >  >
>  > >  >
>  > >  > Bernard Li wrote:
>  > >  > > Dear all:
>  > >  > >
>  > >  > > The attached patch adds a new option for the grid "Sorted"
> menu called
>  > >  > > "by down host" which will sort the list of
> data_sources/cluster by the
>  > >  > > number of hosts down (sources with most downed hosts are on top).
>  > >  > >
>  > >  > > I will check this into SVN trunk after folks had a chance to
> review.
>  > >  > >
>  > >  > > Comments are welcome.
>  > >  > >
>  > >  > > Thanks,
>  > >  > >
>  > >  > > Bernard
>  > >  > >
>  > >  > > On 3/16/07, Bernard Li <[EMAIL PROTECTED]> wrote:
>  > >  > >  > Hi guys:
>  > >  > >  >
>  > >  > >  > Currently if you have a grid with many different sources,
> it is not
>  > >  > >  > immediately obvious which data_source has hosts that are
> down (the
>  > >  > >  > summary section tells you there are n nodes down, but you
> have to
>  > >  > >  > scroll through the entire page to find which data_source
> has nodes
>  > >  > >  > that are down).
>  > >  > >  >
>  > >  > >  > Would it be helpful to have a new sort order that lets you
> sort by
>  > >  > >  > host down (obviously the data_source that has downed nodes
> will show
>  > >  > >  > up first?)
>  > >  > >  >
>  > >  > >  > Cheers,
>  > >  > >  >
>  > >  > >  > Bernard
>  > >  > >  >
>  > >  > >
>  > >  > >
>  > >  > >
>  > >
> ------------------------------------------------------------------------
>  > >  > >
>  > >  > > Index: web/meta_view.php
>  > >  > >
> ===================================================================
>  > >  > > --- web/meta_view.php (revision 756)
>  > >  > > +++ web/meta_view.php (working copy)
>  > >  > > @@ -43,11 +43,16 @@
>  > >  > >  }
>  > >  > >  else if ($sort == "by hostname") {
>  > >  > >         ksort($sorted_sources);
>  > >  > > -}
>  > >  > > -else {
>  > >  > > +} else if ($sort == "by down host") {
>  > >  > > +      foreach ($sorted_sources as $source => $val) {
>  > >  > > +            $sorted_sources[$source] =
>  > > intval($grid[$source]['HOSTS_DOWN']);
>  > >  > > +      }
>  > >  > > +      arsort($sorted_sources);
>  > >  > > +} else {
>  > >  > >        asort($sorted_sources);
>  > >  > >  }
>  > >  > >
>  > >  > > +
>  > >  > >  # Display the sources. The first is ourself, the rest are our
>  > > children.
>  > >  > >  foreach ( $sorted_sources as $source => $val )
>  > >  > >     {
>  > >  > > Index: web/header.php
>  > >  > >
> ===================================================================
>  > >  > > --- web/header.php    (revision 756)
>  > >  > > +++ web/header.php    (working copy)
>  > >  > > @@ -294,6 +294,7 @@
>  > >  > >        $context_sorts[]="ascending";
>  > >  > >        $context_sorts[]="descending";
>  > >  > >        $context_sorts[]="by hostname";
>  > >  > > +      $context_sorts[]="by down host";
>  > >  > >
>  > >  > >        $sort_menu = "<B>Sorted</B>&nbsp;&nbsp;"
>  > >  > >           ."<SELECT NAME=\"s\"
> OnChange=\"ganglia_form.submit();\">\n";
>  > >  > >
>  > >  > >
>  > >  > >
>  > >
> ------------------------------------------------------------------------
>  > >  > >
>  > >  > >
>  > >
> -------------------------------------------------------------------------
>  > >  > > Take Surveys. Earn Cash. Influence the Future of IT
>  > >  > > Join SourceForge.net's Techsay panel and you'll get the chance to
>  > > share your
>  > >  > > opinions on IT & business topics through brief surveys-and
> earn cash
>  > >  > >
>  > >
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>
>  > >
> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> <http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>>
>  > >  > >
>  > >  > >
>  > >  > >
>  > >
> ------------------------------------------------------------------------
>  > >  > >
>  > >  > > _______________________________________________
>  > >  > > Ganglia-developers mailing list
>  > >  > > Ganglia-developers@lists.sourceforge.net
>  > >  > > https://lists.sourceforge.net/lists/listinfo/ganglia-developers
>  > >  >
>  > >  >
>  > >
>  >
>  >
>



Index: meta_view.php
===================================================================
--- meta_view.php	(revision 756)
+++ meta_view.php	(working copy)
@@ -43,8 +43,12 @@
 }
 else if ($sort == "by hostname") {
 	  ksort($sorted_sources);
-}
-else {
+} else if ($sort == "by down host") {
+      foreach ($sorted_sources as $source => $val) {
+            $sorted_sources[$source] = intval($grid[$source]['HOSTS_DOWN']);
+      }
+      arsort($sorted_sources);
+} else {
       asort($sorted_sources);
 }
 
Index: get_context.php
===================================================================
--- get_context.php	(revision 756)
+++ get_context.php	(working copy)
@@ -116,6 +116,14 @@
 if (!$sort)
       $sort = "descending";
 
+# Since cluster context do not have the option to sort "by down host", change
+# sort order to "descending" if previous sort order is "by down host"
+if ($context == "cluster") {
+    if ($sort == "by down host") {
+        $sort = "descending";
+    }
+}
+
 # A hack for pre-2.5.0 ganglia data sources.
 $always_constant = array(
    "swap_total" => 1,
Index: header.php
===================================================================
--- header.php	(revision 756)
+++ header.php	(working copy)
@@ -295,6 +295,13 @@
       $context_sorts[]="descending";
       $context_sorts[]="by hostname";
 
+      #
+      # Show sort order options for meta context only:
+      #
+      if ($context == "meta" ) {
+          $context_sorts[]="by down host";
+      }
+
       $sort_menu = "<B>Sorted</B>&nbsp;&nbsp;"
          ."<SELECT NAME=\"s\" OnChange=\"ganglia_form.submit();\">\n";
       foreach ( $context_sorts as $v )

Reply via email to