chiark / gitweb /
Reorganise news graphs a bit
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 27 Jun 2010 18:49:40 +0000 (19:49 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 27 Jun 2010 18:49:40 +0000 (19:49 +0100)
cgi

diff --git a/cgi b/cgi
index aed4059081c9c9490e56305f7fac382c28901cfe..e854d8b298d6783bc15309f9be3e3a580c62ffea 100755 (executable)
--- 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&section=$section".
                "&sloth=$tsloth&elem=$elem";
            print "<a href=\"$imgurl&w=780&h=800\">";
@@ -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];
     }
 });