[hobbit] Hobbit migration to a new box

Johann Eggers Johann.Eggers at teleatlas.com
Tue Jan 23 22:34:47 CET 2007


-----Original Message-----
From: Henrik Stoerner [mailto:henrik at hswn.dk]
Sent: Tue 1/23/2007 10:26 PM
To: hobbit at hswn.dk
Subject: Re: [hobbit] Hobbit migration to a new box
 
On Tue, Jan 23, 2007 at 10:10:58PM +0100, Johann Eggers wrote:
> From: Henrik Stoerner [mailto:henrik at hswn.dk]
>> The only real problem one may run into with migrating a Hobbit server is
>> if you are going from one hardware platform to another - that involves
>> dump'ing all of the RRD files to XML, and the import'ing all of them
>> from the XML files onto the new server. It's scriptable, but may take
>> some time depending on the number of files 
>
> Do you have a handy script for this kind of task and are you willing to share it with the community?

Nothing fancy, but see below. It runs on the old Hobbit server, and uses
ssh (with ssh-keys to avoid a password prompt for each file) to send the
XML file across to the new server and import it there.

It also has a list of the per-host RRD directories in /tmp/rrddirs.txt
(e.g. created by the commented-out "ls -ld ..." command). The trick was
that I could interrupt the script at any time, and just remove those
lines from the rrddirs.txt file that had already been processed, then
restart the script and it would continue.

The reason for first doing an "rm" of the file on the new server was
that the new server was already being fed updates, so it was creating
and updating RRD files while this script was running. "rrdtool restore"
aborts if the file exists, so I had to delete any existing rrd file on
the new server.


Henrik


#!/bin/sh

MYNEWSERVER=rrdserver.foo.com

cd /var/lib/hobbit/rrd
#ls -1d * >/tmp/rrddirs.txt

cat /tmp/rrddirs.txt | while read H
do
   NUM=`find $H -type f -a -name "*.rrd" -a -mtime -30 | wc -l`
   if [ $NUM -gt 0 ]
   then
      echo "Processing $H ($NUM files)"
      find $H -type f -a -name "*.rrd" -a -mtime -30 | while read f
      do
         FULLFN="/var/lib/hobbit/rrd/$f"
         rrdtool dump "$f" | ssh $MYNEWSERVER "rm \"$FULLFN\"; rrdtool restore - \"$FULLFN\""
      done
   else
      echo "Skipped $H - no up-to-date files"
   fi
done

exit 0

--------
Thx!!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20070123/df5b9dab/attachment.html>


More information about the Xymon mailing list