Migrating RRDTool from 32bits to 64 bits

I had a very old server on a 32 bits platform. A few days ago, I bought a new one with a 64bits platform.
I was using Smokeping on this server, and I wanted to keep my old data. If you copy .rrd files in place, you’ll get an error :

This RRD was created on another architecture

That’s because RRD file structure changed based on the architecture you have. Yes, that’s silly but this is the way it is.

To convert files, you have to dump data to an XML file, sync it on the new server, and reimport it.
This is how to make it with justa few lines of bash :

cd /path/to/rrd/files;
for i in $(find . -name '*.rrd'); do rrdtool dump $i > $i.xml ; done
rsync -av . my.server.ip:/path/to/new/dir/rrd/

And on the new server :

cd /path/to/new/dir/rrd
for i in `find . -name '*.xml'`; do rrdtool restore --force-overwrite $i `echo $i |sed s/.xml//g`; done


Laisser un commentaire

Votre adresse e-mail ne sera pas publiée.