[HOWTO] Migrating Cacti From One Server to Another

Print this post Email this post

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).

  1. Install Cacti on the New Server
  2. Turn Off Cacti at the Old Server
  3. Migrate the Database
  4. Copy the RRD Files as XML
  5. Reconvert the XML back to RRD File
  6. Activate the New Cacti

More details available after the jump.


1. Installing Cacti on the New Server

  1. Run the command
    sudo apt-get install cacti
  2. Use dbconfig and put in the passwords requested
  3. Run the command
    vi /etc/cron.d/cacti
  4. Disable the poller by putting the character ‘#’ in front of the crontab entry then save & quit

2. Turn Off Cacti at the Old Server

  1. Run the command
    vi /etc/cron.d/cacti
  2. put the character ‘#’ in front of the crontab entry to disable the polling then save & quit
  3. (Optional) Remove the symlink from
    /etc/apache2/conf.d/cacti

3. Migrate the Database

  1. At the old server, run the command
    mysqldump cacti > ~/cacti.sql
  2. SFTP into the old server and grab the data
  3. 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

  1. Goto the directory
    /var/lib/cacti/rra/
  2. Run the following script
    ls -1 *.rrd | awk '{print "rrdtool dump "$1" &gt; "$1".xml"}' | sh -x
  3. Tar & GZip the XML files using the command
    tar -czvf ~/rrd.tgz *.rrd.xml

6. Reconvert the XML back to RRD

  1. SFTP into the old server and download the ‘rrd.tgz’ created in the step before
  2. Move the file to the new
    /var/lib/cacti/rra/

    directory

  3. Run the command
    ls -1 *.rrd.xml | sed 's/\.xml//' | awk '{print "rrdtool restore "$1".xml "$1}' | sh -x
  4. Change ownership of all RRD files to www-data by running the command:
    chown www-data:www-data *.rrd

7. Activate the New Cacti

  1. Visit the new site and set the mode to ‘Upgrade’
  2. Reactivate the Poller
  3. Run the command
    vi /etc/cron.d/cacti
  4. Enable the poller by removing the character ‘#’ in front of the crontab entry then save & quit
Be Sociable, Share!

Tags:

One Response to “[HOWTO] Migrating Cacti From One Server to Another”

  1. WordPress – Weekly Dump (weekly) | ResponsiPaul Says:
    November 8th, 2014 at 9:12 pm

    […] [HOWTO] Migrating Cacti From One Server to Another | Life in 0 and 1 […]

Leave a Reply

You must be logged in to post a comment.