Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


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

 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin Architecture
Author Message
niobe
Cacti User


Joined: 10 Mar 2008
Posts: 125
Location: Australia

PostPosted: Sun Apr 20, 2008 10:33 pm    Post subject: How to upgrade from PA2.0 to PA2.1 - safely Reply with quote

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 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:
[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:
[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:
[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:

[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



cacti-plugin-arch-2.0.tar.gz
 Description:
Cacti PA2.0 for comparison purposes.

Download
 Filename:  cacti-plugin-arch-2.0.tar.gz
 Filesize:  169.26 KB
 Downloaded:  214 Time(s)


backup_cacti.sh
 Description:
Cacti Backup Shell Script - add to crontab

Download
 Filename:  backup_cacti.sh
 Filesize:  1.75 KB
 Downloaded:  116 Time(s)

Back to top
killshoot



Joined: 26 Mar 2008
Posts: 34

PostPosted: Thu Aug 21, 2008 8:24 am    Post subject: Reply with quote

Hi,

Thank you very much.

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

Regards,

Vince
Back to top
cigamit
Developer


Joined: 07 Apr 2005
Posts: 946
Location: B/CS Texas

PostPosted: Sun Sep 07, 2008 2:15 pm    Post subject: Reply with quote

I just override my cacti files with the new cacti files, and then run the patch. Simple enough.
Back to top
niobe
Cacti User


Joined: 10 Mar 2008
Posts: 125
Location: Australia

PostPosted: Sun Sep 07, 2008 6:39 pm    Post subject: Reply with quote

Depends how casual an attitude you have to production systems.

..Probably the same casual attitude you have towards development and documentation.
Back to top
cigamit
Developer


Joined: 07 Apr 2005
Posts: 946
Location: B/CS Texas

PostPosted: Sun Sep 07, 2008 10:01 pm    Post subject: Reply with quote

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.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Plugin Architecture All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group