[HOWTO] Migrating between architectures and directories

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

SeanW
Posts: 26
Joined: Tue Nov 28, 2006 9:17 am
Location: Winnipeg, Canada
Contact:

[HOWTO] Migrating between architectures and directories

Post by SeanW »

I'm moving from a 32 bit machine to a 64 bit machine and was getting "different architecture" errors just by copying over the RRD files. I also moved from the tarball on the old machine to using the rpms from fc6 on the new one, so the paths in the db had to be updated from /var/www/html/cacti to /usr/share/cacti. Here's a script that fixes all the problems by exporting the rrds on the old server (OLDSERVER) and reimports them on the new server.:

Code: Select all

#!/bin/sh


ssh OLDSERVER mysqldump cacti > /tmp/cacti.sql
perl -i.bak -p -e 's|/var/www/html/cacti|/usr/share/cacti|g' /tmp/cacti.sql
mysql cacti < /tmp/cacti.sql

rsync -avz OLDSERVER:/var/www/html/cacti/scripts/ /var/lib/cacti/scripts/
#rsync -avz OLDSERVER:/var/www/html/cacti/rra/ /var/lib/cacti/rra/
ssh OLDSERVER '(cd /var/www/html/cacti/rra; for i in *.rrd; do rrdtool dump $i > $i.xml; done)'
rm -rf /var/lib/cacti/rra/
mkdir /var/lib/cacti/rra/
chown cacti /var/lib/cacti/rra/
rsync -avz --exclude=*.rrd OLDSERVER:/var/www/html/cacti/rra/ /var/lib/cacti/rra/
for i in /var/lib/cacti/rra/*.xml; do A=`echo $i|sed 's/\.xml//'`; rrdtool restore -f $i $A; done
rsync -avz OLDSERVER:/var/www/html/cacti/resource/ /usr/share/cacti/resource/
rsync -avz OLDSERVER:/var/www/html/cacti/include/config.php /usr/share/cacti/include/
rsync -avz OLDSERVER:/etc/cactid.conf /etc/
(edit: clarified the purpose of the script)
Last edited by SeanW on Sun Jan 14, 2007 1:53 pm, edited 1 time in total.
User avatar
adrianmarsh
Cacti User
Posts: 437
Joined: Wed Aug 17, 2005 8:51 am
Location: UK

Post by adrianmarsh »

Where do you get the "different" messages? From Cacti, Cactid, rrdtool?, something else?? Is it during the transfer, or afterwards in Cacti? What else gets put in the debug log ?
SeanW
Posts: 26
Joined: Tue Nov 28, 2006 9:17 am
Location: Winnipeg, Canada
Contact:

Post by SeanW »

adrianmarsh wrote:Where do you get the "different" messages? From Cacti, Cactid, rrdtool?, something else?? Is it during the transfer, or afterwards in Cacti? What else gets put in the debug log ?
None of my graphs were showing up on the new system so I went into graph debug mode and saw the message (ie the output of rrdtool graph). I suspect that the poller would have had problems too, but I fixed this before getting the poller running on the new system.

Sean
User avatar
adrianmarsh
Cacti User
Posts: 437
Joined: Wed Aug 17, 2005 8:51 am
Location: UK

Post by adrianmarsh »

Which versions of rrdtool are on the 2 systems ?
SeanW
Posts: 26
Joined: Tue Nov 28, 2006 9:17 am
Location: Winnipeg, Canada
Contact:

Post by SeanW »

adrianmarsh wrote:Which versions of rrdtool are on the 2 systems ?
They're both FC6 boxes running 1.2.15.

From the new (64 bit) box

# scp netmon1:/var/www/html/cacti/rra/cwlb1canada_cpu_re_1059.rrd .
# rrdtool info cwlb1canada_cpu_re_1059.rrd
ERROR: This RRD was created on other architecture

Sean
User avatar
adrianmarsh
Cacti User
Posts: 437
Joined: Wed Aug 17, 2005 8:51 am
Location: UK

Post by adrianmarsh »

See here and maybe post a bug report to rrdtools site
SeanW
Posts: 26
Joined: Tue Nov 28, 2006 9:17 am
Location: Winnipeg, Canada
Contact:

Post by SeanW »

adrianmarsh wrote:See here and maybe post a bug report to rrdtools site
Where's the bug? Everything works perfectly. I was just sharing my script with others in case they ran into this case when moving between platforms.

Edit: Hrm, maybe I should have been more clear in my original message that I solved the problem on my own :) Sorry

Sean
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Migrating between architectures and directories

Post by gandalf »

SeanW wrote:I'm moving from a 32 bit machine to a 64 bit machine and was getting "different architecture" errors just by copying over the RRD files.
I suppose, you'll have to rrdtool dump on the old and rrdtool restore on the new system. It is known, that rrd file structure is architecture dependant.
you may want to search the forums for a nice shell script automating the task. Lately, some user contributed this stuff
Reinhard
SeanW
Posts: 26
Joined: Tue Nov 28, 2006 9:17 am
Location: Winnipeg, Canada
Contact:

Re: Migrating between architectures and directories

Post by SeanW »

gandalf wrote:
SeanW wrote:I'm moving from a 32 bit machine to a 64 bit machine and was getting "different architecture" errors just by copying over the RRD files.
I suppose, you'll have to rrdtool dump on the old and rrdtool restore on the new system. It is known, that rrd file structure is architecture dependant.
you may want to search the forums for a nice shell script automating the task. Lately, some user contributed this stuff
Reinhard
Thanks. I probably should have been more clear in my original message -- I ran into the problem and fixed it. The script I attached does the job automagically, along with changing the directories within the database.

Sean
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Oh, sorry; I've not read all stuff :oops: . Thanks for your contribution
Reinhard
User avatar
zorrosam
Cacti User
Posts: 244
Joined: Thu May 03, 2007 3:17 pm
Location: Italy

help me for script during migration of rrd files

Post by zorrosam »

please help me ...

these scripts are all ok .... but when i tried to restore the rrd files on my new server i obtain these error message from my script:

[root@xxxxx sam]# for i in rra/*/*.xml; do A=`echo $i|sed 's/\.xml//'`; rrdtool restore -f $i $A; done
-bash: /usr/bin/rrdtool: Argument list too long

