OSSP CVS Repository

ossp - Difference in ossp-pkg/flow2rrd/flow2rrd.pl versions 1.16 and 1.17
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

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