Skip to content

feat(automation): create aggregate graphs from data source name rules - #8352

Open
somethingwithproof wants to merge 3 commits into
Cacti:developfrom
somethingwithproof:feat/aggregate-automation-rules
Open

somethingwithproof wants to merge 3 commits into
Cacti:developfrom
somethingwithproof:feat/aggregate-automation-rules

Conversation

@somethingwithproof

@somethingwithproof somethingwithproof commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

This change lets administrators opt in to automatic aggregate graphs for each device. Rules on an aggregate template match data-source names, apply optional device-template filters, and reconcile members on later automation passes using a stored ownership mapping. This replaces repeated manual member selection while keeping existing templates disabled until configured.

Implementation details

Aggregate graphs currently require manual member selection, which makes per-device QoS aggregates impractical across large installations. This adds opt-in automation settings to aggregate templates: a data-source name PCRE pattern, an optional device-template filter, a title format and a member limit. Device automation creates one aggregate per template/device after ordinary graph rules run, then reconciles its members on later passes without creating duplicates.

Rule metadata is cached once per process and candidates are read in batches of 200 graph IDs. Updates use a per-template/device database lock and commit graph changes with their ownership mapping. Existing templates remain disabled; empty matches and disabled rules retain existing graphs. The fresh-install schema and develop upgrade include the new settings and ownership table. The template editor also uses the existing toggleFields helper, and CLI-created aggregates record the template owner without requiring a browser session.

Validation:

  • PHP 8.5.11: 2,780 unit tests pass, with four existing skips; PHPStan level 8 and formatting pass.
  • JavaScript: 71 tests pass. Chromium verifies new-template controls, settings save/reload, escaped pattern/title fields and GET-save rejection.
  • PHP 8.3.35 / MariaDB 10.11.19: 34 database contracts cover fresh/upgrade schema parity, regex matching, pagination, device isolation, reconciliation, rollback/retry, deleted graphs, concurrent workers and empty-rule caching.
  • Disposable 1,000-device profile with one member graph per device: creation 1.48 s / 36,002 queries; unchanged pass 0.21 s / 6,000 queries; 12 MiB peak PHP memory. These are local SQL/graph-metadata diagnostics, excluding SNMP and RRD I/O. Raw results are in docs/performance/aggregate-automation-2026-10-12.json.

Usage and repeatable checks: docs/development/aggregate-automation.md.

Targets develop; no 1.2.x backport is included.

Closes #71.

Regex execution limits

At 3689eecd2fdceaf5556218a45f9fc6576c36564e, validation and matching use bounded PCRE backtracking and recursion limits and restore the caller's settings on every outcome. Limit exhaustion aborts reconciliation before writes. PHP 8.5.11: 23 focused tests (47 assertions), full PHPStan, formatting and security inventories pass. SonarCloud and hosted taint checks pass on this commit. The locked integration job fails before checkout because ECR rejects the MariaDB pull; #8429 supplies the tested cache/GHCR fix.

Revision and checks

Description scope: target develop, 18 changed files, head 0aef77e03. Checked 2026-10-23 03:06:04 UTC.

GitHub check snapshot: 2 passed. Local test figures and earlier CI runs above are recorded evidence for their stated revisions and environments; they do not assert that every check passes at this head.

@somethingwithproof
somethingwithproof requested a review from a team as a code owner October 13, 2026 06:03
@somethingwithproof
somethingwithproof requested review from TheWitness, bmfmancini and cigamit and removed request for a team and cigamit October 13, 2026 06:03
@somethingwithproof somethingwithproof self-assigned this Oct 13, 2026
@github-actions
github-actions Bot force-pushed the feat/aggregate-automation-rules branch from 3b937e9 to bb18abf Compare October 13, 2026 20:48
somethingwithproof added a commit to somethingwithproof/cacti that referenced this pull request Oct 14, 2026
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof
somethingwithproof force-pushed the feat/aggregate-automation-rules branch 3 times, most recently from 9ab2cd3 to 1447c3a Compare October 17, 2026 20:50
@github-actions
github-actions Bot force-pushed the feat/aggregate-automation-rules branch 3 times, most recently from 255b90b to 228f0f4 Compare October 20, 2026 08:52
@somethingwithproof somethingwithproof added type:enhancement Namespaced Cacti workflow label aggregate Aggregate related issue automation Automation related issue release:1.3 Namespaced Cacti workflow label labels Oct 20, 2026
@github-actions
github-actions Bot force-pushed the feat/aggregate-automation-rules branch 5 times, most recently from 9962ee4 to 22472f0 Compare October 26, 2026 20:51
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@github-actions
github-actions Bot force-pushed the feat/aggregate-automation-rules branch from 22472f0 to 0bf0d01 Compare October 28, 2026 20:47
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
D Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

return false;
}

return @preg_match($pattern, $subject);

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aggregate Aggregate related issue automation Automation related issue release:1.3 Namespaced Cacti workflow label type:enhancement Namespaced Cacti workflow label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow Aggregate Items from Regular Expressions

2 participants