After installing CactiEZ v0.6 (as a VM on Windows 2008 Hyper-V) which includes Cacti 0.8.7c I wanted to upgrade to the latest version of Cacti (0.8.7e as of this post). However I was not able to locate any good directions. Jimmy Conner who put together CactiEZ said to follow the directions for upgrading Cacti in the Cacti manual, but they weren’t exactly easy to follow. So, after mucking through the upgrade I thought I’d put down my notes. Here they are.
- Backup the existing Cacti database (I wasn’t too worried about this as I upgraded a new installation):
mysqldump -l --add-drop-table cacti > mysql.cacti
Note: You will probably have to specify the -u and -p flags for the MySQL username and password. This user must have permission to read from Cacti's database or you will end up with an empty backup.
- Backup the existing Cacti directory (again, since I have a new installation I wasn’t too worried about this). The root for Cacti in CactiEZ is /var/www/html so I executed all the following commands from the /var/www directory:
mv html cacti_backup
- Download the latest Cacti tarball (0.8.7e as of this writing):
- Extract the Cacti tarball.
tar xzvf cacti-0.8.7e.tar.gz
- Rename the new Cacti directory to match the old one.
mv cacti-0.8.7e html
- Edit include/config.php and specify the MySQL user, password and database for your Cacti configuration.
Default CactiEZ include/config.php configuration (vi cacti_backup/include/config.php to view your current config if necessary):
$database_type = “mysql”;
$database_default = “cacti”;
$database_hostname = “localhost”;
$database_username = “cactiuser”;
$database_password = “CactiMadeEZ“;
/* Default session name – Session name must contain alpha characters */
$cacti_session_name = “CactiEZ“;
- Copy the *.rrd files from the old Cacti directory.
cp cacti_backup/rra/* html/rra/
- Copy any relevant custom scripts from the old Cacti directory. Some script are updated between versions. Therefore, make sure you only over write if the scripts either don’t exist or are newer than the distribution’s.
cp -u cacti_backup/scripts/* html/scripts/
- Copy any relevant custom resource XML files from the old Cacti directory. Some resource XML files are updated between versions. Therefore, make sure you only over write if the XML files either don’t exist or are newer than the distribution’s.
cp -u -R cacti_backup/resource/* html/resource/
- Set the appropriate permissions on Cacti’s directories for graph/log generation. You should execute these commands from inside Cacti’s directory to change the permissions.
chown -R cactiuser rra/ log/
(Enter a valid username for cactiuser, this user will also be used in the next step for data gathering.)
- Finally, point your web browser to:
Follow the on-screen instructions so your database can be updated to the new version.
Wait, there’s more. . .
Now we need to download and install the Cacti Official Patches [0.8.7e]. You may want to check the previous link for the latest. NOTE: download and execute these from /var/www/html which is the default root directory for Cacti on CactiEZ.
patch -p1 -N < cli_add_graph.patch
patch -p1 -N < snmp_invalid_response.patch
patch -p1 -N < template_duplication.patch
patch -p1 -N < fix_icmp_on_windows_iis_servers.patch
patch -p1 -N < cross_site_fix.patch
NOTE: While this upgrade works fine to upgrade Cacti itself you will have to upgrade other CactiEZ components for them to work properly, such as THold, Monitor, Discover, WeatherMap, MACTrack and the Plugin Architecture. For now you are on your own for those. . .