[HOWTO] Scripts to migrate RRDs from Win32 to Linux

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Developers, Moderators

Post Reply
User avatar
cpt_ahab
Cacti User
Posts: 61
Joined: Tue Feb 01, 2005 11:34 am

[HOWTO] Scripts to migrate RRDs from Win32 to Linux

Post by cpt_ahab »

Here are my scripts for ex- and importing the RRD files to my new linux-cacti box

They are very dirty but they work.

On the win32 side
open a file
put this line into it

Code: Select all

FOR /R E:\your\path\to\cacti\rra %%f IN (*.*) DO rrdtool dump %%f > %%f.xml
save it as export.bat in you cacti/rra folder and run the script.
it produces files like <ds-name>.rrd.xml. it will produce some errors for files in the rra-folder that arent rrd-files. but this is no problem.

afterwards mount the windows-folder in your linux box
edit the following script for your needs

mounted is the folder where your cacti/rra Folder is mounted
cactipath is where your new rra-folder is on your linuxbox.

Code: Select all

#!/bin/bash
#import xml 2 rrd
cactipath='/your/path/to/cacti/rra'
mounted='/mnt/somedrive'
files=$(ls $mounted | grep .xml | cut -d "." -f 1 )
for i in $files; do
        rrdtool restore "$mounted/$i.rrd.xml" "$cactipath/$i.rrd"
        echo "$i.xml nach $cactipath/$i.rrd importiert"
done
run the script and you are done
your rrd-files should be in your cacti/rra folder

greez jan
Last edited by cpt_ahab on Wed Dec 20, 2006 7:17 am, edited 1 time in total.
cacti 0.8.6j ** cactid 0.8.6d ** rrdtool 1.2.15
Debain ** Apache 2 ** PHP 4.3.0
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

I have been thinking about writing a nice set of scripts that will do this work either live or in batch from and to win32/64, linux32/64, OSX, Freebsd32/64 and etc....

Haven't the time... :(
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests