OSSP CVS Repository

ossp - Check-in [4935]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4935
Date: 2004-Dec-29 16:21:19 (local)
2004-Dec-29 15:21:19 (UTC)
User:rse
Branch:
Comment: Better formatting of legend by manually aligning elements in width-dependent number of columns.
Tickets:
Inspections:
Files:
ossp-pkg/flow2rrd/ChangeLog      1.11 -> 1.12     4 inserted, 0 deleted
ossp-pkg/flow2rrd/flow2rrd.pl      1.16 -> 1.17     22 inserted, 4 deleted

ossp-pkg/flow2rrd/ChangeLog 1.11 -> 1.12

--- ChangeLog    2004/12/29 14:10:37     1.11
+++ ChangeLog    2004/12/29 15:21:19     1.12
@@ -10,6 +10,10 @@
 
   Changes between 0.9.1 and 0.9.2 (26-Dec-2004 to 27-Dec-2004):
 
+    *) Better formatting of legend by manually aligning elements
+       in width-dependent number of columns.
+       [Ralf S. Engelschall]
+
     *) Add --verbose option and use it to show a flow/sec indication
        under option --store.
        [Ralf S. Engelschall]


ossp-pkg/flow2rrd/flow2rrd.pl 1.16 -> 1.17

--- flow2rrd.pl  2004/12/29 14:10:38     1.16
+++ flow2rrd.pl  2004/12/29 15:21:19     1.17
@@ -591,6 +591,11 @@
             my @draw_o = ();
             my @draw_i = ();
             my $i = 0;
+            my $cols = 1;
+            $cols = 2 if ($graph->{-img_width} >= 200);
+            $cols = 3 if ($graph->{-img_width} >= 400);
+            $cols = 4 if ($graph->{-img_width} >= 600);
+            $cols = 5 if ($graph->{-img_width} >= 800);
             #   FIXME: UNKNOWN data?
             foreach my $target (@{$host->{-target}->{-order}}) {
                 my $cdef_i = '';
@@ -609,8 +614,12 @@
                 push(@cdef, sprintf("CDEF:data%d_i=%s", $i, $cdef_i));
                 my $color_o; eval "\$color_o = 0x".$colors->[$i];
                 my $color_i; eval "\$color_i = \$color_o - 0x101010";
-                push(@draw_o, sprintf("%s:data%d_o#%06x:out %s", ($i == 0 ? "AREA" : "STACK"), $i, $color_o, $target));
-                push(@draw_i, sprintf("%s:data%d_i#%06x:in  %s", ($i == 0 ? "AREA" : "STACK"), $i, $color_i, $target));
+                push(@draw_o, sprintf("GPRINT:data%d_o:AVERAGE:%%4.0lf%%S", $i));
+                push(@draw_o, sprintf("%s:data%d_o#%06x:out %s", ($i == 0 ? "AREA" : "STACK"), $i, $color_o, sprintf("%-8s", substr($target, 0, 8))));
+                push(@draw_o, 'COMMENT:\n') if ($i % $cols == ($cols-1));
+                push(@draw_i, sprintf("GPRINT:data%d_o:AVERAGE:%%4.0lf%%S", $i));
+                push(@draw_i, sprintf("%s:data%d_i#%06x:in  %s", ($i == 0 ? "AREA" : "STACK"), $i, $color_i, sprintf("%-8s", substr($target, 0, 8))));
+                push(@draw_i, 'COMMENT:\n') if ($i % $cols == ($cols-1));
                 $i++;
             }
             my @draw = (@draw_o, 'COMMENT:\n', @draw_i);
@@ -689,6 +698,11 @@
             my @draw_o = ();
             my @draw_i = ();
             my $i = 0;
+            my $cols = 1;
+            $cols = 2 if ($graph->{-img_width} >= 200);
+            $cols = 3 if ($graph->{-img_width} >= 400);
+            $cols = 4 if ($graph->{-img_width} >= 600);
+            $cols = 5 if ($graph->{-img_width} >= 800);
             foreach my $service (@{$host->{-target}->{$target}->{-service}}) {
                 my $ds_name = &make_rrd_ds_name($host->{-name}, $target, $service);
                 push(@def,    sprintf("DEF:%s_o=%s:%s_o:LAST", $ds_name, $cfg->{'Database'}->{-file}, $ds_name));
@@ -697,8 +711,12 @@
                 push(@cdef,   sprintf("CDEF:data%d_i=%s_i,8,*,-1,*", $i, $ds_name));
                 my $color_o; eval "\$color_o = 0x".$colors->[$i];
                 my $color_i; eval "\$color_i = \$color_o - 0x101010";
-                push(@draw_o, sprintf("%s:data%d_o#%06x:out %s", ($i == 0 ? "AREA" : "STACK"), $i, $color_o, $service));
-                push(@draw_i, sprintf("%s:data%d_i#%06x:in  %s", ($i == 0 ? "AREA" : "STACK"), $i, $color_i, $service));
+                push(@draw_o, sprintf("GPRINT:data%d_o:AVERAGE:%%4.0lf%%S", $i));
+                push(@draw_o, sprintf("%s:data%d_o#%06x:out %s", ($i == 0 ? "AREA" : "STACK"), $i, $color_o, sprintf("%-8s", substr($service, 0, 8))));
+                push(@draw_o, 'COMMENT:\n') if ($i % $cols == ($cols-1));
+                push(@draw_i, sprintf("GPRINT:data%d_o:AVERAGE:%%4.0lf%%S", $i));
+                push(@draw_i, sprintf("%s:data%d_i#%06x:in  %s", ($i == 0 ? "AREA" : "STACK"), $i, $color_i, sprintf("%-8s", substr($service, 0, 8))));
+                push(@draw_i, 'COMMENT:\n') if ($i % $cols == ($cols-1));
                 $i++;
             }
             my @draw = (@draw_o, 'COMMENT:\n', @draw_i);

CVSTrac 2.0.1