Core
IoT Platform v2.x
2

Alerts #

Alerts are documents representing anomalies in the platform's operation.

Alerts are triggered by business rules and can then be manipulated through the IoT Console.

An alert document is composed of 3 sections:

  • alertRule: contains the information of the alert rule that generated the alert. this can be a rule from the alert-rules collection or a business workflow
  • status: contains information about the status of the alert: pending or acknowledged.
  • document: contains information about the document that triggered the alert
interface AlertContent {
  /**
   * Alert rule document
   */
  alertRule: {
    /**
     * Alert rule ID or workflow ID
     */
    _id: string,

    /**
     * Alert rule content
     */
    _source: AlertRuleContent,
  };

  /**
   * Status
   */
  status: AlertStatus;

  /**
   * Information about the document who triggered the alert
   */
  document: {
    /**
     * Document ID
     */
    _id: string,

    /**
     * Document content
     */
    _source: JSONObject,

    /**
     * Document collection
     */
    collection: string,
  };
}

It is possible to create custom alerts using a workflow or other backend mechanism of the platform. If the created alert respects the defined standard then it will be manipulated through the IoT Console.

Threshold alerts #

Threshold alerts are alerts generated based on thresholds defined on measurements.

They are created via the IoT Console. Each alert rule is stored in the alert-rules collection.

Timeout alert #

Timeout alerts are alerts that are generated based on the amount of time a device is inactive (not receiving new payloads).

If a device does not receive a new payloads during a defined period of time, then a timeout alert is created for this device.

When a new payload is received, the existing alert is automatically acknowledged.

The configuration of this alert is done in the workflow workflow--device-timeout present in the config collection of the index of each tenant.

By default, the alert is not activated. In order to activate it, you have to modify the arguments of the action by entering thresholds for the device models you want to monitor.

{
  "workflow": {
    // [...]
    "actions": [
      {
        "type": "task",
        "name": "check-device-timeout",
        "args": {
          "thresholds": [
            // activate the timeout alert for Abeeway and Enginko devices
            {
              "models": ["Abeeway", "Enginko"],
              // trigger after one hour without receiving new payload
              "timeoutAfter": 3600
            }
          ]
        }
      }
    ]
  },
}

Acknowledging the alerts #

You can acknowledge alerts by batch by following this example:

{
  controller: 'alerts',
  action: 'acknowledge',
  index: "myIndex",
  body: {
    alertIds: [], // array of alert ids
  },
}