From: Ian Jackson Date: Sun, 27 Jun 2010 18:49:40 +0000 (+0100) Subject: Reorganise news graphs a bit X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=131f6cbb6ba85655909ac54ab345cd40c93081f8;p=rrd-graphs.git Reorganise news graphs a bit --- diff --git a/cgi b/cgi index aed4059..e854d8b 100755 --- a/cgi +++ b/cgi @@ -19,7 +19,7 @@ my $self= url(-relative=>1); our (@sections, %section_groups, %group_elems, %graphs); -our @timeranges= (3600, map { $_*86400 } qw(1 7 28), 13*7+1); +our @timeranges= (3600, map { $_*86400 } qw(1 7 28), 13*7+1, 366); sub graph_of_group ($$$$$) { my ($section, $group, $elem, $basis, $args) = @_; @@ -127,9 +127,9 @@ graph('General', 'Users', { }, foreach my $src (<$R/df/df-*.rrd>) { my $vol= $src; + $vol =~ s,\.rrd$,, or next; $vol =~ s,.*/,,; $vol =~ s,^df-,,; - $vol =~ s,\.rrd$,,; graph('Disk space', $vol, { Slower => 1, }, @@ -141,10 +141,10 @@ foreach my $src (<$R/df/df-*.rrd>) { ]); } -foreach my $src (<$SELF/news-stats/*.rrd>) { +foreach my $src (<$SELF/data/news/*.rrd>) { my $site= $src; + $site =~ s,\.rrd$,, or next; $site =~ s,.*/,,; - $site =~ s,\.rrd$,,; $site =~ s,_(in|out)$,,; my $inout= $1; $site =~ s/^([-.0-9a-z]+)_//; @@ -152,6 +152,7 @@ foreach my $src (<$SELF/news-stats/*.rrd>) { graph_of_group("News", $site, $inout, { Slower => 1, + Units => '[art/s]' }, $inout eq 'out' ? [ (map { "DEF:$_=$src:$_:AVERAGE" } @@ -292,10 +293,11 @@ if ($detail) { my $elems= $group_elems{$section,$detail}; die unless $elems; start_page("$detail graphs"); - foreach my $elem (@$elems) { - my $g= $graphs{$section,$detail,$elem}; - die unless $g; - foreach my $tsloth ($g->{Slower}..$g->{Slower}+3) { + foreach my $xsloth (0..5) { + foreach my $elem (@$elems) { + my $g= $graphs{$section,$detail,$elem}; + die unless $g; + my $tsloth= $xsloth + $g->{Slower}; my $imgurl= "$self?graph=$detail§ion=$section". "&sloth=$tsloth&elem=$elem"; print ""; @@ -313,10 +315,10 @@ navsetting({ Param => 'sloth', Variable => \$sloth, Default => 1, - Values => [0..2], + Values => [0..3], Show => sub { my ($sl) = @_; - return ('Narrower', 'Normal', 'Wider')[$sl]; + return ('Narrower', 'Normal', 'Wider', 'Extra wide')[$sl]; } });