[rrd-users] RE rrdupdate behaviour when data already exist
Sam Stickland
sam_mailinglists at spacething.org
Wed Aug 20 13:04:56 CEST 2008
Hi,
I have a working script that can replay MRTG style RRD files into
another RRD file (with differing RRA definations). It preserves the
average and max DS's by extrapolating the minimum required data for the
rrd updates.
I wrote it for converting MRTG RRD files to Torrus, but it's pretty
general, if a little rough and ready. It uses an RRD file as a template
to produce a new file containing the MRTG data:
# ./convert-to-torrus.pl mrtg.rrd template.rrd out.rrd
If template.rrd file contained data then you can use the merged-rrd.py
script (in contrib/) to combine it with 'out.rrd'.
Let me know if you want a copy now - when I have a little more time it
will be available from the Torrus Wiki.
In answer to your question about growing the RRA - it depends on how you
created the file. If you post the output of "rrdtool info my.rrd | sort"
I can have a look.
Sam
Cyrille Bollu wrote:
>
> Alex,
> Other rrdtool gurus,
>
> I gave a try to my modifications and it's working (almost :-) ) great.
>
> However I still have a concern:
>
> The RRA created don't contain the *exact* amount of rows specified;
> They have 8656 instead of 8640 (1 point per row), 35077 instead of
> 35040 (3 points per row), and, what's ennoying me, 19113 instead of
> 43800 (12 points per row). I understand that this is due to the lack
> of data in the original MRTG log files. But, in the future, I want to
> use the RRD files created to store data in a RRA with 43800 rows/12
> point per row.
>
> So my question is: Will subsequent calls to rrdupdate make the 12
> points/row RRA grow or is it definitivelly limited to 19113 rows?
>
> And, if it is limited, will rrdresize help me?
>
> Side question: Is it possible to add an RRA to a RRD file (using
> rrdtool-1.2)?
>
> Best regards,
>
> Cyrille
>
>
>
>
> *Cyrille Bollu/FHQ/USERS/FEDASIL*
>
> 09/07/2008 17:30
>
>
> A
> Cyrille Bollu <Cyrille.Bollu at fedasil.be>
> cc
> Alex van den Bogaerdt <alex at ergens.op.het.net>,
> rrd-users at lists.oetiker.ch, rrd-users-bounces at lists.oetiker.ch
> Objet
> rrdupdate behaviour when data already exist (was: Tips and thoughts
> on how to optimally import data points from MRTG .log files into new
> RRD databases)Link
> <Notes://FHQMAIL01/C1256FB30037352A/E8700555BBB69B0380256C3F003DA467/C65863980A382D55C1257481002F23CC>
>
>
>
>
>
>
>
>
>
> Great Alex,
>
> It was almost as simple as I thought.
>
> For the record, I modified function "log2rrd" in file MRTG_lib.pm as
> follow:
>
> sub log2rrd ($$$) {
> ...
> my %next;
> my $rrd;
> # CBU 2008.07.09: Change the way MRTG l.log files are converted into
> RRD databases
> # my @steps = qw(300 1800 7200 86400);
> # my %sizes = ( 300 => 600, 1800 => 700, 7200 => 775, 86400 => 797);
> my @steps = qw(300 900 3600);
> my %sizes = ( 300 => 8640, 900 => 35040, 3600 => 43800);
> open R, "<$$cfg{logdir}$$rcfg{'directory'}{$router}$router.log" or
> die "ERROR: opening
> $$cfg{logdir}$$rcfg{'directory'}{$router}$router.log: $!";
> debug('rrd',"converting
> $$cfg{logdir}$$rcfg{'directory'}{$router}$router.log");
> ...
> </ds>
> RRD $first_step{300} = 0; # invalidate
> # CBU 2008.07.09: Change the way MRTG l.log files are converted into
> RRD databases
> addarch(1,'AVERAGE','in','out',\%store,\%first_step,\$rrd);
> addarch(3,'AVERAGE','in','out',\%store,\%first_step,\$rrd);
> addarch(12,'AVERAGE','in','out',\%store,\%first_step,\$rrd);
> addarch(1,'MAX','maxin','maxout',\%store,\%first_step,\$rrd);
> addarch(3,'MAX','maxin','maxout',\%store,\%first_step,\$rrd);
> addarch(12,'MAX','maxin','maxout',\%store,\%first_step,\$rrd);
> # addarch(1,'AVERAGE','in','out',\%store,\%first_step,\$rrd);
> # addarch(6,'AVERAGE','in','out',\%store,\%first_step,\$rrd);
> # addarch(24,'AVERAGE','in','out',\%store,\%first_step,\$rrd);
> # addarch(288,'AVERAGE','in','out',\%store,\%first_step,\$rrd);
> # addarch(6,'MAX','maxin','maxout',\%store,\%first_step,\$rrd);
> # addarch(24,'MAX','maxin','maxout',\%store,\%first_step,\$rrd);
> # addarch(288,'MAX','maxin','maxout',\%store,\%first_step,\$rrd);
> $rrd .= <<RRD;
> </rrd>
> RRD
>
> if ( $OS eq 'NT' ) {
> open (R, "|$$cfg{rrdtool} restore -
> $$cfg{logdir}$$rcfg{'directory'}{$router}$router.rrd");
> ...
> }
>
> Now, I have one additionnal question:
>
> For a few months, we are also collecting data from these sensors via
> another monitoring system using rrdtools.
>
> So, I would like to import data from this other monitoring system into
> the .RRD that I will generate from MRTG (ie: using "rrdtools update").
>
> But, since there will already be some data, I'm wondering what will be
> the behaviour of rrdtools in this case (ie: when one inserts values at
> times when there are already data).
>
> Can you enlighten me?
>
> Best regards,
>
> Cyrille
>
>
>
> *Cyrille Bollu <Cyrille.Bollu at fedasil.be>*
> Envoyé par : rrd-users-bounces at lists.oetiker.ch
>
> 09/07/2008 10:32
>
>
> A
> Alex van den Bogaerdt <alex at ergens.op.het.net>
> cc
> rrd-users at lists.oetiker.ch, rrd-users-bounces at lists.oetiker.ch
> Objet
> Re: [rrd-users] Tips and thoughts on how to optimally import data
> points from MRTG .log files into new RRD databases
>
>
>
>
>
>
>
>
>
>
> rrd-users-bounces at lists.oetiker.ch wrote on 09/07/2008 02:25:35:
>
> > > I know that I can convert my MRTG .log file to RRD databases by
> adding the
> > > "LogFormat: rrdtool" line in MRTG's configuration files. However,
> the RRA
> > > generated by doing this don't satisfy me.
> >
> > I don't remember when/where/what, but I'm almost 100% sure I've seen
> > a solution for this. Try google.
> >
>
> I'm pretty sure also but you already gave me a very good tip hereunder
> :-)
>
> >
> >
> > I suggest looking in MRTG or RateUp, find the part where it creates the
> > new database and modify that part.
> >
>
> Great! I didn't realized MRTG was written in Perl.
>
> Actually, I think I'll have to modify function "log2rrd" in file
> MRTG_lib.pm:
>
> sub log2rrd ($$$) {
> ...
> my @steps = qw(300 1800 7200 86400);
> my %sizes = ( 300 => 600, 1800 => 700, 7200 => 775, 86400
> => 797);
> ...
>
> Am I dreaming? Could it be so simple? :-)
>
> Thanks Alex
>
> Cyrille_______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
>
More information about the rrd-users
mailing list