On Tue, Dec 15, 2009 at 02:32:07PM +0100, Sebastien Termeau wrote:
> Dear Ganglia Developers,
> 
> Please find below a patch that brings trends to Ganglia.

Really interesting, would you mind filing and enhancement bug on
www.ganglia.info?, that would be also a great place for attaching
those images you said were also needed.

> It uses RRD's LSLSLOPE, LSLINT and PREDICT (requires RRD >= 1.4.0 ) to
> provide two kinds of trends.
> Trends can be disabled by modifying conf.php ($with_trends).

considering that RRD >= 1.4.0 isn't that common yet would assume is probably
better to have this turned off by default for now

> I also modified the host_view template to use tables instead of sending a
> <BR> after "n" metrics.

would you mind doing this change in an independent that would be applied
before the one that adds your feature?, it would be also better if the
patch is done against svn trunk as it will be easier to integrate that
way but shouldn't be that difficult to correct that either if you don't
feel comfortable working with subversion or git (using git svn).

more comments inlined with the code.

> -----------
> diff -ur ganglia.ori/conf.php ganglia/conf.php
> --- ganglia.ori/conf.php    2009-12-14 15:19:23.000000000 +0100
> +++ ganglia/conf.php    2009-12-15 12:05:49.000000000 +0100
> @@ -64,6 +64,18 @@
>  #
>  $show_meta_snapshot = "yes";
> 
> +#
> +# Show trends icons next to each single metric graph
> +#
> +$with_trends = "yes";

have you tested it this as "false" as well?, what about a version
of RRD that doesn't support this?, would recommend having this
off by default and adding a comment saying only to turn on if
using the right version of rrdtool.

> @@ -140,6 +142,12 @@
>        # Get_context makes start negative.
>        $start = $sourcetime + $start;
>     }
> +
> +# For trends, we double the time range
> +if ($trend_type != ''){
> +  $rrdtool_graph['end']=$end + ($end-$start);
> +}
> +
>  # Fix from Phil Radden, but step is not always 15 anymore.
>  if ($range=="month")
>     $rrdtool_graph['end'] = floor($rrdtool_graph['end'] / 672) * 672;

could you elaborate on why this is needed?, other than of course allow for a 
trend to be
visible, should we allow the trend end target to be configurable instead?

> diff -ur ganglia.ori/host_view.php ganglia/host_view.php
> --- ganglia.ori/host_view.php    2009-12-14 15:19:23.000000000 +0100
> +++ ganglia/host_view.php    2009-12-15 14:16:46.000000000 +0100
> @@ -161,10 +161,26 @@
>                       $tpl->newBlock("vol_metric_info");
>                       $tpl->assign("graphargs", $v['graph']);
>                       $tpl->assign("alt", "$hostname $name");
> +

huh?

>                       if (isset($v['description']))
>                         $tpl->assign("desc", $v['description']);
> -                     if ( !(++$i % $metriccols) )
> -                        $tpl->assign("br", "<BR>");
> +             # PREDICT supported in 1.4.0
> +               if ($with_trends == 'yes'){
> +             if( version_compare($version["rrdtool"], '1.4.5') >= 0) {

1.4.5?

> +               $tpl->newBlock("trend_predict");
> +               $tpl->assign("graphargs", $v['graph']);
> +               $tpl->assign("images","./templates/$template_name/images");
> +             }
> +             else {
> +               $tpl->newBlock("trend");
> +               $tpl->assign("graphargs", $v['graph']);
> +               $tpl->assign("images","./templates/$template_name/images");
> +             }
> +               }
> +                     if ( !(++$i % $metriccols) ){
> +               $tpl->gotoBlock ("vol_metric_info");
> +                        $tpl->assign("new_row", "</TR><TR>");
> +             }

who gets the last "</TR>" addded to close the table?

Carlo

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Ganglia-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to