Rule Engine Triggers

What is trigger in Rule Engine

As described in the Rule Engine Getting Started, a trigger is an event or condition that initiates rule execution. For a trigger to execute a rule, it must be attached to the rule. The same trigger can be attached to none, one, or many rules.

If a trigger is not attached to any rule, it is passive because it has nothing to execute. If a trigger is attached to one or more rules, it is active, meaning it will execute the rule(s) once the monitored condition occurs, e.g., a device posted telemetry.

As you may recall from Rule Engine Getting Started, a rule is always executed for a particular endpoint. The trigger is responsible for determining that endpoint. A trigger always monitors conditions for an endpoint or a set of endpoints. If a trigger is configured for a specific endpoint, it monitors the condition only for that endpoint. If a trigger is configured for an application or application version, it monitors the condition for all endpoints belonging to that application or version.

Trigger types

  • Endpoint metadata updated: Triggers when the endpoint metadata metadata is updated.
  • Endpoint data sample updated: Triggers when an endpoint posts a telemetry.
  • Endpoint time series updated: Triggers when a time series value is updated.
  • Endpoint command dispatched: Triggers when a command is dispatched to an endpoint.
  • Endpoint command result received: Triggers when a command is executed by an endpoint.
  • Alert lifecycle event: Triggers when a specified alert lifecycle event occurs.
  • Schedule (cron): Triggers based on a configured cron schedule.

All trigger types, among others, share a common set of fields:

  • Application
  • Application version name
  • Endpoints

Triggers common field

Only one of these three options must be specified: either Application, Application version name, or Endpoints. These fields define for which endpoint(s) the attached rule(s) must be executed.

Endpoint Metadata Updated Trigger

Executes a rule once the endpoint metadata is updated on a monitored endpoint. Metadata can be updated either via the UI or by the endpoint itself.

Endpoint Data Sample Updated Trigger

Executes a rule once an endpoint posts telemetry via the MQTT device API or the HTTP device API.

Endpoint Time Series Updated Trigger

Executes a rule once the monitored time series value is updated.

Time series trigger

Endpoint Command Dispatched Trigger

Executes a rule once a monitored command type (e.g., SWITCH_ON) is dispatched to an endpoint. Commands are dispatched from the UI or via the REST API.

Command dispatched trigger

Endpoint Command Result Received Trigger

Executes a rule once an endpoint reports an executed command via the MQTT device API or the HTTP device API.

Command executed trigger

Alert Lifecycle Event Trigger

Executes a rule once a monitored alert lifecycle event occurs. Available alert lifecycle events:

  • Created: A new alert is fired.
  • Active: The alert is active, meaning the condition that caused the alert is still present.
  • Resolved: The alert is resolved.
  • Acknowledged: The alert is acknowledged.
  • Unacknowledged: The alert is unacknowledged.
  • Severity level increased: The alert severity level is increased, e.g., from HIGH to CRITICAL.
  • Severity level decreased: The alert severity level is decreased, e.g., from CRITICAL to HIGH.

Alert lifecycle trigger

Schedule (cron)

Executes a rule based on a cron expression or at a specified interval.

Schedule trigger