Migration of Cacti From Old Server to New Server

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

Moderators: Developers, Moderators

tkdan235
Posts: 17
Joined: Thu Apr 27, 2006 6:46 pm
Location: Sacramento, Ca

Migration of Cacti From Old Server to New Server

Post by tkdan235 »

I have just finished installing Cacti 0.8.6h with CentOS on my new powerful server, but have yet to have migrated the data from my old server. My old server is cacti 0.8.6h as well with FreeBSD.

I know I need to pull over my rra and log files for all of the past data. How exactly do I move the mysql information?

Is there anything else I need to do?
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Dump the mysql database, and restore it on the new server.

You might also need to translate your rrdtool files. This process involves dumping them all to XML on the old server and importing them all into rrd files on the new server. Usually arch changes or OS changes require this action. FreeBSD to Linux probably requires this.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
tkdan235
Posts: 17
Joined: Thu Apr 27, 2006 6:46 pm
Location: Sacramento, Ca

Post by tkdan235 »

Yea so it looks like I have a mess on my hands... after playing with this for the past 4 days I have encountered some new obstacles.

I am using a newer version of cacti with plugins that require the mysql database to stay in tact. So If I simply copy over the top of the existing database on the new server, then it will break my new configuration of cacti. (But the server items will import in the gui)

Is there a trigger or a way to import only the device data into my new cacti installation without affecting the new configuration?

I am new to translating my rrdtool files, how exactly do I do this? What exactly does it do? Any example commands?

Thanks for your time helping me solve this. I greatly appreciate it.
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

First, start with an install that is without plugins, matching your current install. That will resolve most of the issues you have encountered.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
tkdan235
Posts: 17
Joined: Thu Apr 27, 2006 6:46 pm
Location: Sacramento, Ca

Post by tkdan235 »

Well with that in mind, I still need to use the rrdtool dump command in order to to move my .rrd files. Here are the commands I am using:

rrdtool dump filename.rrd > filename.xml
rrdtool restore filename.xml > filename.rrd

Thats great and all, but I have over 400 .rrd files to do this to. Is there a faster way rather than going from file to file?
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Use a script.. :) Something like...

Create XML files:

Code: Select all

ls -1 *.rrd | awk '{print "rrdtool dump "$1" > "$1".xml"}' | sh -x
Restore RRD files:

Code: Select all

ls -1 *.rrd.xml | sed 's/\.xml//' | awk '{print "rrdtool restore "$1".xml "$1}' | sh -x
Run the first command in the rra directory. It will generate the XML files that you move over to the new server, then run the second command to remake the rrdtool files.

Disclaimer, I wrote these without testing them. To test, just don't add the final pipe to the end so that you can see the resulting commands that would be executed.
Last edited by rony on Tue May 23, 2006 6:40 pm, edited 1 time in total.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
tkdan235
Posts: 17
Joined: Thu Apr 27, 2006 6:46 pm
Location: Sacramento, Ca

Post by tkdan235 »

Code: Select all

ERROR: usage rrdtool restore [--range-check/-r] [--force-overwrite/-f] file.xml file.rrd
+ rrdtool restore yoda_hdd_total_890.rrd.xml
ERROR: usage rrdtool restore [--range-check/-r] [--force-overwrite/-f] file.xml file.rrd
+ rrdtool restore yoda_hdd_total_891.rrd.xml
ERROR: usage rrdtool restore [--range-check/-r] [--force-overwrite/-f] file.xml file.rrd
+ rrdtool restore yoda_proc_886.rrd.xml
ERROR: usage rrdtool restore [--range-check/-r] [--force-overwrite/-f] file.xml file.rrd
+ rrdtool restore yoda_traffic_in_894.rrd.xml
ERROR: usage rrdtool restore [--range-check/-r] [--force-overwrite/-f] file.xml file.rrd
+ rrdtool restore yoda_traffic_in_895.rrd.xml
ERROR: usage rrdtool restore [--range-check/-r] [--force-overwrite/-f] file.xml file.rrd
+ rrdtool restore yoda_traffic_in_896.rrd.xml
ERROR: usage rrdtool restore [--range-check/-r] [--force-overwrite/-f] file.xml file.rrd
+ rrdtool restore yoda_traffic_in_897.rrd.xml
ERROR: usage rrdtool restore [--range-check/-r] [--force-overwrite/-f] file.xml file.rrd
+ rrdtool restore yoda_users_885.rrd.xml
ERROR: usage rrdtool restore [--range-check/-r] [--force-overwrite/-f] file.xml file.rrd
[root@localhost rra]# ls -1 *.rrd.xml | sed 's/\.xml//' | awk '{print "rrdtool restore "$1".xml > "$1}' | sh -x
The first line seemed to work great. I got the XML files over to the new server and ran the second line, and above is what I got. (showing only part, since 450 rrd files are to be processed)

