Moving Cacti from old host to new host

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
gigglesworth
Posts: 24
Joined: Wed Jan 25, 2006 12:51 pm

Moving Cacti from old host to new host

Post by gigglesworth »

I would like to move my Cacti installation from an old host to a new host. Both servers are running SuSE 9.2 with Cacti 0.8.6h .

Does anybody have any hints or guides for this process?

I think mostly I need to copy some of our custom templates over from the old machine, and then I need to follow some of the instructions in the Upgrade Guide at http://www.cacti.net/downloads/docs/html/upgrade.html, which say:
# Copy the *.rrd files from the old Cacti directory.

shell> cp cacti_old/rra/* cacti/rra/

# Copy any relevant custom scripts from the old Cacti directory.

shell> cp -u cacti_old/scripts/* cacti/scripts/

# Copy any relevant custom resource XML files from the old

shell> cp -u -R cacti_old/resource/* cacti/resource/

Is this most of what I need to do?

Thank you,

-= Stefan
Chris W
Posts: 23
Joined: Fri Jun 16, 2006 2:05 pm

Post by Chris W »

Do you want to move the old data, or just the configurations?

If you want the data, you will need to dump the contents of the 'cacti' database out into a file from the old server, then re-import it into the new server.

This is what I am trying to do :-?
Chris W
Posts: 23
Joined: Fri Jun 16, 2006 2:05 pm

Post by Chris W »

OK, I have got everything going. I moved from Solaris 8 to Mac OS X 10.4, and kept all of my data. So I'm happy!

This is what I did:

* stopped the poller running on the Solaris box (edited crontab)

* dumped the cacti database on the Solaris box:

mysqldump -u root -p cacti > cacti-dump.sql

* copied the cacti-dump.sql file from the Solaris box to the Mac OS X box

* archived resource and scripts directory on Solaris box:

cd /usr/local/cacti ; tar cvf cacti-data.tar resource scripts

* copied the cacti-data.tar file from the Solaris box to the Mac OS X box

* dumped RRA files on Solaris box from RRD format into XML format:

cd /usr/local/cacti
for i in *.rrd
do
rrdtool dump $i > $i.xml

* archived XML files on Solaris box:

cd /usr/local/cacti/rra ; tar cvf rra-output.tar *.xml

* copied the rra-output.tar file from the Solaris box to the Mac OS X box

* installed a fresh copy of cacti on Mac OS X box. Used same versions of MySQL, Apache, PHP and rrdtool as on the Solaris box. Installed into the same paths as on Solaris box (e.g. /usr/local/apache2, /usr/local/cacti, etc). Make sure you edit cacti/includes/config.php to match your new database information!

* imported data from the Solaris box's MySQL database into the Mac OS X box:

mysql -u root -p
DROP DATABASE cacti;
CREATE DATABASE cacti;

mysql -u root -p < cacti-dump.sql

mysql -u root -p
GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY '********';
FLUSH PRIVILEGES;

* unpacked the archived resources and scripts files on the Mac OS X box:

cd /usr/local/cacti ; tar xvf /path/to/cacti-data.tar

* unpacked the archived XML files on the Mac OS X box:

cd /usr/local/cacti ; tar xvf /path/to/rra-output.tar

* converted the XML files back to RRD files:

cd /usr/local/cacti
for i in *.xml
do
rrdtool restore $i `basename $i .xml`
done

* removed the old XML files:

cd /usr/local/cacti ; rm -f *.xml

* logged on to the cacti page in browser.

go to Settings panel, make sure that all options in Paths are set correctly to the new server!

I hope this covers everything...
Chris W
Posts: 23
Joined: Fri Jun 16, 2006 2:05 pm

Post by Chris W »

Please note that I had to do the rrdtool dump & restore because I changed architectures. You should be able to avoid that -- you will just need to copy the rra directory from one machine to the other.

Make sure the paths are setup correctly on the new server!!! They will need to match (or you will need to change) what is referenced on the old server...
gigglesworth
Posts: 24
Joined: Wed Jan 25, 2006 12:51 pm

Post by gigglesworth »

Well, this mostly worked. I can now view the datasources, graphs, etc. on the new server.

Unfortunately, I missed a step or something isn't working right. My RRD files aren't being updated at all. In this example, note how the file has not been updated in several hours:

Code: Select all

# date
Wed Sep 20 18:06:54 PDT 2006
# ll /srv/www/htdocs/cacti/rra/google_ping_ping_204.rrd
-rw-r--r--  1 cacti www 47836 Sep 20 14:49 /srv/www/htdocs/cacti/rra/google_ping_ping_204.rrd
I turned on debug logging, and I see no errors about writing to srv/www/htdocs/cacti/rra/google_ping_ping_204.rrd -- so I'm not sure what is going on.
Chris W
Posts: 23
Joined: Fri Jun 16, 2006 2:05 pm

Post by Chris W »

That is strange. Are you sure that MySQL is running? Are you sure that the cacti user has the correct credentials to connect to MySQL? Does the cacti user have the correct permissions to be able to update the data in the database?

Now that I think about it, if the file itself is not updated then I doubt the problem is related to MySQL.

What happens when you execute poller.php from the command line? For example: /usr/local/bin/php /usr/local/cacti/poller.php ?

When I moved my cacti installation from Solaris to Mac OS X, I went from having php in /usr/local/php/bin to /opt/local/php/bin/php. So, I had to change the first line of the poller.php script. Perhaps the poller is not running correctly?
gigglesworth
Posts: 24
Joined: Wed Jan 25, 2006 12:51 pm

Post by gigglesworth »

(Thanks for your help!)

Arg. This is driving me crazy.

There are no sql errors in the logfiles.

It seems like the Cacti user is not creating new RRD files either. What really bugs me is that the debug logs contain no output which look like 'rrdtool create' anywhere.

I try to create a new device called 'webdev4-test', and then I create couple of graphs. There are no errors in the GUI during creation, and I even see message like this in the logfile:

Code: Select all

09/21/2006 11:05:18 AM - WEBLOG: Poller[0] CACTI2RRD: /usr/bin/rrdtool graph -  --imgformat=PNG  --start=-33053184  --end=-86400  --title="webdev4-test - Used Space - /"  --rigid  --base=1024  --height=120  --width=500  --alt-autoscale-max  --lower-limit=0  --vertical-label="bytes" DEF:a="/srv/www/htdocs/cacti/rra/webdev4test_hdd_total_496.rrd":hdd_total:AVERAGE  DEF:b="/srv/www/htdocs/cacti/rra/webdev4test_hdd_total_496.rrd":hdd_used:AVERAGE  AREA:a#002A97:"Total"   GPRINT:a:LAST:"Current\:%8.2lf %s"   GPRINT:a:AVERAGE:"Average\:%8.2lf %s"   GPRINT:a:MAX:"
Maximum\:%8.2lf %s\n"   AREA:b#F51D30:"Used"   GPRINT:b:LAST:" Current\:%8.2lf %s"   GPRINT:b:AVERAGE:"Average\:%8.2lf %s"   GPRINT:b:MAX:"Maximum\:%8.2lf %s\n"   COMMENT:"Graph last updated on Wed 20 Sep 14:35:08 PDT 2006"
However, later on I see errors like this:

Code: Select all

ERROR: opening '/srv/www/htdocs/cacti/rra/webdev4test_hdd_total_496.rrd': No such file or directory
If I "Turn On Data Source Debug Mode" for this datasource, I see the following lines but no errors.

Code: Select all

Data Source Debug

/usr/bin/rrdtool create \
/srv/www/htdocs/cacti/rra/webdev4test_hdd_total_496.rrd \
--step 300  \
DS:hdd_total:GAUGE:600:0:U \
DS:hdd_used:GAUGE:600:0:U \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \
But the file is never created.

I can even execute this command on the commandline without error, as user 'cacti'.
gigglesworth
Posts: 24
Joined: Wed Jan 25, 2006 12:51 pm

Post by gigglesworth »

Bah --- I think I figured it out.

The firewall blocks the SNMP queries from this new host. Apparently Cacti will not create the new RRD files if the SNMP query fails.

At least, I think that is what is happening.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests