Alerts & Webhooks

Control Tower 5.1.0 introduces user-configurable alert rules and webhook notifications. Rules live in the database, are edited from the control panel, and dispatch notifications to email, Slack, Microsoft Teams, or any HTTPS endpoint via a queued background job.

How alerts work

Each time the alert check runs, Control Tower evaluates every enabled rule against the current value of its metric. If the operator/threshold comparison is true, an alert is created and recorded against the rule. The plugin then queues a SendAlertNotificationJob that delivers the alert to each destination configured on the rule.

  • Notification dispatch is asynchronous, so SMTP and webhook latency never block the request that raised the alert.
  • An alert is linked to the rule that fired it via the alertRuleId column on controltower_alerts. The Alerts UI shows the rule name in place of the internal type slug.
  • If a rule’s condition stops being true and the rule has Notify on resolve enabled, a follow-up “Resolved” notification is sent.

Alert Rules

Manage rules under Control Tower → Alert Rules. Each rule has the following fields:

FieldDescription
NameDisplay name shown in the Alerts UI and notifications.
DescriptionOptional human-readable explanation.
MetricOne of the keys from the metric registry (see below).
Operator>, >=, <, <=, or =.
ThresholdNumeric value compared against the metric’s current value.
Severityinfo, warning, or critical. Affects coloring and notification framing.
EnabledToggle to pause a rule without deleting it.
Notify adminsEmail every admin user when the rule fires.
Additional emailsComma- or whitespace-separated list of extra recipients.
WebhooksOne or more webhook destinations to POST to.
Notify on resolveSend a second notification when the condition clears.
Minimum notify intervalMinutes to wait between repeat notifications for the same rule. The alert still appears in the CP regardless — this only throttles outbound delivery.

Metric registry

Rules target one of the metrics in the metric registry. Every metric — built-in or registered by another plugin or module — appears in the rule editor, in alert checks, in the Alert Metrics panel on System Pulse, in the dashboard widget’s metric picker, and in notifications. Built in as of 5.3.0:

KeyUnitWindowWhat it measures
queue_failedjobsnowJobs currently in the failed state.
queue_pendingjobsnowJobs waiting to run.
cpu_percent%nowCPU utilization (0–100), from the 1-minute load average.
memory_percent%nowMemory utilization (0–100).
disk_percent%nowDisk utilization (0–100) of the volume holding storage/.
db_response_msmsnowRound trip of a trivial query to the database.
editor_collisionscollisionsnowDistinct elements currently being edited by more than one user.
active_editorseditorsnowEditors active within the editor timeout window.
stale_content_countentriesnowLive entries not updated within staleContentDays.
failed_loginsaccountslast hourUser accounts with at least one failed login. Attempts against usernames that don’t exist aren’t recorded by Craft, so they aren’t counted.
critical_updatespackagesnowCraft and plugins with a critical release waiting, from the update info Craft has cached. Control Tower never calls out for it; when Craft hasn’t checked recently the metric has no value and rules on it are skipped.

The % and ms gauges accept >, >=, < and <=; counts accept all five operators. A metric that can’t be measured right now has no value, and rules on it are skipped for that check rather than compared against zero.

Custom metrics

Any plugin or module can add metrics through MetricRegistryService::EVENT_REGISTER_METRICS. Each metric implements MetricInterface: a handle (stored on rules), label, unit, optional description, the operators that make sense for it, an optional look-back window in seconds, and getValue(MetricPeriod $period). Register a CallbackMetric for a one-liner, or extend Metric:

use craft\elements\Entry;
use justinholtweb\controltower\events\RegisterMetricsEvent;
use justinholtweb\controltower\metrics\CallbackMetric;
use justinholtweb\controltower\metrics\MetricPeriod;
use justinholtweb\controltower\services\MetricRegistryService;
use yii\base\Event;

