[rrd-users] Re: Merging data from 2 rrd files.
Fabrice Rafart
fabrice.rafart at efs.sante.fr
Tue Sep 24 17:52:14 MEST 2002
Hello,
After my first mail, I'll try this :
#!/bin/sh
rrdtool dump $1 > $1.xml
awk '(/AVERAGE/) {getline; sum=$2}
{if (/<row><v>/) { print $0 >> sum}}
' $1.xml
sed -e 's#^[^\/]*/ \([0-9]*\) --> <row><v> \(.*\) </v><v> \(.*\)
</v></row>*$#\1:\2:\3#' 1 > 1.update
rrdtool dump $2 > $1.xml
awk '(/AVERAGE/) {getline; sum=$2}
{if (/<row><v>/) { print $0 >> sum}}
' $1.xml
sed -e 's#^[^\/]*/ \([0-9]*\) --> <row><v> \(.*\) </v><v> \(.*\)
</v></row>*$#\1:\2:\3#' 1 >> 1.update
sort -n 1.update > 1.tmp; mv 1.tmp 1.update
time=`expr $(head -1 1.update | cut -d':' -f 1) - 600`
rm tmp.rrd
rrdtool create tmp.rrd --start $time DS:ds0:COUNTER:600:0:1250000
DS:ds1:COUNTER:600:0:1250000 RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700
RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:600
RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797
while read line
do
rrdtool update tmp.rrd $line
done < 1.update
I have no error while updating, but do you think this is correct ?
--
Fabrice Rafart.
Administrateur systèmes et réseaux. EFS IDF
> -----Message d'origine-----
> De : Fabrice Rafart [mailto:fabrice.rafart at efs.sante.fr]
> Envoyé : lundi 16 septembre 2002 14:02
> À : rrd-users at list.ee.ethz.ch
> Objet : Merging data from 2 rrd files.
>
>
> Hello,
>
> I used MRTG with target like IP.ifNumber (x.x.x.x.1 for eth0).
> Then I use "LogFormat: rrdtool" and I have some x.x.x.x.1.rrd.
> Latter, I remake my MRTG cf with target like IP_IfName
> (usr/bin/cfgmaker --ifref=name --ifdesc=descr ...). Then I have
> new rrd file x.x.x.x_et0.rrd.
> I'd like inject old data in the new rrd file but the time hurt me !
>
> ERROR: illegal attempt to update using time 1031184000 when last
> update time is
> 1032172203 (minimum one second step)
>
>
> I use rrdtool fetch and sed for create a file like :
> 1013126400:1.8000000000e+01:1.2500000000e+02
> 1013212800:4.1000000000e+01:3.0100000000e+02
> 1013299200:1.4000000000e+01:1.9500000000e+02
> 1013385600:1.1000000000e+01:1.8800000000e+02
> 1013472000:8.0000000000e+01:4.4300000000e+02
> 1013558400:7.1000000000e+01:4.1200000000e+02
> 1013644800:6.7000000000e+01:3.8800000000e+02
> 1013731200:7.6000000000e+01:4.2100000000e+02
> 1013817600:4.6000000000e+01:2.9800000000e+02
> 1013904000:1.0000000000e+01:1.8500000000e+02
> [...]
>
> and :
> for i in `cat fichier`
> do
> rrdtool update x.x.x.x_et0.rrd $i
> done
--
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