[collectd] [PATCH] collection.cgi: Made sorting of graphs configurable.

Dieter Bloms dieter<span style="display: none;">.trailing-username</span>(a)<span style="display: none;">leading-domain.</span>bloms.de
Thu Feb 1 16:52:59 CET 2007


Hi,

it works for plugins with no extra directory, but plugins with
directories like mysql, apache ... are listed on the top.

On Thu, Feb 01, Sebastian Harl wrote:

> On Thu, Feb 01, 2007 at 01:56:41PM +0100, Dieter Bloms wrote:
> > I want to change the order when viewing the results in a browser like:
> > 
> > cpu usage
> > load usage
> > hddtemp
> > traffic
> > 
> > is it possible to do it ?
> 
> Please try the attached patch. Simply set the value of @plugins to the list of
> plugins you want to display.
> (e.g. "@plugins = (qw( cpu load hddtemp traffic ))")
> 
> Signed-off-by: Sebastian Harl <sh.trailing-username(a)leading-domain.tokkee.org>
> ---
>  contrib/collection.cgi |   17 ++++++++++++++++-
>  1 files changed, 16 insertions(+), 1 deletions(-)
> 
> diff --git a/contrib/collection.cgi b/contrib/collection.cgi
> index 5c8bd4d..559fa5d 100755
> --- a/contrib/collection.cgi
> +++ b/contrib/collection.cgi
> @@ -12,6 +12,10 @@ use Carp (qw(carp cluck confess croak));
>  
>  our $Config = read_config ();
>  
> +# if this array contains any elements, only plugins listed therein are
> +# displayed in the given order
> +my @plugins = ();
> +
>  our $AbsDir;
>  our $RelDir;
>  our $Type;
> @@ -1891,10 +1895,21 @@ HTML
>  			print "</ul>\n";
>  		}
>  
> -		for (sort (keys %$files))
> +		my @tmp;
> +
> +		if (scalar @plugins > 0) {
> +			@tmp = @plugins;
> +		}
> +		else {
> +			@tmp = sort keys %$files;
> +		}
> +
> +		for (@tmp)
>  		{
>  			my $type = $_;
>  
> +			next if (! defined $files->{$type});
> +
>  			if (ref ($GraphMulti->{$type}) eq 'CODE')
>  			{
>  				print qq(\t\t<a href="$MySelf$RelDir/$type" />),
> -- 
> 1.4.3.2
> 



> _______________________________________________
> collectd mailing list
> collectd.trailing-username(a)leading-domain.verplant.org
> http://mailman.verplant.org/listinfo/collectd


-- 
Gruß

  Dieter

--
I do not get viruses because I do not use MS software.
If you use Outlook then please do not put my email address in your
address-book so that WHEN you get a virus it won't use my address in the
From field.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20070201/464dcb5b/attachment.pgp


More information about the collectd mailing list