who can help me for changing the scripts?

i have almost 12000 rrd in my dir and maybe is a number too high for this script .... i have tried to change the script with a cycle for but i'm not able to do this.

let me know!

sam
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: help me for script during migration of rrd files

Post by phalek »

zorrosam wrote:please help me ...

[root@xxxxx sam]# for i in rra/*/*.xml; do A=`echo $i|sed 's/\.xml//'`; rrdtool restore -f $i $A; done
-bash: /usr/bin/rrdtool: Argument list too long

Seem like you have too many * in that line. Shouldn't it be

Code: Select all

for i in rra/*.xml; do A=`echo $i|sed 's/\.xml//'`; rrdtool restore -f $i $A; done
?
SeanW
Posts: 26
Joined: Tue Nov 28, 2006 9:17 am
Location: Winnipeg, Canada
Contact:

Post by SeanW »

Hi.

root@xxxxx sam]# for i in rra/*/*.xml; do A=`echo $i|sed 's/\.xml//'`; rrdtool restore -f $i $A; done


You should be able to do

find rra -name \*.xml | while read i; do A=`echo $i|sed 's/\.xml//'`; echo rrdtool restore -f $i $A; done


If that spits out the right commands, then remove the echo before the "rrd tool restore" and let 'er go.

Sean
User avatar
zorrosam
Cacti User
Posts: 244
Joined: Thu May 03, 2007 3:17 pm
Location: Italy

yes it works

Post by zorrosam »

Sean .... you're great my friend!

thank's again to the community!

sam
scotia70
Posts: 3
Joined: Sat Feb 14, 2009 8:21 am

Post by scotia70 »

This is a fantastic how-to. Does exactly as I needed (was going from 32-bit RRD to 64-bit).

Thanks very much

Scott
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests