[rrd-users] Exporting historical data from RRD's
David Gethings
davidg at pipex.net
Thu Mar 27 18:44:35 MET 2003
Hi a newbie here so please excuse my ignorance.
I'm an trying to find a way of exporting historical data from one RRD to
another. However the number of RRA are different for each RRD. The
orginal RRD has 7 RRA's (the ones that MRTG setup), the new RRD has 8
RRA's.
I am told that having the historical data in the new format is vital,
but I'm doubting whether this can be achieved. My searches of the web of
others doing such a thing has drawn a blank. And my efforts so far have
not been successful.
The following script attempts to complete my task. My questions are: is
what I have been asked to do possible? If so what am I doing wrong?
TIA
Dg
#!/usr/bin/perl -w
#
# script to migrate historical data from old RRD to new RRD
use strict;
use RRDs;
my $time = 1024531200;
my $day = 12 * 24;
my $week = $day * 7;
my $step = 300;
my $hb = $step * 2;
my $type = 'COUNTER';
my $min = 0;
my $max = 'U';
my @ds = ("DS:ds0:$type:$hb:$min:$max",
"DS:ds1:$type:$hb:$min:$max"
);
my @rra = ("RRA:AVERAGE:0.5:1:$week",
"RRA:AVERAGE:0.5:6:700",
"RRA:AVERAGE:0.5:24:775",
"RRA:AVERAGE:0.5:$day:797",
"RRA:MAX:0.5:1:$week",
"RRA:MAX:0.5:6:700",
"RRA:MAX:0.5:24:775",
"RRA:MAX:0.5:$day:797"
);
RRDs::create('my.rrd',
'--start', $time,
'--step', $step,
@ds,
@rra
);
while ($time < time) {
my ($start,$step,$names,$data) =
RRDs::fetch $ARGV[0], 'MAX', '--start', $time,
'--end', $time += 300;
foreach my $line (@$data) {
next unless defined $line->[0];
RRDs::update $ARGV[0], "$time:$line->[0]:$line->[1]";
}
}
--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the rrd-users
mailing list