Migrating Cacti From One Server to Another
Posted by Mr. IT Guy | Filed under Howto, IT in General, Linux
Here’s what I did to transfer my cacti from and old beat up server to a newer one. My old server is running Ubuntu 6.10 (Edgy Eft) and my new server is running Ubuntu 8.04 (Hardy Heron).
- Install Cacti on the New Server
- Turn Off Cacti at the Old Server
- Migrate the Database
- Copy the RRD Files as XML
- Reconvert the XML back to RRD File
- Activate the New Cacti
More details available after the jump.
1. Installing Cacti on the New Server
- Run the command
sudo apt-get install cacti
- Use dbconfig and put in the passwords requested
- Run the command
vi /etc/cron.d/cacti
- Disable the poller by putting the character ‘#’ in front of the crontab entry then save & quit
2. Turn Off Cacti at the Old Server
- Run the command
vi /etc/cron.d/cacti
- put the character ‘#’ in front of the crontab entry to disable the polling then save & quit
- (Optional) Remove the symlink from
/etc/apache2/conf.d/cacti
3. Migrate the Database
- At the old server, run the command
mysqldump cacti > ~/cacti.sql
- SFTP into the old server and grab the data
- Run the command
mysql cacti < ~/cacti.sql
(NOTE:use -u to change user, –password= to use the password, and choose the path to where the cacti.sql downloaded)
4. Copy RRD File as XML
- Goto the directory
/var/lib/cacti/rra/
- Run the following script
ls -1 *.rrd | awk '{print "rrdtool dump "$1" > "$1".xml"}' | sh -x
- Tar & GZip the XML files using the command
tar -czvf ~/rrd.tgz *.rrd.xml
6. Reconvert the XML back to RRD
- SFTP into the old server and download the ‘rrd.tgz’ created in the step before
- Move the file to the new
/var/lib/cacti/rra/
directory
- Run the command
ls -1 *.rrd.xml | sed 's/\.xml//' | awk '{print "rrdtool restore "$1".xml "$1}' | sh -x
- Change ownership of all RRD files to www-data by running the command:
chown www-data:www-data *.rrd
7. Activate the New Cacti
- Visit the new site and set the mode to ‘Upgrade’
- Reactivate the Poller
- Run the command
vi /etc/cron.d/cacti
- Enable the poller by removing the character ‘#’ in front of the crontab entry then save & quit
Tags: Linux
Leave a Reply
You must be logged in to post a comment.






