Skip to content

Add optional per-rule Alarm Manager forwarding through native hooks - #425

Merged
bmfmancini merged 3 commits into
developfrom
feat_alarm_manager
Oct 26, 2026
Merged

bmfmancini merged 3 commits into
developfrom
feat_alarm_manager

Conversation

@bmfmancini

Copy link
Copy Markdown
Member

Description

Add optional per-rule forwarding to Alarm Manager through Cacti's native alarmmanager_submit hook. Syslog Alarming remains the default, with an off-by-default global forwarding setting.

  • Show the Syslog Alarming / Alarm Manager selector only when Alarm Manager is installed.
  • Check installation, enabled state and the enabled hook registration before submitting.
  • Suppress email only for an unchanged event returned with accepted or already_accepted and a valid event row ID. Unavailable, rejected, failed or malformed submissions retain configured email fallback.
  • Hide Email Options and Actions for Alarm Manager rules, preserve saved fallback recipients, and skip ticket, alert and recovery commands for those rules.
  • Preserve collector ownership, stable retry identities, independent occurrences and correlated windowed-threshold recovery using the existing recovery queue.
  • Add native schema repair, configuration documentation and focused regression coverage. No HTTP API or Cacti core changes.

Related Issue

None linked.

Motivation and Context

Syslog currently owns notification delivery for every rule. This adds an explicit destination choice while preserving existing rules and conservative fallback behavior.

Raise submission remains synchronous. A crash between Alarm Manager's ingestion commit and the local recovery-ownership write can leave an accepted raise without a forwarded clear; this limit is documented.

How Has This Been Tested?

  • Local: 49 forwarding/lifecycle checks; 85 disposable MariaDB recovery checks; destination form, save, import/export and hostname regressions; PHP lint and diff checks.
  • Test-host deployment: native ingestion accepted independent occurrences and correlated raise/recovery, returned a durable duplicate, rejected an invalid event, and completed four source-suppressed jobs with zero outbound deliveries.
  • The final rebased branch has focused local validation. Live remote collectors, external delivery and browser interaction are unverified.
  • Full Pest execution is blocked locally by a missing Symfony Console dependency.

Types of changes

  • New feature
  • Breaking change

Checklist

  • Existing rules retain Syslog Alarming by default.
  • Repository documentation and focused tests updated.

Copilot AI balanced review requested due to automatic review settings October 26, 2026 17:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Comment thread includes/functions.php Fixed
Comment thread tests/regression/alarm_destination_save_test.php Fixed
Comment thread tests/regression/alarm_destination_ui_test.js Fixed
Comment thread tests/regression/threshold_recovery_database_test.php Fixed
Comment thread tests/regression/threshold_recovery_database_test.php Fixed
Comment thread tests/regression/alarm_destination_ui_test.js Fixed
Comment thread tests/regression/alarm_destination_ui_test.js Fixed
bmfmancini and others added 2 commits October 26, 2026 13:57
- Update locales/po/cacti.pot for the new Alarm Manager strings
- Use a SHA-256 based threshold rule fingerprint (same 40-char width)
- Move destination visibility logic to js/alarm-destination.js and drop
  dynamic code execution / PATH-based PHP lookup from regression tests
- Use prepared SQL in the threshold recovery regression test
- Add Pest coverage for Alarm Manager forwarding and register
  includes/alarmmanager.php in test harness and coverage config

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cover the queued threshold recovery forward and the message-alert
fallback email path so the patch-coverage gate reaches 100%.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sonarqubecloud

Copy link
Copy Markdown

@bmfmancini
bmfmancini merged commit 3dd52ca into develop Oct 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants