--- flow2rrd.pl 2004/12/29 15:21:19 1.17
+++ flow2rrd.pl 2004/12/29 15:45:56 1.18
@@ -597,6 +597,8 @@
$cols = 4 if ($graph->{-img_width} >= 600);
$cols = 5 if ($graph->{-img_width} >= 800);
# FIXME: UNKNOWN data?
+ my $data_i = '';
+ my $data_o = '';
foreach my $target (@{$host->{-target}->{-order}}) {
my $cdef_i = '';
my $cdef_o = '';
@@ -617,12 +619,23 @@
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("GPRINT:data%d_i: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));
+ $data_o = ($data_o eq '' ? sprintf("data%d_o", $i) : sprintf("data%d_o,%s,+", $i, $data_o));
+ $data_i = ($data_i eq '' ? sprintf("data%d_i", $i) : sprintf("data%d_i,%s,+", $i, $data_i));
$i++;
}
+ push(@cdef, sprintf("CDEF:data_o=%s", $data_o));
+ push(@cdef, sprintf("CDEF:data_i=%s", $data_i));
+
my @draw = (@draw_o, 'COMMENT:\n', @draw_i);
+
+ push(@draw, 'COMMENT:\n');
+ push(@draw, 'COMMENT:\n');
+ push(@draw, sprintf("GPRINT:data_o:AVERAGE:Total Average Traffic\\: %%.0lf%%S out /"));
+ push(@draw, sprintf("GPRINT:data_i:AVERAGE:%%.0lf%%S in"));
+
push(@draw, "HRULE:0#000000");
my $now = time();
my $tzoffset = $now - timelocal(gmtime($now));
@@ -703,6 +716,8 @@
$cols = 3 if ($graph->{-img_width} >= 400);
$cols = 4 if ($graph->{-img_width} >= 600);
$cols = 5 if ($graph->{-img_width} >= 800);
+ my $data_i = '';
+ my $data_o = '';
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));
@@ -711,15 +726,26 @@
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("GPRINT:data%d_o:AVERAGE:%%4.0lf%%S", $i));
+ 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("GPRINT:data%d_i: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));
+ $data_o = ($data_o eq '' ? sprintf("data%d_o", $i) : sprintf("data%d_o,%s,+", $i, $data_o));
+ $data_i = ($data_i eq '' ? sprintf("data%d_i", $i) : sprintf("data%d_i,%s,+", $i, $data_i));
$i++;
}
+ push(@cdef, sprintf("CDEF:data_o=%s", $data_o));
+ push(@cdef, sprintf("CDEF:data_i=%s", $data_i));
+
my @draw = (@draw_o, 'COMMENT:\n', @draw_i);
+
+ push(@draw, 'COMMENT:\n');
+ push(@draw, 'COMMENT:\n');
+ push(@draw, sprintf("GPRINT:data_o:AVERAGE:Total Average Traffic\\: %%.0lf%%S out /"));
+ push(@draw, sprintf("GPRINT:data_i:AVERAGE:%%.0lf%%S in"));
+
push(@draw, "HRULE:0#000000");
my $now = time();
my $tzoffset = $now - timelocal(gmtime($now));
|