<br><font size=2 face="Arial">Hi,</font>
<br>
<br><font size=2 face="Arial">Does anyone knows why, when converting MRTG
logs to RRD, data are stored as integer???</font>
<br>
<br><font size=2 face="Arial">(extract from MRTG_lib.pm. See last line)</font>
<br>
<br><font size=2 face="Arial">while(<R>){</font>
<br><font size=2 face="Arial"> chomp;</font>
<br><font size=2 face="Arial"> ($next_time,$next{in},$next{out},$next{maxin},$next{maxout})
=</font>
<br><font size=2 face="Arial">
split /\s+/;</font>
<br><font size=2 face="Arial"> foreach my $s
(@steps) {</font>
<br><font size=2 face="Arial">
# bail if we have enough entries</font>
<br><font size=2 face="Arial">
next if ref $store{in}{$s} and</font>
<br><font size=2 face="Arial">
scalar @{$store{in}{$s}} > $sizes{$s};</font>
<br>
<br><font size=2 face="Arial">
# ok we are still here. If next mark is before the next time</font>
<br><font size=2 face="Arial">
# we take a short step, else we gobble up</font>
<br><font size=2 face="Arial">
my $next_stop;</font>
<br><font size=2 face="Arial">
do {</font>
<br><font size=2 face="Arial">
if ($elapsed_time{$s} + $time - $next_time > $s) {</font>
<br><font size=2 face="Arial">
$next_stop = $mark{$s}-$s;</font>
<br><font size=2 face="Arial">
} else {</font>
<br><font size=2 face="Arial">
$next_stop = $next_time;</font>
<br><font size=2 face="Arial">
}</font>
<br><font size=2 face="Arial">
my $time_diff = $time-$next_stop;</font>
<br><font size=2 face="Arial">
foreach my $d (qw(in out)) {</font>
<br><font size=2 face="Arial">
$rate{$d}{$s} = ($rate{$d}{$s} * $elapsed_time{$s}</font>
<br><font size=2 face="Arial">
+ $cur{$d} * $time_diff) /</font>
<br><font size=2 face="Arial">
($elapsed_time{$s}
+ $time_diff);</font>
<br><font size=2 face="Arial">
}</font>
<br><font size=2 face="Arial">
foreach my $d (qw(maxin maxout)){</font>
<br><font size=2 face="Arial">
$rate{$d}{$s} = $cur{$d} if $rate{$d}{$s} <
$cur{$d};</font>
<br><font size=2 face="Arial">
}</font>
<br>
<br><font size=2 face="Arial">
$elapsed_time{$s} += $time_diff;</font>
<br><font size=2 face="Arial">
if ($next_stop == $mark{$s}-$s) {</font>
<br><font size=2 face="Arial">
foreach my $t (qw(in out maxin maxout)){</font>
<br><font size=2 face="Arial">
$rate{$t}{$s}/=3600</font>
<br><font size=2 face="Arial">
if (defined $$rcfg{'options'}{'perhour'}{$router});</font>
<br><font size=2 face="Arial">
$rate{$t}{$s}/=60</font>
<br><font size=2 face="Arial">
if (defined $$rcfg{'options'}{'perminute'}{$router});</font>
<br><font size=2 face="Arial">it's here --->
push @{$store{$t}{$s}},
int($rate{$t}{$s});</font>
<br>
<br><font size=2 face="Arial">I'm asking this because I'm monitoring a
counter that increases by less than 1unit per second :-) (number of emails
per second sent/received on a server).</font>
<br>
<br><font size=2 face="Arial">With the "perhour" option in MRTG's
config, the graph was still nice. But, when 0 is stored in the RRD I can't
do anything anymore :-/</font>
<br>
<br><font size=2 face="Arial">I'm thinking about just removing this casting
but I wonder if there's some design/implementation issue that I don't understand...</font>
<br>
<br><font size=2 face="Arial">So, does anyone knows?</font>
<br>
<br><font size=2 face="Arial">Best regards,</font>
<br>
<br><font size=2 face="Arial">Cyrille</font>
<br>
<br><font size=2 face="Arial">(I know I should post this on the mrtg mailing-list.
I'm in the process of (re-) subscribing to that list but I can't help asking.
Sorry :-) )</font>
<br>
<br>