[rrd-users] RE 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)

Cyrille Bollu Cyrille.Bollu at fedasil.be
Wed Aug 20 12:11:09 CEST 2008


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)





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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20080820/60e71670/attachment.html 


More information about the rrd-users mailing list