How to upgrade from PA2.0 to PA2.1 - safely

Support for the Plugin Architecture

Moderators: Developers, Moderators

Post Reply
niobe
Cacti User
Posts: 228
Joined: Mon Mar 10, 2008 6:52 pm
Location: Australia

How to upgrade from PA2.0 to PA2.1 - safely

Post by niobe »

niobe wrote:Any info on whether you can upgrade from 2.0 on a production system and how?
Ok still not much in the way of PA documentation :P Here is the upgrade method I used myself. Note this is an extra careful method since my Cacti is a production system and not good if I break it. If this isn't a concern you can just go ahead and extract the whole PA to your working cacti directory.

Sorry for Windows people but the specifics of this method are for Unix..

1) Backup your current installation. Attached is a shell script that can handle this for you, but check the variables and permissions are right for your system. The script ensure your mysql database is also backed up.

2) Find zipped copies of PA2.0 and PA2.1 and extract them to separate folders. I can't find PA2.0 on cactiusers.org so it's attached here. You have to rename the directories that get extracted else they will overwrite each other.

Code: Select all

[niobe@cacti CactiStuff]$ tar -xvzf cacti-plugin-arch-2.0.tar.gz
[niobe@cacti CactiStuff]$ mv cacti-plugin-arch cacti-plugin-arch-2.0
[niobe@cacti CactiStuff]$ 
[niobe@cacti CactiStuff]$ tar -xvzf cacti-plugin-arch-2.0.tar.gz
[niobe@cacti CactiStuff]$ mv cacti-plugin-arch cacti-plugin-arch-2.0
[niobe@cacti CactiStuff]$ 
[niobe@cacti CactiStuff]$ ls -l | head -n 25
total 29364
drwxrws---  3 niobe netcomms    4096 Apr 21 12:38 cacti-plugin-arch-2.0
-rw-rw----  1 niobe netcomms  173324 Feb 13 06:01 cacti-plugin-arch-2.0.tar.gz
drwxrws---  3 niobe netcomms    4096 Apr 21 12:35 cacti-plugin-arch-2.1
-rw-rw----  1 niobe netcomms  173327 Mar 23 14:47 cacti-plugin-arch-2.1.tar.gz
3) Run diff on the directories and isolate which files have changed:

Code: Select all

[niobe@cacti CactiStuff]$ diff -r cacti-plugin-arch-2.1 cacti-plugin-arch-2.0
This gives you the full output - you'll want to use this later, but for now..

Code: Select all

[niobe@cacti CactiStuff]$ diff -r cacti-plugin-arch-2.1 cacti-plugin-arch-2.0 | egrep 'diff|Only'
Only in cacti-plugin-arch-2.0: cacti-plugin-0.8.7b-PA-v2.0.diff
Only in cacti-plugin-arch-2.1: cacti-plugin-0.8.7b-PA-v2.1.diff
diff -r cacti-plugin-arch-2.1/files-0.8.7b/host.php cacti-plugin-arch-2.0/files-0.8.7b/host.php
diff -r cacti-plugin-arch-2.1/files-0.8.7b/include/global_arrays.php cacti-plugin-arch-2.0/files-0.8.7b/include/global_arrays.php
diff -r cacti-plugin-arch-2.1/files-0.8.7b/include/global.php cacti-plugin-arch-2.0/files-0.8.7b/include/global.php
diff -r cacti-plugin-arch-2.1/files-0.8.7b/include/plugins.php cacti-plugin-arch-2.0/files-0.8.7b/include/plugins.php
diff -r cacti-plugin-arch-2.1/Readme.txt cacti-plugin-arch-2.0/Readme.txt
<     patch -p1 -N < cacti-plugin-0.8.7b-PA-v2.1.diff
>     patch -p1 -N < cacti-plugin-0.8.7b-PA-v2.0.diff
Now you can see which files have changed. At this point you have choice..

4a) Simply overwrite/move these files to you cacti installation.

include/global.php will need to have elements re-added to the plugin array so make sure you have a copy of this before overwriting - or your plugins will magically stop working.

4b) Alternatively you can run a second set of diffs - checking the active cacti file against the new one in PA2.1. What we are looking for is the exact SAME output as when we compared PA2.1 to the PA2.0 files. This double checks that you are overwriting PA2.0 files, not something older and that no other changes have been made to those files.

Code: Select all

[niobe@cacti CactiStuff]$ for i in `diff -r cacti-plugin-arch-2.1 cacti-plugin-arch-2.0 | grep ^diff | cut -d' ' -f3 | cut -d/ -f3-
> host.php` ; do diff <path_to_PA2.1>/$i <path_to_cacti>/$i ; done
Subsitute <path_to_PA2.1> and <path_to_cacti> before using.

Now you can compare this output to the output from the first diff in 3). If there are any differences then you want to look at them carefully and figure out what's going on.

If you the output is the same as from step 3) you can go ahead and move the files. Don't forgot to re-add your plugins to include/global.php and check permissions as a final step.

Hope this is useful for somebody..

N
Attachments
backup_cacti.sh
Cacti Backup Shell Script - add to crontab
(1.75 KiB) Downloaded 723 times
cacti-plugin-arch-2.0.tar.gz
Cacti PA2.0 for comparison purposes.
(169.26 KiB) Downloaded 4479 times
killshoot
Cacti User
Posts: 84
Joined: Wed Mar 26, 2008 2:51 am

Post by killshoot »

Hi,

Thank you very much.

Good to know that from PA2.0 to 2.1 is done just copying 4 file.

Regards,

Vince
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

I just override my cacti files with the new cacti files, and then run the patch. Simple enough.
niobe
Cacti User
Posts: 228
Joined: Mon Mar 10, 2008 6:52 pm
Location: Australia

Post by niobe »

Depends how casual an attitude you have to production systems.

..Probably the same casual attitude you have towards development and documentation.
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

Oh, I have developmental servers which are tested first, but a simple backup, disabling of the poller, and then overriding is what I have found to work best. No scripts, no fancy stuff. In the end its all just PHP scripts.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests