Smart Site
Home Docs Smart Data Alarm Management

Alarm Management

The Alarm module evaluates live data points against rules and produces actionable alarms. It supports threshold, comparison, and status conditions, multi-channel notifications, escalation tiers, and rich statistics for dashboards.

Interface Screenshot

Alarm Management - Event Center (English UI)

Captured from the live Smart Site system with the English UI. See the zh-CN counterpart for the Chinese-UI screenshot.

1. Core Concepts

  • Alarm Rule — A condition attached to a tag that, when true, raises an alarm
  • Alarm Event — A concrete occurrence with state (active, acknowledged, cleared)
  • Alarm Group — A bundle of related rules for batch acknowledgment and notification routing
  • Escalation — A tiered policy that re-notifies or reroutes if an alarm stays unacknowledged

The alarm engine is implemented in @ss-node/ss-alarm and runs as a pipeline step (alarm-check.step.ts) after data is read.

2. Alarm Rule Types

Type Trigger Condition Example
Threshold value crosses a numeric boundary temp > 80
Comparison value differs from another tag or a setpoint actual != setpoint
Status value equals a discrete state motorState == 2 (fault)
Device Offline no heartbeat within the configured window offline > 60s

Each rule defines:

  • Severity — low / medium / high / critical
  • Delay — Minimum duration the condition must hold before raising (debounce)
  • Recovery — Auto-clear when the condition becomes false (optional)

3. Functional Areas

3.1 Alarm Rules CRUD

  • Create rules per tag from the device detail page or System → Alarms
  • Define condition expression, severity, delay, and recovery behavior
  • Enable / disable rules without deleting them
  • Group rules into alarm groups for collective handling

The ConditionEvaluator parses and evaluates rule expressions safely.

3.2 Alarm Triggering

  1. The pipeline reads a new value for a tag
  2. AlarmCheckStep finds rules attached to that tag
  3. ConditionEvaluator evaluates each rule
  4. If true beyond the delay, AlarmDebouncer confirms the alarm
  5. AlarmService persists an Alarm entity and emits alarm.raised on the EventBus
  6. The WebSocket gateway pushes the alarm to subscribed clients

3.3 Alarm Notifications

Notifications are delivered through pluggable channels that implement NotificationChannel:

Channel Implementation Notes
Email (SMTP integration) HTML templates per severity
SMS SmsNotificationChannel Provider config in system settings
Webhook WebhookNotificationChannel POST JSON payload to a URL
TTS TtsNotificationChannel Voice call for critical alarms

Channels are configured globally and selected per alarm group. The AlarmNotificationService fans out an alarm to all enabled channels for its group.

3.4 Alarm Escalation

The AlarmEscalatorService implements tiered escalation:

  • Tier 1 — Notify the on-call user immediately
  • Tier 2 — If unacknowledged after X minutes, notify the team lead
  • Tier 3 — If still unacknowledged after Y minutes, notify the manager / broadcast

Each tier can use different channels. Escalation stops as soon as the alarm is acknowledged.

3.5 Alarm Suppression

To avoid noise during maintenance:

  • AlarmSuppressionService — suppress alarms for a tag or device for a time window
  • DeviceOfflineSuppressionService — when a device goes offline, suppress dependent alarms to prevent a storm

3.6 Alarm Statistics and Charts

The AlarmStatisticsService and its controller expose:

  • Alarm counts by severity over a time range
  • Top N tags with the most alarms
  • Mean time to acknowledge (MTTA) and mean time to recover (MTTR)
  • Trend charts for the dashboard

4. Operational Guidance

4.1 Acknowledging an Alarm

  1. Open System → Alarms or watch the realtime alarm banner
  2. Select the active alarm
  3. Click Acknowledge — requires the alarm:ack permission
  4. Optionally enter a comment
  5. Escalation stops; the alarm remains active until it clears

4.2 Creating a Threshold Rule

  1. From the device detail page, pick a tag
  2. Click Add Alarm Rule → choose Threshold
  3. Set operator (>, <, >=, <=, ==, !=) and threshold value
  4. Choose severity and delay
  5. Save — the rule is active immediately

5. FAQ

Q: An alarm fires repeatedly every scan. A: Enable the debounce delay so the condition must hold for a configured duration before re-raising. Also confirm the recovery behavior is set to auto-clear.

Q: Notifications are not being sent. A: Verify the alarm group has channels enabled and that channel credentials are set in System → Settings. Check the AlarmNotificationService logs for delivery errors.

Q: A device went offline and I got hundreds of alarms. A: The DeviceOfflineSuppressionService should suppress dependent alarms. Confirm it is enabled and that the offline threshold is reasonable. Suppress the tag manually during maintenance if needed.

Q: How do I mute alarms for planned maintenance? A: Use AlarmSuppressionService to create a suppression window for the tag or device. Alarms raised during the window are still recorded but suppressed from notification.

  • ../../03-device/README.md
  • ../../09-websocket/README.md
  • ../../10-script/README.md
  • Alarm Package