[rrd-users] 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 Jul 9 17:30:39 CEST 2008


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/20080709/82697896/attachment.html 


More information about the rrd-users mailing list