Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Sun Jun 24, 2018 4:56 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: [HOWTO] Migrating between architectures and directories
PostPosted: Wed Jan 10, 2007 11:06 am 
Offline

Joined: Tue Nov 28, 2006 9:17 am
Posts: 26
Location: Winnipeg, Canada
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.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 13, 2007 5:23 pm 
Offline
Cacti User
User avatar

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


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 13, 2007 5:26 pm 
Offline

Joined: Tue Nov 28, 2006 9:17 am
Posts: 26
Location: Winnipeg, Canada
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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 14, 2007 3:42 am 
Offline
Cacti User
User avatar

Joined: Wed Aug 17, 2005 8:51 am
Posts: 427
Location: UK
Which versions of rrdtool are on the 2 systems ?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 14, 2007 9:15 am 
Offline

Joined: Tue Nov 28, 2006 9:17 am
Posts: 26
Location: Winnipeg, Canada
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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 14, 2007 9:25 am 
Offline
Cacti User
User avatar

Joined: Wed Aug 17, 2005 8:51 am
Posts: 427
Location: UK
See here and maybe post a bug report to rrdtools site


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 14, 2007 9:42 am 
Offline

Joined: Tue Nov 28, 2006 9:17 am
Posts: 26
Location: Winnipeg, Canada
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


Top
 Profile  
 
 Post subject: Re: Migrating between architectures and directories
PostPosted: Sun Jan 14, 2007 1:26 pm 
Offline
Developer
User avatar

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

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: Re: Migrating between architectures and directories
PostPosted: Sun Jan 14, 2007 1:32 pm 
Offline

Joined: Tue Nov 28, 2006 9:17 am
Posts: 26
Location: Winnipeg, Canada
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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 14, 2007 1:41 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
Oh, sorry; I've not read all stuff :oops: . Thanks for your contribution
Reinhard

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: help me for script during migration of rrd files
PostPosted: Mon Apr 21, 2008 7:33 am 
Offline
Cacti User
User avatar

Joined: Thu May 03, 2007 3:17 pm
Posts: 244
Location: Italy
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


Top
 Profile  
 
 Post subject: Re: help me for script during migration of rrd files
PostPosted: Mon Apr 21, 2008 7:39 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Jan 31, 2008 6:39 am
Posts: 2684
Location: Kressbronn, Germany
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:
for i in rra/*.xml; do A=`echo $i|sed 's/\.xml//'`; rrdtool restore -f $i $A; done


?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 21, 2008 7:39 am 
Offline

Joined: Tue Nov 28, 2006 9:17 am
Posts: 26
Location: Winnipeg, Canada
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


Top
 Profile  
 
 Post subject: yes it works
PostPosted: Mon Apr 21, 2008 7:49 am 
Offline
Cacti User
User avatar

Joined: Thu May 03, 2007 3:17 pm
Posts: 244
Location: Italy
Sean .... you're great my friend!

thank's again to the community!

sam


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 14, 2009 9:18 am 
Offline

Joined: Sat Feb 14, 2009 8:21 am
Posts: 3
This is a fantastic how-to. Does exactly as I needed (was going from 32-bit RRD to 64-bit).

Thanks very much

Scott


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group