Skip to content

Update and Migrate Cacti To a New Server

In this post I will show how to migrate and update Cacti from an old server to a new server. In my case, old server platform was Red Hat 5 and Cacti was 0.8x version. As Red Hat 5 is old and you can't really upgrade it, I needed to migrate Cacti installation to a new Redhat 7.7 server. Besides that, Cacti was planned to be upgraded to 1.x version.

Process is actually quite simple - you need a new Cacti installation and there are many instructions for that. I installed Cacti 1.2.11 version using MariaDB 5.6.x and PHP 5.4.

Second step is to migrate existing configuration and possible graphs and plugins.


1. Install Fresh Cacti


As there are several installation instructions available, I don't go those over here. Do not run the installer using browser before migrating DB :-)


2. Move DB Configuration


Database is actually quite simple to clone to a different server - mysqldump and mysql are your friends here. You can dump the values to an sql file and then import it in a similar way:


Export:
[root@localhost ~]$ mysqldump cacti -u root -p > old_cacti_db.sql - command will dump DB "cacti" through stdout
Import:
[root@localhost ~]$ mysql -u root -p cacti < cacti.sql - command will import cacti.sql to DB "cacti" throush stdin

You can log in to mysql to manually browse or modify something:
[root@localhost ~]$ mysql -u root -p

It must be noted that if you migrate to a different OS or server platorm, you may need to change the paths in the database. That was not needed in my case as Cacti installation was in /usr/share/cacti for both servers, but if you have different you must change these values in the DB.


To fix the paths in DB, you can either edit it manually using some SQL browser or then using mysql, you can use the REPLACE command for settings:


UPDATE settings SET VALUE = REPLACE(VALUE, '/old/path/to/cacti', '/usr/share/cacti')

Finish Cacti installation


After you have migrated the DB, launch Cacti installer using browser to your server server-ip/cacti. Setup is pretty simple and I won't go the steps here. However I would like to point that in my case, PHP and MariaDB settings needed to be optimized. Cacti installer will automatically show these and you can edit them in below files:


php.ini - Main PHP Configuration file
etc/my.cnf.d/server.cnf - MariaDB custom config file

I needed to tweak many MariaDB settings that go under [mysql] section in the file. Following values have been stable for me.


[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
max_allowed_packet=16777216
max_heap_table_size=112M
tmp_table_size=112M
join_buffer_size=192M
innodb_file_per_table=ON
innodb_file_format=Barracuda
innodb_large_prefix=1
innodb_buffer_pool_size=1413M
innodb_additional_mem_pool_size=96M
innodb_flush_log_at_trx_commit=2

After successfull installation, it is time to move the graph files. You can find those from old server in rra folder under Cacti folder path/to/cacti/rra/. You can export the graphs using rrdtool, however as my Cacti settings (poller, polling time etc.) were identical, I just moved the files manually to destination server /usr/share/cacti/rra folder.


If you upgrade cacti from 0.8x to 1.x, some plugins may not work. It is feasible to install all plugins manually and not moving the files as that will guarantee that everything is working.

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
Form options

Submitted comments will be subject to moderation before being displayed.