|
|
| Author |
Message |
rrogier
Joined: 15 Dec 2007 Posts: 1 Location: Lake Forest, IL
|
Posted: Sat Dec 15, 2007 8:49 pm Post subject: [INFO] - Tools for Migrating to From Windows/Linux/UNIX |
|
|
Hi All,
This is my first post, but I've been actively reading for several months. I've tried searching the fora for the solution below but couldn't find it completely. I decided to put this together in hopes that it will help someone else. If this is elsewhere out there, please accept my apologies.
I recently decided to switch my Cacti server from CentOS 5 to Windows. This was done primarily because others in my organization have more experience with Windows and they need to administer this too. I had a lot of data in my Linux instance that I did not want to loose. Figuring out how to move the SQL data from one server to the other was pretty easy and in reality moving the rrd files one by one was easy but I had 26 hosts and over 230 rrd files so I really didn't want to do all of these by hand. I looked for some scripts and found a couple that helped go from Windows to Linux (http://forums.cacti.net/post-78443.html) but none to go back. I also found that just changing the windows script to restore from dump didn't help since the restore command needs to have the .rrd extension specified at the end. I have had experience in many of my jobs with writing scripts to make my jobs easier so I embarked on this task.
I have attached a zip with two files. First is the windows script to import the xml files. I wrote it in WScript so all you should need to do is run Importrrd.vbs from the command line. You will need to edit the script to change the variables at the top to reflect your install. The second file is a bash script to dump all the rrds from the linux cacti instance and then tar them up. All you need to do is update the variables at the top of the file with the location of your install and then make the file executable. When you run the file, it will dump all the rrds out to the directory you chose, tar them up and then clean them up from the directory.
While I've used this several times on my system with success, I won't be responsible if it causes issues with your system. My next thing to try is to create this using Windows PowerShell. The scripting is much simpler with PS but since it's newer to me it will take me longer. Once I have the PS script done, I'll post it too for those interested. If you have problems, let me know and I'll try to help you with them.
| Description: |
| Linux bash and Windows WScript scripts for rrd conversion. |
|
 Download |
| Filename: |
RRDConversion.zip |
| Filesize: |
989 Bytes |
| Downloaded: |
200 Time(s) |
|
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9671 Location: MI, USA
|
Posted: Sun Dec 16, 2007 6:02 am Post subject: |
|
|
Thanks for the script. I will move this post to the "How To" section of the forums.
TheWitness
|
|
| Back to top |
|
 |
0.o
Joined: 26 Nov 2007 Posts: 8
|
Posted: Mon Feb 04, 2008 7:54 pm Post subject: |
|
|
I too wrote a small shell script to import/dump rrd to and from xml. It is very simple. If you execute it in the top of the directory where your rrd files are stored, it will dump them to xml and remove the rrd.
| Code: |
#!/bin/sh
ECHO="echo -e"
rrdump ()
{
for rrd in `find . -type f -name "*.rrd"`
do
xml=`echo $rrd | sed 's/.rrd//g'`
rrdtool dump $rrd > $xml.xml
rm $rrd
done
}
xmlimport ()
{
for xml in `find . -type f -name "*.xml"`
do
rrd=`echo $xml | sed 's/.xml//g'`
rrdtool restore $xml $rrd.rrd
rm $xml
done
}
case "$1" in
dump)
rrdump
;;
import)
xmlimport
;;
*)
$ECHO "$0 takes one of two arguments\n"
$ECHO "$0 dump -- dumps contents to xml\n"
$ECHO "$0 import -- imports xml files to rrd\n"
;;
esac
|
|
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9671 Location: MI, USA
|
Posted: Mon Feb 04, 2008 9:15 pm Post subject: |
|
|
Thought that I would add to this, before I forgot. Below are two scripts. The first takes your RRD files (from a single directory) and dumps them to XML, the second takes your XML files and imports them to new RRD files.
This both scripts are meant to run at the same time for moving between 32bit and 64bit systems.
So, it works this way:
On server A export a temporary file sytem so it can be mounted on the other system (server B).
On the second system (server B) create a directory and then mount the other systems (server A) temporary file system.
On the "new system" (server B) run makerrd.sh. This script waits to see XML files appear on the temporary file system.
On the old system (server A), where have the old RRD files, run the makexml.sh script. Once it starts, your new system (server B) will start to convert the XML's to RRD files. It can be pretty fast on a Gigabit ethernet system and can allow you to migrate from an old box to a new box without skipping a beat.
Regards,
TheWitness
| Description: |
|
 Download |
| Filename: |
makexml.sh |
| Filesize: |
3.99 KB |
| Downloaded: |
130 Time(s) |
| Description: |
|
 Download |
| Filename: |
makerrd.sh |
| Filesize: |
4.88 KB |
| Downloaded: |
135 Time(s) |
|
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|