Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


[HOWTO] Migrating between architectures and directories

 
Post new topic   Reply to topic    Cacti Forum Index -> Informational/HOWTO's
Author Message
SeanW



Joined: 28 Nov 2006
Posts: 24
Location: Winnipeg, Canada

PostPosted: Wed Jan 10, 2007 11:06 am    Post subject: [HOWTO] Migrating between architectures and directories Reply with quote

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

PostPosted: Sat Jan 13, 2007 5:23 pm    Post subject: Reply with quote

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

PostPosted: Sat Jan 13, 2007 5:26 pm    Post subject: Reply with quote

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

PostPosted: Sun Jan 14, 2007 3:42 am    Post subject: Reply with quote

Which versions of rrdtool are on the 2 systems ?
Back to top
SeanW



Joined: 28 Nov 2006
Posts: 24
Location: Winnipeg, Canada

PostPosted: Sun Jan 14, 2007 9:15 am    Post subject: Reply with quote

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

PostPosted: Sun Jan 14, 2007 9:25 am    Post subject: Reply with quote

See here and maybe post a bug report to rrdtools site
Back to top
SeanW



Joined: 28 Nov 2006
Posts: 24
Location: Winnipeg, Canada

PostPosted: Sun Jan 14, 2007 9:42 am    Post subject: Reply with quote

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: 12206
Location: Muenster, Germany

PostPosted: Sun Jan 14, 2007 1:26 pm    Post subject: Re: Migrating between architectures and directories Reply with quote

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

PostPosted: Sun Jan 14, 2007 1:32 pm    Post subject: Re: Migrating between architectures and directories Reply with quote

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: 12206
Location: Muenster, Germany

PostPosted: Sun Jan 14, 2007 1:41 pm    Post subject: Reply with quote

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

PostPosted: Mon Apr 21, 2008 7:33 am    Post subject: help me for script during migration of rrd files Reply with quote

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: 157
Location: Kressbronn, Germany

PostPosted: Mon Apr 21, 2008 7:39 am    Post subject: Re: help me for script during migration of rrd files Reply with quote

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

PostPosted: Mon Apr 21, 2008 7:39 am    Post subject: Reply with quote

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

PostPosted: Mon Apr 21, 2008 7:49 am    Post subject: yes it works Reply with quote

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

thank's again to the community!

sam
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Informational/HOWTO's All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group