When you migration your munin from a 32bits to a 64bits installation, you have to dump restore all your rrd files. Saying that looks like a pain, but in fact, it is easy to do ;-). We migrate some months ago our munin/nagios server at work from an old 32bits server to a brand new rack server using a 64bit Ubuntu 8.04.1, we performed the following scripts and kept our historic.
Here are the two scripts (you need some disk space to perform the dump / restore) . I assume you have copied the content of you “old” server on the new server. On Ubuntu/Debian servers, rrd files usually lives in /var/lib/munin.
First dump script :
#!/bin/bash for f in `find /var/lib/munin -name '*.rrd' -print` ; do xml_file=`dirname $f`/`basename $f .rrd`.xml rrdtool dump "$f" > "${xml_file}" chown root:root "${xml_file}" done
Import script :
#!/bin/bash for f in `find /var/lib/munin -name '*.xml' -print` ; do rrd_file=`dirname $f`/`basename $f .xml`.rrd mv -f "${rrd_file}" "${rrd_file}.bak" chown root:root "${rrd_file}.bak" rrdtool restore "$f" "${rrd_file}" chown munin:munin "${rrd_file}" done
Hello,
I didn’t realize you needed to dump your rrd files if you were migrating from a 32bit to a 64bit server. I can only assume a similar process is necessary if you go in the opposite direction, from 64 bit to a 32 bit server.
In that case, would your export and import scripts work?
Thanks
Hi Halbert,
The scripts should work for a 64 to a 32 bit migration. But I did not try it myself.
Very helpful. Thanks a lot.
[…] If your old and new server are not the same architecture, then you need to perform a dump and restore process on the RRD files rather than just copying them across, because the binary data contained in the files is different between 32-bit and 64-bit systems. In our case we decided to just stick with a regular x86 setup for the new box, so I can’t comment on how well this works, but I found the following article which looks like it should work just fine: munin: migration from a 32bit to a 64bit host. […]
Thanks for these scripts.
You might want to check for existing .rrd files for the xml files before restoring them though, so that you do not convert wrong files.
This might happen when copying data (rrd files) from another host, where the domain setup does not match (hostname vs. hostname.domain in filenames).
beware of the dumped dataformat. I had to sed ‘,’ to ‘.’ in the dumped .xml-files to get right data on the target
Altough I like the information in this article the scripts provided are really hurting my eyes. Here’s a proper way to do it.
Dump
for f in *.rrd; do xml_file=”${f%.*}.xml”; rrdtool dump “${f}” > “${xml_file}”; done
Import
for f in *.xml; do newname=”${f%.*}.rrd”; rrdtool restore “${f}” “${newname}”; chown munin:munin “${newname}”; done
My RRD filenames had spaces in, which messed up the bash script. I re-wrote to python which did the trick,
#!/bin/env python
for dirpath, dirnames, filenames in os.walk(‘.’):
print “Entering {d}”.format(d=dirpath)
for filename in filenames:
if filename.endswith(‘.rrd’):
xml_filename=filename[0:-4] + ‘.xml’
print “\tUpdating ‘{s}’ to {‘d’}”.format(
s=filename,
d=xml_filename)
os.system(‘/usr/local/bin/rrdtool dump “{s}” > “${d}”‘.format(
s=filename,
s=xml_filename)
Sorry pasted an old version into the above comment,
#!/bin/env python
import os
for dirpath, dirnames, filenames in os.walk(‘.’):
print “Entering {d}”.format(d=dirpath)
for filename in filenames:
if filename.endswith(‘.rrd’):
xml_filename=filename[0:-4] + ‘.xml’
print “\tUpdating ‘{s}’ to ‘{d}'”.format(
s=filename,
d=xml_filename)
command = ‘/usr/local/bin/rrdtool dump “{s}” > “{d}”‘.format(
s=os.path.join(dirpath, filename),
d=os.path.join(dirpath, xml_filename))
os.system(command)
[…] If your old and new server are not the same architecture, then you need to perform a dump and restore process on the RRD files rather than just copying them across, because the binary data contained in the files is different between 32-bit and 64-bit systems. In our case we decided to just stick with a regular x86 setup for the new box, so I can’t comment on how well this works, but I found the following article which looks like it should work just fine: munin: migration from a 32bit to a 64bit host. […]
[…] If your old and new server are not the same architecture, then you need to perform a dump and restore process on the RRD files rather than just copying them across, because the binary data contained in the files is different between 32-bit and 64-bit systems. In our case we decided to just stick with a regular x86 setup for the new box, so I can’t comment on how well this works, but I found the following article which looks like it should work just fine: munin: migration from a 32bit to a 64bit host. […]