docs: correct Cacti 1.2 upgrade and recovery procedures (#243)

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
This commit is contained in:
Thomas Vincent authored and GitHub committed 2026-10-26 17:00:48 -04:00
1 parent 44d6f7c8fe
commit 6cfc8a3971
3 files changed
+294 -171

No files matched your search

+86 -38
View File
@@ -1,58 +1,106 @@
# Upgrading Cacti Under FreeBSD
1. Backup the old Cacti database.
These instructions cover upgrading to Cacti 1.2.31. Determine whether Cacti is
maintained by `pkg`, by ports or from a source archive. Keep that installation
method for the upgrade; do not overlay an archive onto package-managed files.
Review the target Cacti [release notes](Version-Specific-Release-Notes.md),
[requirements](Requirements.md) and package or port notes before proceeding. Do
not make an unrelated operating-system, PHP or database major-version upgrade
part of this procedure without a separate compatibility plan.
## Pause collection and back up
1. Clear **Data Collection Enabled** under `Console > Configuration > Settings
> Poller`. Disable the Cacti-specific cron entry or stop its configured
poller service on every collector. Record what you change; do not stop the
system-wide cron service merely to pause Cacti. Wait for pollers, Spine,
script servers and other background writers to finish. Restrict web access
to the upgrade administrator and pause plugin jobs that write to Cacti.
Flush pending RRD-cache writes and confirm that the database and RRD files
remain unchanged before taking the backup.
2. Use the dump client appropriate to the installed MySQL or MariaDB server.
The following example requires an existing, protected backup directory and a
database account with the server's required backup privileges. Replace the
account, database name and filename for your installation. Use its actual
database host, port and TLS options.
```sh
shell> mysqldump -l --add-drop-table --lock-tables=false cacti > mysql.cacti
mysqldump --user=YOUR_BACKUP_USER --password \
--lock-tables --quick --routines --events --triggers \
--databases cacti --result-file=/protected/backup/cacti-YYYYMMDD.sql
```
> **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.
The password is prompted. With all Cacti writers paused, this [dump
method][dump] uses table locks for the Cacti database, including
nontransactional tables. A transaction-only dump does not cover those
tables. Verify the command succeeded and test restoring the dump separately;
a nonempty file alone is not proof of a complete backup. Use a new filename
rather than overwriting a known good backup.
2. Backup the old Cacti directory.
3. Back up the Cacti application files, RRDs and local configuration together
with the database dump. Preserve ownership, permissions and hidden files.
Include `include/config.php`, custom scripts, query resources, plugins,
secret files, including any alternate `path_csrf_secret`, and configured
paths outside the application tree. Record symbolic links and back up their
targets separately. Also record the Spine configuration, cron/service
settings, web-server settings, database grants, certificates/keys and
installed versions. Package layouts may keep configuration and data outside
`/usr/local/share/cacti`; inspect the installed paths rather than backing up
that directory alone.
```sh
shell> cd /usr/local/share
shell> tar -zcf cacti_backup_YYYYMMDD.tgz cacti
```
## Upgrade using the existing installation method
3. Install new version from compiled packages or FreeBSD ports.
For a binary package installation, review the proposed package transaction
before applying it. The [FreeBSD Handbook][packages] describes package
upgrades. Run the following with appropriate administrator privileges:
```sh
shell> pkg delete cacti
shell> pkg install cacti
```
```sh
pkg update
pkg upgrade -n cacti
pkg upgrade cacti
```
or
Check the proposed version and dependency changes before accepting the actual
upgrade. The configured repository may offer a version other than 1.2.31. Stop
if that is not your approved target and select an appropriate repository or
installation method. Do not delete Cacti first or assume that upgrading one
package cannot affect its dependencies.
```sh
shell> pkg install git
shell> git clone https://git.FreeBSD.org/ports.git /usr/ports
shell> git -C /usr/ports pull
shell> cd /usr/ports/net-mgmt/cacti
shell> make deinstall clean install
```
For a ports-managed installation, follow the handbook's [ports upgrade
procedure][ports] and applicable `/usr/ports/UPDATING` entries. Use the
existing ports management method; do not switch between ports and binary
packages without reviewing their options and dependencies. A source
installation instead follows [Upgrading Cacti](Upgrading-Cacti.md).
4. If you are using the optional feature Performance -> Image Caching, also
recreate the folder and correct the permissions.
Preserve the working configuration and merge required changes from the new
configuration example. Keep existing database credentials, collector IDs, paths
and secrets. Review package-generated configuration changes and restore local
resources only after checking compatibility. Recreate cache or data directories
only where the installed configuration requires them, with access for the
actual service account; do not assume a universal account or apply recursive
ownership changes to the whole installation.
```sh
shell> cd /usr/local/share/cacti
shell> mkdir cache
shell> chown -R cacti cache
```
## Complete the application upgrade
5. Point your web browser to:
Open the existing Cacti URL as an administrator and complete its database
upgrade. Review the installer and logs before resuming collection. Upgrade
remote collectors' local files and configuration through their installation
method, complete the applicable upgrade/synchronization, and verify their
versions, connectivity and logs. Do not rely on a fixed number of poll cycles
for completion. Check the matching Spine version on collectors using Spine.
`http://your-server/cacti/`
After successful checks, re-enable **Data Collection Enabled** and restore the
recorded Cacti cron entry or service. Verify a complete poll cycle, recent RRD
samples and representative graphs on every collector. If recovery is needed,
stop all writers again and restore the matching files, database, RRDs and
configuration as one set; restoring old application files alone does not undo a
database upgrade.
Follow the on-screen instructions so your database can be updated to the
new version.
> Note that starting with Cacti 1.0, all **Data Collectors** will upgrade
> themselves automatically within two polling cycles. If for some reason they
> do not, upgrade them one at a time.
[dump]:<https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html>
[packages]:<https://docs.freebsd.org/en/books/handbook/ports/#pkgng-upgrading>
[ports]:<https://docs.freebsd.org/en/books/handbook/ports/#ports-upgrading>
---
Copyright (c) 2004-2026 The Cacti Group
+80 -79
View File
@@ -1,100 +1,101 @@
# Upgrading Cacti under Windows
Download [latest stable version](https://www.cacti.net/download_cacti.php)
of Cacti which is referred to as `cacti-xxx.zip` in this document.
These instructions cover upgrading a source/archive installation to Cacti
1.2.31. For a managed Windows installation, also follow its package or
installer upgrade procedure; do not overwrite package-managed files with an
unrelated archive. Review the [release
notes](Version-Specific-Release-Notes.md) and [requirements](Requirements.md)
for the target Cacti version first. An upgrade of Cacti does not automatically
require upgrading Windows, PHP or the database.
1. Stop poller.
## Pause collection and take a recoverable backup
- Cacti Console
1. In `Console > Configuration > Settings > Poller`, clear **Data Collection
Enabled** and save. Disable the actual Windows Scheduled Task that launches
`poller.php`, or stop the service that manages your poller. Record the task
or service settings so you can restore them. Use [Task Scheduler][tasks] to
disable future starts; this alone does not finish an already running poll.
- Configuration
2. Wait for running pollers, Spine processes, script servers and background
writers to finish. Include remote collectors and plugin jobs. Restrict web
access to the upgrade administrator so configuration changes cannot race the
backup. Flush pending RRD-cache writes before copying RRD files and confirm
that writers have stopped. Do not start a manual poll during this
maintenance window.
- Settings
3. Create a protected backup directory outside the web root. From Command
Prompt, use the dump utility matching your database server. Replace the
executable path, account, database name and output path in this example. Use
the actual database host, port and TLS options for your installation. The
account needs the backup privileges required by the installed server;
`--password` prompts rather than putting a password in the command.
- Poller
- uncheck Data Collection Enabled and Save
1. Run Command Prompt as administrator and backup database.
```sh
shell> cd Documents
shell> "\Program Files\MySQL\MySQL Server 5.7\bin\mysqldump.exe" -uroot -p -l
--add-drop-table cacti > cacti-version-YYYYMMDD.sql
```bat
"C:\path\to\mysqldump.exe" --user=YOUR_BACKUP_USER --password ^
--lock-tables --quick --routines --events --triggers ^
--databases cacti --result-file="D:\CactiBackup\cacti-YYYYMMDD.sql"
```
1. Backup the old Cacti directory.
With all Cacti writers paused, this [dump example][dump] uses table locks to
cover transactional and nontransactional tables in the Cacti database. A
transaction-only dump does not protect nontransactional tables. Use a new
output filename and verify successful completion: a failed dump may leave a
partial file. Do not proceed until the backup can be restored in a separate
test environment.
```sh
shell> cd \inetpub\wwwroot
shell> robocopy cacti cacti-version-YYYYMMDD /s /b /copyall
4. Back up the existing Cacti tree, including hidden files, using a separate
destination outside the web root. For example, [Robocopy][robocopy] can
preserve file permissions as well as contents when run with the required
privileges:
```bat
robocopy "C:\inetpub\wwwroot\cacti" "D:\CactiBackup\cacti-YYYYMMDD" /E /COPYALL /SL /XJ /R:2 /W:2
```
1. Windows Update
Inspect its report; exit codes of 8 or greater indicate copy failures.
Confirm that the backup includes `include/config.php`, RRDs, custom scripts,
query resources, plugins and secret files, including any alternate
`path_csrf_secret`. Also save configured paths outside this tree, the Spine
configuration, scheduler settings, web-server configuration, database grants
and required certificates/keys. Record symbolic links and junctions and back
up their external targets separately; the example copies symbolic links and
excludes junctions. Preserve permissions and record the installed versions.
Keep this file backup and database dump together as one recovery set.
1. MySQL
## Install and verify the upgrade
- Open `MySQL Installer - Community`
1. Extract the target [Cacti release][download] into a staging directory. Keep
the existing tree and verified backup available. Deploy the release files
using your existing installation layout, preserving the working
`include/config.php` and local resources. Compare the new
`include/config.php.dist` for changes; do not replace existing credentials,
collector IDs, paths or secrets with example defaults. Check plugin and
custom-script compatibility before restoring or enabling them.
- update Catalog
2. Verify file permissions for the web server and poller accounts. Open the
existing Cacti URL as an administrator and complete the database upgrade.
Review installer checks and logs. Use version-appropriate database settings
from [Requirements](Requirements.md), rather than applying fixed global SQL
tuning commands.
- upgrade MySQL Server
3. For remote collectors, keep their schedulers paused while updating their
local application files and configuration and completing the applicable
upgrade and synchronization. Verify each collector's reported version,
connectivity and logs; completion is not guaranteed after two poll cycles.
Check the matching Spine version where it is used.
1. PHP
4. Re-enable **Data Collection Enabled** and restore the recorded scheduler or
service only after the upgrade succeeds. Check a complete poll cycle,
collector status, new RRD samples and representative graphs. If recovery is
necessary, stop writers again and restore the matching application files,
database, RRDs and configuration together; copying old PHP files over an
upgraded database is not a rollback.
- Backup `C:\php\` folder
- Download a [supported version](http://php.net/supported-versions.php) of
[PHP for Windows](https://windows.php.net/download/) using the appropriate
build for IIS or Apache. If missing, install the appropriate VC build.
- Overwrite `C:\php\` folder contents from zip file.
1. Overwrite new Cacti version to production folder.
Extract contents of `cacti-xxx` folder in `cacti-xxx.zip` to
`C:\inetpub\wwwroot\cacti\` and replace files.
1. Edit `include/config.php` and specify the MySQL user, password and database
for your Cacti configuration.
```sh
shell> notepad cacti/include/config.php
```
```php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";
```
1. Point your web browser to: `http://localhost/cacti/`
Follow the on-screen instructions so your database can be updated to the
new version.
Open "MySQL 5.7 Command Line Client" and set variables as needed in
following format:
```sh
set global max_allowed_packet = 16777216;
set global tmp_table_size = 67108864;
set global join_buffer_size = 67108864;
set global innodb_flush_log_at_timeout = 3;
```
1. Start poller
- Cacti Console
- Configuration
- Settings
- Poller
- check Data Collection Enabled and Save
[tasks]:<https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks-change>
[dump]:<https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html>
[robocopy]:<https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy>
[download]:<https://github.com/Cacti/cacti/releases/tag/release/1.2.31>
---
Copyright (c) 2004-2026 The Cacti Group
+128 -54
View File
@@ -1,75 +1,149 @@
# Upgrading Cacti Under UNIX Compatible Operating Systems
To upgrade Cacti under UNIX-style operating systems is very straightforward. To upgrade Cacti on Windows, you should use the instructions in the link below:
This procedure covers a source installation upgrading to Cacti 1.2.31. For a
package-managed installation, use the package maintainer's upgrade procedure
and configuration-file handling. See the separate guides for
[Windows](Upgrading-Cacti-Under-Windows.md) and
[FreeBSD](Upgrading-Cacti-Under-FreeBSD.md).
[Upgrading in Windows](Upgrading-Cacti-Under-Windows.md)
Review the [release notes][release] and [requirements](Requirements.md) first.
Schedule time to back up and restore the installation. Test the upgrade on an
isolated copy of the database and files before changing production. Keep
dependency upgrades separate unless a prerequisite requires them.
Before you begin, ensure that both your Apache/NGINX and your Crontab or systemd-based pollers run as the same account. In most Linux operating systems, this will be the apache account. Under SLES, it will be www-run. For this guide, we will use the apache account, but please adjust accordingly.
## Stop writers before backing up
1. Disable Polling:
Turn off **Data Collection Enabled** under the poller settings. Also suspend
the actual scheduler on each affected collector: disable only the Cacti cron
entry, or stop its installed `cactid` service. Preserve the scheduler settings
so they can be restored later. Do not disable all system cron jobs.
Go to Console >> Settings >> Poller >> Data Collection Enabled and switch it off.
Wait for existing poller, Spine, script-server, Boost and other background
jobs to finish. Prevent web requests and plugin jobs from changing the
installation during the backup and upgrade. The application polling switch
alone does not stop every running process or administrative writer.
2. Backup the Cacti Configuration File:
If collectors use `rrdcached`, drain its pending writes using the procedure
for that deployment before taking the RRD snapshot. Keep writers stopped
until the database and file backups are both complete. Coordinate this on
remote collectors as well as the main server.
Backup the config.php file located in <cacti_dir>/include/.
```shell
shell> cp <cacti_dir>/include/config.php <backup_location>
```
3. Backup the Old Cacti Database:
## Back up the database and complete installation
Create a backup of the current Cacti database.
```shell
shell> mysqldump -l --add-drop-table --lock-tables=false cacti > mysql.cacti
```
On newer versions of MariaDB
Record the installed Cacti, Spine, PHP and database versions, installation
paths, service accounts, scheduler entries and remote-collector configuration.
Store backups outside the web root with access restricted to administrators.
```shell
shell> mariadb-dump -l --add-drop-table --lock-tables=false cacti > mysql.cacti
Back up the Cacti database with a client compatible with the database server.
For example, with the application stopped and a backup account with the
required privileges:
```
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.
```sh
umask 077
BACKUP_DIR=/srv/backups/cacti-before-1.2.31
mkdir "$BACKUP_DIR"
mysqldump --user=backup_user --password --lock-tables --quick \
--routines --events --triggers cacti \
> "$BACKUP_DIR/cacti.sql"
```
5. Backup the Old Cacti Directory:
Adjust the database name, account and paths before running these examples.
Use `mariadb-dump` instead of `mysqldump` where appropriate. Enter the password
at the prompt. Stop if a command fails; an output file alone does not prove a
successful dump. The account needs the privileges required by the installed
dump client, including table locks for the example above.
Backup the old Cacti directory with the exception of the RRD files, which should not need backup.
```shell
shell> tar --exclude=*.rrd -zcf cacti_backup_YYYYMMDD.tgz cacti
```
6. Extract the Distribution Tarball:
```shell
shell> tar -xzvf cacti-version.tar.gz
```
7. Copy the Distribution Tarball Over the Existing Installation:
```shell
shell> /bin/cp -rpf cacti-version cacti
```
8. Set Appropriate Permissions:
`--single-transaction` provides a consistent snapshot for transactional
tables; it does not make nontransactional tables consistent. Inspect the
actual storage engines and choose the backup method accordingly. Keep all
application writers stopped for the corresponding file snapshot. See the
[database backup documentation][dump] for the option and privilege details.
Set the appropriate permissions on Cacti's directories for graph/log generation. Execute these commands from inside Cacti's directory to change the permissions.
```shell
shell> chown -R apache:apache rra/ log/
```
9. Recreate the Cache Folder (Optional):
Back up the complete installation, including the RRD files. For an example
installation at `/var/www/html/cacti`:
If you are using Performance > Image Caching or Realtime Graphing, recreate the cache folder and correct the permissions.
```shell
shell> mkdir cache
shell> chown -R apache:apache cache
```
10. Point Your Browser:
```sh
tar -czpf "$BACKUP_DIR/cacti-files.tar.gz" -C /var/www/html cacti
tar -tzf "$BACKUP_DIR/cacti-files.tar.gz"
```
Point your web browser to http://your-server/cacti/ and follow the on-screen instructions to update your database to the new version.
Preserve `include/config.php`, plugins, custom scripts, query resources and
other local configuration. Include CSRF secret material, including an
alternate `$path_csrf_secret` from the configuration. Back up separately any
RRD, configuration or resource paths outside the installation tree. A tar
archive normally preserves a symlink rather than including its external
target. Retain the permissions and ownership needed for restoration.
11. Re-enable Polling:
Save the database user/grant definitions and any connection certificates
needed to recreate access. These are not included in a dump of the Cacti
database alone. Include site or plugin SQL routines and events, as in the
example, and account for their additional backup privileges.
Go to the console and re-enable the poller. It will take two polling cycles to update the remote pollers.
Back up remote-collector databases and local files where they hold state.
Verify dump completion and archive contents, then rehearse restoration on an
isolated system. Excluding `*.rrd` would leave monitoring history outside the
recovery set.
12. If Remote Pollers Fail to Update:
## Install the release files
Try to rebuild the Resource Cache by going to Console >> Utilities and wait 2 polling cycles.
Download the intended 1.2.31 distribution from the release page and extract it
into a staging directory. Verify the package using the release's published
verification information before using it. Keep the existing installation and
its backup until the upgrade has been checked.
If that fails, update the remote pollers that have failed to update.
Copy the contents of the extracted directory into the existing installation,
not the directory itself. For example, after extraction:
```sh
STAGING_DIR=/var/tmp/cacti-1.2.31
CACTI_DIR=/var/www/html/cacti
cp -a "$STAGING_DIR"/. "$CACTI_DIR"/
```
Confirm that the new files are directly under the installation root, such as
`$CACTI_DIR/poller.php`, rather than a nested `cacti-1.2.31` directory. Preserve
the existing `include/config.php` and review new options in
`include/config.php.dist`. Reconcile local code changes and plugin
compatibility with the new files; copying the release is not a substitute for
reviewing those changes.
Check permissions using the accounts that actually run the web server,
poller and maintenance jobs. Those accounts need not be identical. Give the
poller the required access to RRD and log paths, and check configured cache,
resource and script paths. Preserve access needed by installation and package
imports. Do not make the entire application tree writable as a permissions
workaround.
## Run and verify the upgrade
Allow an administrator to open the Cacti URL and follow the database-upgrade
workflow. Review errors before proceeding. The release also provides
`cli/upgrade_database.php`; consult its `--help` output if using the CLI
workflow. Do not manually advance the database version or force a starting
version merely to bypass an upgrade check.
Confirm the installed version, database-upgrade result, credentials, paths,
plugin state and collector configuration. Check remote collectors individually
and follow the applicable synchronization procedure; do not assume that two
polling cycles prove their files and databases have upgraded successfully.
Restore web access and the saved scheduler configuration only after the
upgrade checks succeed, then re-enable collection. Use either the configured
cron path or the daemon for a collector, not both. Verify logs, data freshness
and representative RRD updates after normal polling resumes.
## Recovery
If the upgrade fails, keep writers stopped while deciding whether to retry or
restore. Replacing PHP files alone does not undo a database migration. Restore
the matching pre-upgrade database, application files, RRD data and external
configuration or secret material, including affected remote-collector state.
Verify the restored installation before re-enabling its schedulers. Restoring
an earlier backup discards changes collected after that backup.
[release]: <https://github.com/Cacti/cacti/releases/tag/release/1.2.31>
[dump]: <https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html>
---
Copyright (c) 2004-2026 The Cacti Group