Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
* feature: Restyle the interfaces and dot1x status legends as rounded, evenly-spaced solid-colour chips with theme-appropriate colours
* feature: Ship a dedicated per-theme stylesheet for every Cacti theme
* feature: Show on the Process Status page what MacTrack is doing now (scan phase, maintenance step, upgrade rebuild or conversion), why the poller last skipped a run, how long each step of the last maintenance took, and the size of each MacTrack table
* issue: Show the Cancel and Continue buttons of the Utilities confirmation side by side, head each confirmation with the name of its action (such as Rebuild IEEE Vendor MAC/OUI Database) instead of Are You Sure?, and rename Configure Port Partitioning and the Port Partition Size setting to cover the IP address table too

--- 4.8 ---

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ partitions created ahead of collection. Nothing needs to be done.
**Existing installs** keep their tables as they are until you rebuild them. Pick
the size, then run the rebuild once:

1. Open **Console > Settings > Mactrack** and set **Port Partition Size**:
1. Open **Console > Settings > Mactrack** and set **Port and IP Address Partition Size**:
*Weekly* (the default, fewest partitions), *Daily*, *Hourly* or *One per
Scan* (maintained by the poller; the rebuild script cannot build these two),
or *Disabled* for unpartitioned tables. It sets the size of the partitions
Expand All @@ -81,7 +81,7 @@ the size, then run the rebuild once:
maintenance, so with weekly partitions up to one extra week of history can
stay.
3. Rebuild the existing history to match, either with **MacTrack Utilities >
Configure Port Partitioning** or from the Cacti installation directory:
Configure Port and IP Address Partitioning** or from the Cacti installation directory:

