--- flow2rrd.pl 2004/12/27 13:06:19 1.12
+++ flow2rrd.pl 2004/12/27 15:58:23 1.13
@@ -358,14 +358,6 @@
sub data_accumulate {
my ($cfg, $ctx) = @_;
- #my $st = POSIX::ctime($Cflow::startime); $st =~ s/\r?\n$//s;
- #my $et = POSIX::ctime($Cflow::endtime); $et =~ s/\r?\n$//s;
- #printf(STDERR "%s %15.15s.%-5hu %15.15s.%-5hu %2hu %3u %u\n",
- # $et,
- # $Cflow::srcip, $Cflow::srcport,
- # $Cflow::dstip, $Cflow::dstport,
- # $Cflow::protocol, $Cflow::bytes);
-
# iterate over all target and services to see whether
# the flow matches them...
my $matched_total = 0;
@@ -569,12 +561,19 @@
push(@cdef, sprintf("CDEF:data%d_o=%s", $i, $cdef_o));
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 - 0x404040";
- push(@draw_o, sprintf("%s:data%d_o#%06x:%s out", ($i == 0 ? "AREA" : "STACK"), $i, $color_o, $target));
- push(@draw_i, sprintf("%s:data%d_i#%06x:%s in", ($i == 0 ? "AREA" : "STACK"), $i, $color_i, $target));
+ 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));
$i++;
}
- my @draw = (@draw_o, "COMMENT:\n", @draw_i, "HRULE:0#000000");
+ my @draw = (@draw_o, 'COMMENT:\n', @draw_i);
+ push(@draw, "HRULE:0#000000");
+ my $ts = int(($graph->{-graph_start} / (24*60*60)) + 0) * (24*60*60);
+ my $te = int(($graph->{-graph_end} / (24*60*60)) + 1) * (24*60*60);
+ for (my $t = $ts; $t < $te; $t += (12*60*60)) {
+ if (($t % (24*60*60)) == 0) { push(@draw, "VRULE:$t#000000"); }
+ else { push(@draw, "VRULE:$t#999999"); }
+ }
my @args = ();
push(@args, $graph->{-img_file});
push(@args, '--imgformat', $graph->{-img_format});
@@ -585,7 +584,7 @@
push(@args, '--upper-limit', $graph->{-graph_ulimit}) if ($graph->{-graph_ulimit} != 0);
push(@args, '--lower-limit', $graph->{-graph_llimit}) if ($graph->{-graph_llimit} != 0);
push(@args, '--rigid');
- push(@args, '--alt-autoscale',);
+ push(@args, '--alt-autoscale');
push(@args, '--base', 1024);
push(@args, '--x-grid', "HOUR:1:DAY:1:DAY:1:0:%d-%b-%Y");
push(@args, '--vertical-label', 'Bit/s');
@@ -594,7 +593,7 @@
push(@args, '--color', 'SHADEA#e5e5f5');
push(@args, '--color', 'SHADEB#d0d0e0');
push(@args, '--color', 'GRID#cccccc');
- push(@args, '--color', 'MGRID#000000');
+ push(@args, '--color', 'MGRID#999999');
push(@args, '--color', 'FONT#000000');
push(@args, '--color', 'FRAME#000000');
push(@args, '--color', 'ARROW#000000');
@@ -648,12 +647,19 @@
push(@cdef, sprintf("CDEF:data%d_o=%s_o,8,*,+1,*", $i, $ds_name));
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 - 0x404040";
- push(@draw_o, sprintf("%s:data%d_o#%06x:%s out", ($i == 0 ? "AREA" : "STACK"), $i, $color_o, $service));
- push(@draw_i, sprintf("%s:data%d_i#%06x:%s in", ($i == 0 ? "AREA" : "STACK"), $i, $color_i, $service));
+ 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));
$i++;
}
- my @draw = (@draw_o, "COMMENT:\n", @draw_i, "HRULE:0#000000");
+ my @draw = (@draw_o, 'COMMENT:\n', @draw_i);
+ push(@draw, "HRULE:0#000000");
+ my $ts = int(($graph->{-graph_start} / (24*60*60)) + 0) * (24*60*60);
+ my $te = int(($graph->{-graph_end} / (24*60*60)) + 1) * (24*60*60);
+ for (my $t = $ts; $t < $te; $t += (12*60*60)) {
+ if (($t % (24*60*60)) == 0) { push(@draw, "VRULE:$t#000000"); }
+ else { push(@draw, "VRULE:$t#999999"); }
+ }
my @args = ();
push(@args, $graph->{-img_file});
push(@args, '--imgformat', $graph->{-img_format});
@@ -664,7 +670,7 @@
push(@args, '--upper-limit', $graph->{-graph_ulimit}) if ($graph->{-graph_ulimit} != 0);
push(@args, '--lower-limit', $graph->{-graph_llimit}) if ($graph->{-graph_llimit} != 0);
push(@args, '--rigid');
- push(@args, '--alt-autoscale',);
+ push(@args, '--alt-autoscale');
push(@args, '--base', 1024);
push(@args, '--x-grid', "HOUR:1:DAY:1:DAY:1:0:%d-%b-%Y");
push(@args, '--vertical-label', 'Bit/s');
@@ -673,7 +679,7 @@
push(@args, '--color', 'SHADEA#e5e5f5');
push(@args, '--color', 'SHADEB#d0d0e0');
push(@args, '--color', 'GRID#cccccc');
- push(@args, '--color', 'MGRID#000000');
+ push(@args, '--color', 'MGRID#999999');
push(@args, '--color', 'FONT#000000');
push(@args, '--color', 'FRAME#000000');
push(@args, '--color', 'ARROW#000000');
|