[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: Moderators, Developers

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

[HOWTO] Migrating between architectures and directories

#1 Post by SeanW » Wed Jan 10, 2007 11:06 am

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: 435
Joined: Wed Aug 17, 2005 8:51 am
Location: UK

#2 Post by adrianmarsh » Sat Jan 13, 2007 5:23 pm

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:

#3 Post by SeanW » Sat Jan 13, 2007 5:26 pm

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: 435
Joined: Wed Aug 17, 2005 8:51 am
Location: UK

#4 Post by adrianmarsh » Sun Jan 14, 2007 3:42 am

Which versions of rrdtool are on the 2 systems ?

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

#5 Post by SeanW » Sun Jan 14, 2007 9:15 am

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: 435
Joined: Wed Aug 17, 2005 8:51 am
Location: UK

#6 Post by adrianmarsh » Sun Jan 14, 2007 9:25 am

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:

#7 Post by SeanW » Sun Jan 14, 2007 9:42 am

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: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Migrating between architectures and directories

#8 Post by gandalf » Sun Jan 14, 2007 1:26 pm

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

#9 Post by SeanW » Sun Jan 14, 2007 1:32 pm

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: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#10 Post by gandalf » Sun Jan 14, 2007 1:41 pm

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

#11 Post by zorrosam » Mon Apr 21, 2008 7:33 am

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:

[[email protected] 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
Cacti Guru User
Posts: 2711
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: help me for script during migration of rrd files

#12 Post by phalek » Mon Apr 21, 2008 7:39 am

zorrosam wrote:please help me ...

[[email protected] 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:

#13 Post by SeanW » Mon Apr 21, 2008 7:39 am

Hi.

[email protected] 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

#14 Post by zorrosam » Mon Apr 21, 2008 7:49 am

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

thank's again to the community!

sam

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

#15 Post by scotia70 » Sat Feb 14, 2009 9:18 am

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