```sh
php plugins/mactrack/cli/upgrade_partitioning.php
Expand All @@ -97,11 +97,11 @@ Run it as the user that runs the Cacti poller, off hours (see below).
`cli/upgrade_partitioning.php` checks both tables against the scheme and rebuilds
only the ones that have drifted:

- Without `--partition` the scheme is the **Port Partition Size** setting. This
- Without `--partition` the scheme is the **Port and IP Address Partition Size** setting. This
is the command to run after changing the setting, after an upgrade, or from
time to time to make sure the tables are as they should be.
- With `--partition=daily|weekly|disabled` that scheme is used and saved as the
**Port Partition Size** setting.
**Port and IP Address Partition Size** setting.
- `--debug` prints every scan date copied. `--version` and `--help` print the
version and the usage (`-v` and `-h` still work).

Expand Down
14 changes: 7 additions & 7 deletions cli/upgrade_partitioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function display_help(): void {
mactrack_upart_out('usage: upgrade_partitioning.php [--partition=daily|weekly|disabled] [--debug] [--version] [--help]');
mactrack_upart_out('');
mactrack_upart_out('Checks how the MAC address (mac_track_ports) and IP address (mac_track_ips)');
mactrack_upart_out('tables are partitioned. Without --partition, the Port Partition Size setting');
mactrack_upart_out('tables are partitioned. Without --partition, the Port and IP Address Partition Size setting');
mactrack_upart_out('is the scheme; a table that already follows it is left alone and reported.');
mactrack_upart_out('A table that has drifted from the scheme, or is not partitioned as asked, is');
mactrack_upart_out('rebuilt: renamed aside, created again with the retention and partitioning');
Expand All @@ -212,7 +212,7 @@ function display_help(): void {
mactrack_upart_out('until it finishes, which can take hours on a large history. Run it off hours.');
mactrack_upart_out('');
mactrack_upart_out('--partition=SCHEME - Rebuild to daily, weekly or disabled (unpartitioned) and');
mactrack_upart_out(' save it as the Port Partition Size setting');
mactrack_upart_out(' save it as the Port and IP Address Partition Size setting');
mactrack_upart_out('--debug - Report every scan date copied');
mactrack_upart_out('--version - Display the version');
mactrack_upart_out('--help - Display this help message');
Expand Down Expand Up @@ -240,7 +240,7 @@ function mactrack_upart_signal(int $signo): void {
// @codeCoverageIgnoreEnd

/**
* Maps the Port Partition Size setting to a rebuild scheme.
* Maps the Port and IP Address Partition Size setting to a rebuild scheme.
*
* @return string|null day, week or disabled; null for the per-scan and hourly
* sizes, which the poller maintains and this tool cannot build.
Expand Down Expand Up @@ -298,7 +298,7 @@ function mactrack_upart_main(array $argv): int {
$scheme = $options['scheme'] ?? mactrack_upart_setting_scheme();

if ($scheme === null) {
mactrack_upart_out('NOTE: The Port Partition Size setting is one per scan or hourly, which the poller maintains and this tool does not build. Nothing was changed; use --partition to choose daily, weekly or disabled.');
mactrack_upart_out('NOTE: The Port and IP Address Partition Size setting is one per scan or hourly, which the poller maintains and this tool does not build. Nothing was changed; use --partition to choose daily, weekly or disabled.');

return 0;
}
Expand Down Expand Up @@ -334,7 +334,7 @@ function mactrack_upart_upgrade_active(): bool {
*
* @param string $scheme day, week or disabled.
* @param bool $explicit True when --partition chose it, so it is saved as
* the Port Partition Size setting.
* the Port and IP Address Partition Size setting.
* @param int $pause Seconds between DDL retries; tests pass 0.
*
* @return int Exit status.
Expand Down Expand Up @@ -398,15 +398,15 @@ function mactrack_upart_run(string $scheme, bool $explicit, int $pause = 1): int
}

/**
* Saves the scheme as the Port Partition Size setting.
* Saves the scheme as the Port and IP Address Partition Size setting.
*
* @param string $scheme day, week or disabled.
*
* @return void
*/
function mactrack_upart_save_setting(string $scheme): void {
if (mactrack_upart_setting_scheme() !== $scheme) {
mactrack_upart_out('NOTE: Saving the Port Partition Size setting as ' . mactrack_upart_scheme_name($scheme) . '.');
mactrack_upart_out('NOTE: Saving the Port and IP Address Partition Size setting as ' . mactrack_upart_scheme_name($scheme) . '.');
}

set_config_option('mt_partition_granularity', $scheme);
Expand Down
21 changes: 20 additions & 1 deletion lib/mactrack_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6044,7 +6044,26 @@ function mactrack_utilities_post_actions(): array {
'mactrack_refresh_oui_database' => __('Are you sure you want to download and import the IEEE Vendor MAC/OUI database now?', 'mactrack'),
'mactrack_utilities_rebuild_scan_dates' => __('Are you sure you want to rebuild the scan date list from the stored Port to MAC to IP results now?', 'mactrack'),
'mactrack_utilities_optimize_ports' => __('Rebuild and analyze the partition containing the latest port observation, which is the current week with weekly partitions. An unpartitioned table is optimized in full. Scheduled scans are skipped while this runs. Continue?', 'mactrack'),
'mactrack_utilities_convert_ports' => __('Run this maintenance off hours. The rebuild copies the full history of the port (MAC address) and IP address tables one after the other and can take hours. Scheduled scans are skipped, database maintenance waits, and MAC and IP address searching shows a maintenance message until it finishes. Allow free disk space for a second copy of each table and its indexes. Continue?', 'mactrack'),
'mactrack_utilities_convert_partitions' => __('Run this maintenance off hours. The rebuild copies the full history of the port (MAC address) and IP address tables one after the other and can take hours. Scheduled scans are skipped, database maintenance waits, and MAC and IP address searching shows a maintenance message until it finishes. Allow free disk space for a second copy of each table and its indexes. Continue?', 'mactrack'),
];
}

/**
* The heading of each Utilities action's confirmation form.
*
* @return array<string, string> Action name => confirmation heading.
*/
function mactrack_utilities_post_titles(): array {
return [
'mactrack_utilities_truncate_ports_table' => __('Remove All Scan Results', 'mactrack'),
'mactrack_utilities_perform_db_maint' => __('Perform Database Maintenance', 'mactrack'),
'mactrack_utilities_purge_scanning_funcs' => __('Refresh Scanning Functions', 'mactrack'),
'mactrack_utilities_purge_aggregated_data' => __('Remove All Aggregated Results', 'mactrack'),
'mactrack_utilities_recreate_aggregated_data' => __('Perform Aggregate Table Rebuild', 'mactrack'),
'mactrack_refresh_oui_database' => __('Rebuild IEEE Vendor MAC/OUI Database', 'mactrack'),
'mactrack_utilities_rebuild_scan_dates' => __('Rebuild Scan Dates', 'mactrack'),
'mactrack_utilities_optimize_ports' => __('Optimize Port Table', 'mactrack'),
'mactrack_utilities_convert_partitions' => __('Configure Port and IP Address Partitioning', 'mactrack'),
];
}

Expand Down
78 changes: 39 additions & 39 deletions locales/po/cacti.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Cacti\n"
"Report-Msgid-Bugs-To: developers@cacti.net\n"
"POT-Creation-Date: 2026-11-17 09:32-0500\n"
"POT-Creation-Date: 2026-11-17 11:55-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Cacti Developers <developers@cacti.net>\n"
"Language-Team: Cacti Developers <developers@cacti.net>\n"
Expand Down Expand Up @@ -477,6 +477,42 @@ msgstr ""
msgid "Run this maintenance off hours. The rebuild copies the full history of the port (MAC address) and IP address tables one after the other and can take hours. Scheduled scans are skipped, database maintenance waits, and MAC and IP address searching shows a maintenance message until it finishes. Allow free disk space for a second copy of each table and its indexes. Continue?"
msgstr ""

#: lib/mactrack_functions.php mactrack_utilities.php
msgid "Remove All Scan Results"
msgstr ""

#: lib/mactrack_functions.php mactrack_utilities.php setup.php
msgid "Perform Database Maintenance"
msgstr ""

#: lib/mactrack_functions.php mactrack_utilities.php setup.php
msgid "Refresh Scanning Functions"
msgstr ""

#: lib/mactrack_functions.php mactrack_utilities.php
msgid "Remove All Aggregated Results"
msgstr ""

#: lib/mactrack_functions.php mactrack_utilities.php
msgid "Perform Aggregate Table Rebuild"
msgstr ""

#: lib/mactrack_functions.php
msgid "Rebuild IEEE Vendor MAC/OUI Database"
msgstr ""

#: lib/mactrack_functions.php mactrack_utilities.php
msgid "Rebuild Scan Dates"
msgstr ""

#: lib/mactrack_functions.php mactrack_utilities.php
msgid "Optimize Port Table"
msgstr ""

#: lib/mactrack_functions.php mactrack_utilities.php
msgid "Configure Port and IP Address Partitioning"
msgstr ""

#: lib/mactrack_partition_rebuild.php
msgid "The port and IP tables are being repartitioned, or a rebuild did not finish, so their history cannot be changed now. Try again when cli/upgrade_partitioning.php has finished."
msgstr ""
Expand Down Expand Up @@ -1662,7 +1698,7 @@ msgid "%s, coarser than the setting because %d partitions would exceed the limit
msgstr ""

#: mactrack_utilities.php setup.php
msgid "Port Partition Size"
msgid "Port and IP Address Partition Size"
msgstr ""

#: mactrack_utilities.php
Expand Down Expand Up @@ -1737,10 +1773,6 @@ msgstr ""
msgid "Mactrack scanning functions have been purged. They will be recreated once you either edit a device or device type."
msgstr ""

#: mactrack_utilities.php
msgid "Are You Sure?"
msgstr ""

#: mactrack_utilities.php
msgid "Cacti Mactrack System Utilities"
msgstr ""
Expand All @@ -1761,10 +1793,6 @@ msgstr ""
msgid "Database Administration"
msgstr ""

#: mactrack_utilities.php setup.php
msgid "Perform Database Maintenance"
msgstr ""

#: mactrack_utilities.php
msgid "Deletes expired Port to MAC to IP associations from the database. Only records that have expired, based upon your criteria are removed."
msgstr ""
Expand All @@ -1777,26 +1805,14 @@ msgstr ""
msgid "This function will download and install the latest OIU database from the IEEE Website. Each Network Interface Card (NIC) has a MAC Address. The MAC Address can be broken into two parts. The first part of the MAC Address contains the Vendor MAC. The Vendor MAC identifies who manufactured the part. This will be helpful in spot checking for rogue devices on your network."
msgstr ""

#: mactrack_utilities.php setup.php
msgid "Refresh Scanning Functions"
msgstr ""

#: mactrack_utilities.php
msgid "Deletes old and potentially stale Mactrack scanning functions from the drop-down you receive when you edit a device type."
msgstr ""

#: mactrack_utilities.php
msgid "Remove All Scan Results"
msgstr ""

#: mactrack_utilities.php
msgid "Deletes <strong>ALL</strong> Port to MAC to IP associations from the database all IP Addresses, IP Ranges, and VLANS. This utility is good when you want to start over. <strong>DANGER: All prior data is deleted.</strong>"
msgstr ""

#: mactrack_utilities.php
msgid "Rebuild Scan Dates"
msgstr ""

#: mactrack_utilities.php
msgid "Rebuilds the list of scan dates from the stored Port to MAC to IP results, reading each partition once. Scans and maintenance keep the list current, so this is only needed after results were removed outside of maintenance, for example by deleting devices."
msgstr ""
Expand All @@ -1809,18 +1825,10 @@ msgstr ""
msgid "Shows how the Port to MAC to IP results are partitioned, the partition size in use and why, and what the last database maintenance did."
msgstr ""

#: mactrack_utilities.php
msgid "Optimize Port Table"
msgstr ""

#: mactrack_utilities.php
msgid "Rebuilds and analyzes only the partition containing the latest port observation to reclaim deleted space; with weekly partitions that is the current week. Unpartitioned tables are optimized in full. Scheduled scans are skipped until it finishes."
msgstr ""

#: mactrack_utilities.php
msgid "Configure Port Partitioning"
msgstr ""

#: mactrack_utilities.php
msgid "Choose daily or weekly partitions, or disable partitioning, for the port (MAC address) and IP address tables. The rebuild copies the full history in the background; scheduled scans are skipped and MAC and IP address searching shows a maintenance message meanwhile."
msgstr ""
Expand All @@ -1829,18 +1837,10 @@ msgstr ""
msgid "Aggregated Table Administration"
msgstr ""

#: mactrack_utilities.php
msgid "Remove All Aggregated Results"
msgstr ""

#: mactrack_utilities.php
msgid "Deletes ALL <strong>Aggregated</strong> (Not Scan Results) Port to MAC to IP associations from the database. Data will again be collected on the basis of <strong>only new</strong> scanned data in the next mactrack poller run."
msgstr ""

#: mactrack_utilities.php
msgid "Perform Aggregate Table Rebuild"
msgstr ""

#: mactrack_utilities.php
msgid "Deletes ALL <strong>Aggregated</strong> (Not Scan Results) Port to MAC to IP associations from the database and their re-creation based on <strong>All scanned data</strong> now."
msgstr ""
Expand Down Expand Up @@ -2629,7 +2629,7 @@ msgid "How long should discovered IPs details be retained in the database."
msgstr ""

#: setup.php
msgid "Size of the partitions of the port and IP tables, or Disabled for unpartitioned tables. Changing it affects new partitions only; to rebuild the existing history to match, use Configure Port Partitioning in MacTrack Utilities or run cli/upgrade_partitioning.php."
msgid "Size of the partitions of the port and IP tables, or Disabled for unpartitioned tables. Changing it affects new partitions only; to rebuild the existing history to match, use Configure Port and IP Address Partitioning in MacTrack Utilities or run cli/upgrade_partitioning.php."
msgstr ""

#: setup.php
Expand Down
Loading
Loading