Skip to content

munin: migration from a 32bit to a 64bit host

2008 December 26
by Lionel Porcheron

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
6 Responses Post a comment
  1. Halbert permalink
    July 2, 2009

    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

  2. July 8, 2009

    Hi Halbert,
    The scripts should work for a 64 to a 32 bit migration. But I did not try it myself.

  3. October 19, 2010

    Very helpful. Thanks a lot.

  4. October 26, 2011

    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).

  5. November 11, 2011

    beware of the dumped dataformat. I had to sed ‘,’ to ‘.’ in the dumped .xml-files to get right data on the target

Trackbacks & Pingbacks

  1. Change a Munin server and keep the data

Leave a Reply

Note: You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS