[rrd-users] migrating MRTG data to rrdtool

Tobias Oetiker tobi at oetiker.ch
Fri Aug 22 16:59:05 CEST 2008


Hi Cyrille,


> Hi,
>
> Does anyone knows why, when converting MRTG logs to RRD, data are stored
> as integer???

because mrtg log files only contain integers, but this falls flat
with perhour and perminute, you are correct ... remove int(..)

there may be further bugs here, since rrdtool should always store
'per second' values which the conversion takes care of. Not sure
how further updates will be handled ...

in any event, after the conversion there is no reason to stay with
per* settings since rrdtool can deal with the small values just
fine.

cheers
tobi


> (extract from MRTG_lib.pm. See last line)
>
> while(<R>){
>         chomp;
>         ($next_time,$next{in},$next{out},$next{maxin},$next{maxout}) =
>             split /\s+/;
>         foreach my $s (@steps) {
>             # bail if we have enough entries
>             next if ref $store{in}{$s} and
>                 scalar @{$store{in}{$s}} > $sizes{$s};
>
>             # ok we are still here. If next mark is before the next time
>             # we take a short step, else we gobble up
>             my $next_stop;
>             do {
>                 if ($elapsed_time{$s} + $time - $next_time > $s) {
>                     $next_stop = $mark{$s}-$s;
>                 } else {
>                     $next_stop = $next_time;
>                 }
>                 my $time_diff = $time-$next_stop;
>                 foreach my $d (qw(in out)) {
>                     $rate{$d}{$s} = ($rate{$d}{$s} * $elapsed_time{$s}
>                                      + $cur{$d} * $time_diff) /
>                                ($elapsed_time{$s} + $time_diff);
>                 }
>                 foreach my $d (qw(maxin maxout)){
>                     $rate{$d}{$s} = $cur{$d} if $rate{$d}{$s} < $cur{$d};
>                 }
>
>                 $elapsed_time{$s} += $time_diff;
>                 if ($next_stop == $mark{$s}-$s) {
>                    foreach my $t (qw(in out maxin maxout)){
>                        $rate{$t}{$s}/=3600
>                            if (defined
> $$rcfg{'options'}{'perhour'}{$router});
>                        $rate{$t}{$s}/=60
>                            if (defined
> $$rcfg{'options'}{'perminute'}{$router});
> it's here --->                       push @{$store{$t}{$s}},
> int($rate{$t}{$s});
>
> 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).
>
> 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 :-/
>
> I'm thinking about just removing this casting but I wonder if there's some
> design/implementation issue that I don't understand...
>
> So, does anyone knows?
>
> Best regards,
>
> Cyrille
>
> (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 :-) )
>
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900



More information about the rrd-users mailing list