Event::on(
    MetricRegistryService::class,
    MetricRegistryService::EVENT_REGISTER_METRICS,
    function(RegisterMetricsEvent $event) {
        $event->metrics[] = new CallbackMetric([
            'handle' => 'ops:entries_created',
            'label' => 'Content: entries created',
            'unit' => 'entries',
            'window' => 900,
            'operators' => ['>', '>=', '<', '<='],
            'evaluator' => fn(MetricPeriod $period) => Entry::find()
                ->status(null)
                ->dateCreated(['and', '>= ' . $period->start->format(DATE_ATOM), '< ' . $period->end->format(DATE_ATOM)])
                ->count(),
        ]);

        // Or a class extending justinholtweb\controltower\metrics\Metric:
        $event->metrics[] = PendingUsersMetric::class;
    }
);
  • Handles start with a letter and use at most 50 letters, digits, _ - . :. Prefix them with your own handle.
  • Return null when the value can’t be measured; rules skip the check instead of comparing against zero.
  • An evaluator that throws, or returns NAN/INF, is logged and skipped — the rest of the alert sweep carries on.
  • Keep evaluators cheap and never call out to the network from one: they run on every alert check, System Pulse load and widget refresh.
  • Malformed registrations (bad handle, no label, unknown operator) are skipped with a warning. A built-in’s handle can’t be taken over.

If whatever registered a metric is removed, rules on it are listed as Unavailable and skipped by alert checks; opening one shows a warning, and it won’t save until it points at an available metric. Reinstalling the provider brings the rule back unchanged.

The plugin’s docs/metrics.md has the full contract and a complete example module (docs/examples/opsmetrics), which the plugin’s integration suite loads and runs.

Default rules

Installs seed five rules so monitoring is useful out of the box:

  • Queue has failed jobs — queue_failed ≥ 3, critical
  • Multiple editors on same entry — editor_collisions ≥ 1, warning
  • CPU usage critical — cpu_percent ≥ 90, critical
  • Memory usage critical — memory_percent ≥ 90, critical
  • Disk usage critical — disk_percent ≥ 90, critical

Edit, disable, or delete them like any other rule. They’re only seeded when the alert rules table is empty, so they don’t come back after deletion.

Webhooks

Webhook destinations are defined once globally under Control Tower → Webhooks and referenced from any number of rules. Three destination types are supported:

TypePayload
SlackBlock Kit message with a header, body, and a context line linking back to Control Tower.
Microsoft TeamsAdaptive Card (v1.4) compatible with Power Automate / Incoming Webhook connectors, with severity-tinted heading and a fact table.
Generic JSONStable JSON envelope suitable for Zapier, IFTTT, n8n, Pipedream, or your own service.

Send test

The webhook edit screen has a Send test button that fires a sample payload at the configured URL and reports the HTTP status inline. Use it to verify connectivity before relying on a destination for real alerts.

Generic JSON payload

The generic formatter emits a flat envelope with the following fields:

{
  "event": "firing" | "resolved",
  "severity": "info" | "warning" | "critical",
  "ruleId": 12,
  "ruleName": "CPU usage critical",
  "metric": "cpu_percent",
  "metricLabel": "Server: CPU usage",
  "metricUnit": "%",
  "metricWindow": null,
  "metricAvailable": true,
  "operator": ">=",
  "threshold": 90,
  "alertId": 4521,
  "alertMessage": "CPU at 94% for 5 minutes.",
  "alertContext": { ... },
  "siteName": "My Craft Site",
  "environment": "production",
  "firedAt": "2026-05-14T14:21:00+00:00",
  "resolvedAt": null,
  "alertUrl": "https://example.com/admin/control-tower/alerts"
}

Email recipients

Each rule can independently notify Craft admins and/or a freeform list of extra addresses. Emails render from templates/_cp/_emails/alert.twig. To customize the look, copy that template into your project’s templates/control-tower/_cp/_emails/alert.twig and edit; Craft’s template overrides apply normally.

Flap throttling

Set Minimum notify interval on a rule (in minutes) to suppress repeat notifications when an alert flaps. The throttle only affects delivery — the alert is still recorded and visible in the Alerts tab on every check.

Permissions

Creating, editing, and deleting alert rules and webhooks requires the Manage alert rules and webhooks permission (controltower:manageAlerts). Viewing the Alerts tab only requires View Control Tower dashboards (controltower:viewDashboard). See Usage → Permissions for the full permission list.

More in Performance & Monitoring

Pairs well with Control Tower

Find out what's slow, what's broken and what's running before somebody emails you about it.