Is there a typo in this second 'script' that is causing these errors?
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Yes, use this syntax...

Restore RRD files:

Code: Select all

ls -1 *.rrd.xml | sed 's/\.xml//' | awk '{print "rrdtool restore "$1".xml "$1}' | sh -x
But first, you might want to delete *.rrd from the rra directory.

I was lazy, didn't pay attention to the rrdtool restore syntax, sorry.. :(
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
joy5
Posts: 23
Joined: Wed Jan 17, 2007 10:10 am

Post by joy5 »

rony wrote:Yes, use this syntax...

Restore RRD files:

Code: Select all

ls -1 *.rrd.xml | sed 's/\.xml//' | awk '{print "rrdtool restore "$1".xml "$1}' | sh -x
But first, you might want to delete *.rrd from the rra directory.

I was lazy, didn't pay attention to the rrdtool restore syntax, sorry.. :(
Just to thank you for this help ;)
| Cacti 0.8.6i | Cactid 8.6i |
| Centos 4.4 | PHP 4.3.9 | httpd 2.0.52 | RRDtool 1.2.15 | MySQL 4.1.20 | Net-SNMP 5.1.2 | Dell 1650 | 1 gig RAM|
ncsusma
Posts: 1
Joined: Wed Feb 06, 2008 3:41 pm

Able to import old, unable to poll new data

Post by ncsusma »

I successfully imported MySQL data from my source server, and Cacti polls and fills in data as expected.

I then remove the newly generated .rrd files and replace them with .rrd files generated from an .xml export (as describe above). The old data shows up fine in Cacti, but no new data is saved.

As far as I can tell the poller appears to be working, and the .rrd permissions are set properly. Any suggestions?

Cacti 0.8.7a
PHP 5.1.6
RHEL 5.1 (2.6.18-53.1.6.el5)
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Change crontab entry from

Code: Select all

... php -q /var/www/html/cacti/poller.php > /dev/null 2>&1
to

Code: Select all

... php -q /var/www/html/cacti/poller.php > /var/www/html/cacti/log/poller.log 2>&1
Now you'll find results of rrdtool statements in that very log. Please analyze it
Reinhard
alanstrand
Posts: 2
Joined: Mon Apr 06, 2009 8:22 am

Post by alanstrand »

gandalf wrote:Change crontab entry from

Code: Select all

... php -q /var/www/html/cacti/poller.php > /dev/null 2>&1
to

Code: Select all

... php -q /var/www/html/cacti/poller.php > /var/www/html/cacti/log/poller.log 2>&1
Now you'll find results of rrdtool statements in that very log. Please analyze it
Reinhard
I'm having the same problem. I looked at that log and it's empty. Please help!
alanstrand
Posts: 2
Joined: Mon Apr 06, 2009 8:22 am

Post by alanstrand »

alanstrand wrote:
gandalf wrote:Change crontab entry from

Code: Select all

... php -q /var/www/html/cacti/poller.php > /dev/null 2>&1
to

Code: Select all

... php -q /var/www/html/cacti/poller.php > /var/www/html/cacti/log/poller.log 2>&1
Now you'll find results of rrdtool statements in that very log. Please analyze it
Reinhard
I'm having the same problem. I looked at that log and it's empty. Please help!
I got it working. I had to chown the rra folder:

chown www-data:www-data *
hid3
Cacti User
Posts: 63
Joined: Sat Jun 14, 2008 1:59 am

Post by hid3 »

I have the same problem. Importing and restoring old rrd files makes cacti not update them with data. Debug turned on just says something like "Waiting for poller 1/1". I've triple-checked all the permissions, ownership and etc - everything seems to be ok. Posted here a few posts earlier, however, my thread got no response.

Help me please.. I'm stuck with it already about 2 weeks.. :(
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

hid3 wrote:I have the same problem. Importing and restoring old rrd files makes cacti not update them with data. Debug turned on just says something like "Waiting for poller 1/1". I've triple-checked all the permissions, ownership and etc - everything seems to be ok. Posted here a few posts earlier, however, my thread got no response.

Help me please.. I'm stuck with it already about 2 weeks.. :(
How did you "export/import/restore" your rrd files? Make sure, that you're not hitting an rrdtool problem (there have been issues when exporting/importing using different rrdtool versions)
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest