|
|
| Author |
Message |
SeanW
Joined: 28 Nov 2006 Posts: 24 Location: Winnipeg, Canada
|
Posted: Wed Jan 10, 2007 11:06 am Post subject: [HOWTO] Migrating between architectures and directories |
|
|
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: | #!/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 |
|
| Back to top |
|
 |
adrianmarsh Cacti User
Joined: 17 Aug 2005 Posts: 417 Location: UK
|
Posted: Sat Jan 13, 2007 5:23 pm Post subject: |
|
|
| 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 ? |
|
| Back to top |
|
 |
SeanW
Joined: 28 Nov 2006 Posts: 24 Location: Winnipeg, Canada
|
Posted: Sat Jan 13, 2007 5:26 pm Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
adrianmarsh Cacti User
Joined: 17 Aug 2005 Posts: 417 Location: UK
|
Posted: Sun Jan 14, 2007 3:42 am Post subject: |
|
|
| Which versions of rrdtool are on the 2 systems ? |
|
| Back to top |
|
 |
SeanW
Joined: 28 Nov 2006 Posts: 24 Location: Winnipeg, Canada
|
Posted: Sun Jan 14, 2007 9:15 am Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
adrianmarsh Cacti User
Joined: 17 Aug 2005 Posts: 417 Location: UK
|
Posted: Sun Jan 14, 2007 9:25 am Post subject: |
|
|
| See here and maybe post a bug report to rrdtools site |
|
| Back to top |
|
 |
SeanW
Joined: 28 Nov 2006 Posts: 24 Location: Winnipeg, Canada
|
Posted: Sun Jan 14, 2007 9:42 am Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12295 Location: Muenster, Germany
|
Posted: Sun Jan 14, 2007 1:26 pm Post subject: Re: Migrating between architectures and directories |
|
|
| 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 |
|
| Back to top |
|
 |
SeanW
Joined: 28 Nov 2006 Posts: 24 Location: Winnipeg, Canada
|
Posted: Sun Jan 14, 2007 1:32 pm Post subject: Re: Migrating between architectures and directories |
|
|
| 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 |
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12295 Location: Muenster, Germany
|
Posted: Sun Jan 14, 2007 1:41 pm Post subject: |
|
|
Oh, sorry; I've not read all stuff . Thanks for your contribution
Reinhard |
|
| Back to top |
|
 |
zorrosam Cacti User
Joined: 03 May 2007 Posts: 153 Location: Italy
|
Posted: Mon Apr 21, 2008 7:33 am Post subject: help me for script during migration of rrd files |
|
|
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 |
|
| Back to top |
|
 |
phalek Cacti User
Joined: 31 Jan 2008 Posts: 165 Location: Kressbronn, Germany
|
Posted: Mon Apr 21, 2008 7:39 am Post subject: Re: help me for script during migration of rrd files |
|
|
| 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: |
for i in rra/*.xml; do A=`echo $i|sed 's/\.xml//'`; rrdtool restore -f $i $A; done
|
? |
|
| Back to top |
|
 |
SeanW
Joined: 28 Nov 2006 Posts: 24 Location: Winnipeg, Canada
|
Posted: Mon Apr 21, 2008 7:39 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
zorrosam Cacti User
Joined: 03 May 2007 Posts: 153 Location: Italy
|
Posted: Mon Apr 21, 2008 7:49 am Post subject: yes it works |
|
|
Sean .... you're great my friend!
thank's again to the community!
sam |
|
| Back to top |
|
 |
|