v1/alerts
Use the v1/alerts API to create, update, list, and manage alerts for your account. For each alert, specify the alert, the scope for the alert, as well as rules for the alert to fire and reset. The alert scope and fire/reset rules vary depending on the alert type.
Info
In the classic Remote Manager interface and pre-v1 APIs, alerts are called alarms, and the two terms are synonymous. Going forward, Digi recommends you use the /v1/alerts API rather than the pre-v1 Alarm APIs to manage alerts.
URI
https://<hostname>/ws/v1/alerts
HTTP method |
Format |
Description |
Parameters |
GET |
/ws/v1/alerts |
Get a summary of the alerts API. |
|
GET |
/ws/v1/alerts/summary |
Get a summary of alerts. |
query |
GET |
/ws/v1/alerts/bulk |
List alerts in bulk CSV format. |
orderby query fields |
GET |
/ws/v1/alerts/bulk/summary/ws/v1/alerts/bulk/status |
Export up to 20,000 rows of CSV data representing the summary or status of any alarm that has been fired and/or reset. |
orderby query fields |
GET |
/ws/v1/alerts/inventory |
List alerts |
cursor orderby size query |
POST |
/ws/v1/alerts/inventory |
Create one or more alerts |
None |
GET, PUT, DELETE |
/ws/v1/alerts/inventory/{id} |
Get a specific alert, modify an existing alert, and delete an alert. |
|
GET |
/ws/v1/alerts/history/{alert_id_source} |
Get history of fired alerts. |
cursor size start_time end_time order |
GET |
/ws/v1/alerts/status |
Get current status for alerts. |
cursor orderby size query |
GET |
/ws/v1/alerts/summary |
Get a summary of all alerts. |
cursor orderby size query |
Fields
id
System generated identifier for the alert.
name
String name of the alert.
description
String that describes the alert.
enabled
Boolean indicating if the alert is enabled. Default is true.
fire
The definition of the rule describing conditions for when the alert fires. Not all alerts require a fire rule.
fire.parameters
A map of parameter names and values indicating the conditions required for the alert to fire.
priority
String describing the priority assigned to the alert.
reset
The definition of the rule describing conditions for when the alert is reset. Not all alerts require a reset rule.
reset.enabled
Boolean indicating if the rule should automatically reset.
reset.parameters
A map of parameter names and values indicating the conditions required for the alert to reset.
scope
The definition of the scope defining how the alert is applied.
scope.type
What type of scope defines how the alert is applied.
- Device: The target of the alert is a specific device.
- Global: The target of the alert is global to the account.
- Group: The target of the alert is a group or all devices in a group.
- Resource: The target of the alert is a resource in the system.
- XBeeNode: The target of the alert is a specific XBee node.
scope.value
The value indicating the scope target depends on the scope.type setting.
Scope Type |
Scope Value |
Device |
The scope.value field is a device id. For example: 00000000-00000000-00000000-00000000 |
Global |
The scope.value field is the empty string. |
Group |
The scope.value field is a group name: For example: Regions/Northwest indicates any devices in the Northwest subgroup of the Regions group. |
Resource |
The scope.value field is the resource identifier. For example a stream name: 00000000-00000000-00000000-00000000/metrics/sys/cpu/used. Can use the wildcard character (*) to include all path components of a stream name, for example */metrics/sys/cpu/used. |
XBeeNode |
The scope.value field is an XBee node extended address. For example: 00:08:A2:A5:6E:4D:52:85 |
type
String that indicates the alert type.
- DataPoint On Change: Fires when a data point is uploaded containing a different value from the previous data point. The scope type of a DataPoint on Change alert is always Resource.
- DataPoint condition: Fires when a data point is uploaded containing a value that matches the specified criteria. The scope type of a DataPoint condition alert is always Resource.
- Device Excessive Disconnects: Fires when devices disconnect with a specified frequency. The scope type of a Device Excessive Disconnects alert is Group or Device.
- Device Name On Change: Fires when a devices name changes. The scope type of a Device Name On Change alert is Group or Device.
- Device Offline: Fires when devices disconnects for a specified time. The scope type of a Device Offline alert is Group or Device.
- Dia channel data point condition match: Fires when a DIA channel data point is uploaded containing a value that matches the specified criteria. The scope type of a Dia channel data point condition match is Group or Device.
- Missing DataPoint: Fires when a new data point is not uploaded for a specified time. The scope type of a Missing DataPoint alert is always Resource.
- Missing DiaChannel DataPoint: Fires when a new DIA channel data point is not uploaded for a specified time. The scope type of a Missing DiaChannel DataPoint alert is Group or Device.
- Missing Smart Energy DataPoint: Fires when a new Smart Energy data point is not uploaded for a specified time. The scope type of a Missing Smart Engergy DataPoint alert is Group, Device, or XBeeNode.
- Smart energy data point condition match: Fires when a Smart Energy data point is uploaded containing a value that matches the specified criteria. The scope type of a Smart energy data point condition match ialert s Group, Device, or XBeeNode.
- Subscription Usage: Fires when the account subscription usage matches the specified criteria. The scope type of a Subscription Usage alert is always Global.
- XBeeNode Excessive Deactivations: Fires when XBee nodes deactivate with a specified frequency. The scope type of an XBeeNode Excessive Deactivations alert is Group, Device ,or XBeeNode.
- XBeeNode Offline: Fires when an XBee node is offline for a specified time. The scope type of an XBeeNode Offline alert is Group, Device, or XBeeNode.
Datapoint Condition Alert
Example: Datapoint condition alert
The following example alert payload represents a DataPoint condition alert. This alert might be used to determine if action (replacing a battery) is needed for a device that is tracking voltage.
The alert fires when the value uploaded to the data stream */drivestats/voltage is less than 10 volts for 30 minutes. The alert resets when the voltage value is greater than or equal to 10 volts for 15 minutes (for example, the battery was replaced or charged).
The wildcard (*) character used in the scope.value field indicates that any device uploading this stream is the target for the alert (the Device ID is always the first component of a stream name and this alert targets data streams.
{
"description": "Fires when a vehicle fleet battery needs replacing",
"enabled": true,
"fire": {
"parameters": {
"thresholdValue": "10",
"type": "numeric",
"operator": "<",
"timeout": "30",
"timeUnit": "minutes"
}
},
"id": 150027,
"name": "Low Voltage",
"priority": "high",
"reset": {
"parameters": {
"thresholdValue": "10",
"type": "numeric",
"operator": ">=",
"timeout": "15",
"timeUnit": "minutes"
}
},
"scope": {
"type": "Resource",
"value": "*/drivestats/voltage"
},
"type": "DataPoint condition"
}
List Alerts
Use the GET v1/alerts/inventory web service to retrieve a list of alerts.
URI
https://<hostname>/ws/v1/alerts/inventory
API Usage
There is no request payload for the GET ws/v1/alerts/inventory API. Use the alert fields and queries to select alerts.
Parameters
Name |
Type |
Description |
cursor |
string |
Cursor to get the next page of alerts. Omit on initial call. |
orderby |
string |
Return alerts ordered by the field given. The default is “name asc” |
query |
string |
Use a query expression to target a specific list of alerts. The default is all alerts. |
size |
integer |
Number of items to return. The maximum and default is 1000. |
Successful Response
Upon success, the list of alerts is returned.
{
"count": 1,
"size": 1000,
"list": [
{
"description": "Detects when the office cellular backup network goes offline",
"enabled": true,
"fire": {
"parameters": {
"reconnectWindowDuration": "1"
}
},
"id": 146639,
"name": "Office Backup Offline",
"priority": "high",
"reset": {},
"scope": {
"type": "Device",
"value": "00000000-00000000-00000000-00000000"
},
"type": "Device Offline"
}
]
}
Error Response
An error response returns the error_status and error_message fields in the payload.
{
"error_status": 400,
"error_message": "error message"
}
Create alerts
Use the POST v1/alerts/inventory web service to create alerts for your account.
URI
https://<hostname>/ws/v1/alerts/inventory
API Usage
There are no parameters for the POST ws/v1/alerts/inventory API.
Specify an HTTP header of Content-Type: application/json and post json payload describing the alert or alerts.
Request Payload
To create multiple alerts, use a list syntax. For a single alert, the list syntax is not required.
[
{ ...alert1 },
{ ...alert2 },
...
{ ...alertN }
]
Successful Response
Upon success, the alert is returned. The returned alert may differ from the input alert because default values are supplied in the returned alert. A list response is returned whether the POST created single or multiple alerts.
{
"count": N,
"list" : [
{ ...alert1 },
{ ...alert2 },
...
{ ...alertN },
]
}
Error Response
When creating multiple alerts, if any alert is successfully created, a response of 207 and error information for the failed responses are returned.
In the following example response payload, the second alert failed. The HTTP response is 207 because one alert (alert1) was created successfully, and the second item in the list has error values indicating the problem with the second alert (alert2).
{
"count": N,
"list": [
{ ...alert1 },
{
"error_context": { ...alert2 },
"error_message": "The error message",
"error_status": 400
},
{ ...alertN }
]
}
Sample Alert Definitions
The following sample payloads represent the different alert types.
DataPoint condition
DataPoint On Change
Device Excessive Disconnects
Device Name On Change
Device Offline
Dia channel data point condition match
Missing DataPoint
Missing DiaChannel DataPoint
Missing Smart Energy DataPoint
Smart energy data point condition match
Subscription Usage
XBeeNode Excessive Deactivations
XBeeNode Offline
Datapoint Condition
The following payload creates a DataPoint condition alert. This alert type fires when a data stream value matches the condition criteria.
Values:
-
scope.type: Always Resource.
-
scope.value: The stream with wildcard (*) for device id or path components.
-
timeout: Fire or reset if the value matches for this amount of time.
-
timeUnit: One of seconds, minutes, hours.
-
operator: One of <, <=, >, >=, =, <>.
-
type: One of string or numeric.
-
thresholdValue: The target value for the condition.
{
"type": "DataPoint condition",
"name": "Voltage check",
"description": "Watch for low voltage on fleet vehicles",
"scope": {
"type": "Resource",
"value": "*/drivestats/voltage"
},
"fire": {
"parameters": {
"operator": "<",
"thresholdValue": "10",
"timeUnit": "minutes",
"timeout": "60",
"type": "numeric"
}
},
"reset": {
"parameters": {
"operator": ">=",
"thresholdValue": "10",
"timeUnit": "minutes",
"timeout": "60",
"type": "numeric"
}
}
}
Datapoint on Change
The following payload creates a DataPoint On Change alert. This alert type fires when a data stream value changes. Repeated uploads of the same value do not cause the alert to fire. This alert automatically resets when the data point value remains unchanged for 60 minutes.
The target data stream matches any device with a drivestats/voltage stream name.
Values:
-
scope.type: Always Resource.
-
scope.value: The stream with wildcard (*) for device id or path components.
-
timeout: Reset automatically if the value does not change for this amount of time.
-
timeUnit: One of seconds, minutes, hours.
{
"type":"DataPoint On Change",
"reset": {
"parameters": {
"timeout": "60",
"timeUnit": "minutes"
}
},
"scope": {
"type":"Resource",
"value":"*/drivestats/voltage"
}
}
Device Excessive Disconnects
The following payload creates a Device Excessive Disconnects alert. This alert type fires when a device goes offline many times during a time period.
Values:
-
scope.type: One of Group or Device.
-
scope.value: If type is Group, then value is the full group path (with no leading slash). If type is Device, then value is the full device ID. If type is XBeeNode, then the value is the XBee node extended src address.
-
disconnectCount: Fires if the device disconnects more than this many times in the disconnectWindow
-
disconnectWindow: The period of time in minutes for which to count disconnects.
-
reconnectWindow: Resets when the device connects and stays connect for this number of minutes.
{
"type":"Device Excessive Disconnects",
"scope":{
"type":"Device",
"value":"00000000-00000000-000000FF-FF000000"
},
"fire":{
"parameters":{
"disconnectCount":"10",
"disconnectWindow":"60"
}
},
"reset":{
"parameters":{
"reconnectWindow":"30"
}
},
}
Device Name on Change
The following payload creates a Device Name on Change alert. This alert type fires when a device name changes. The alert does not fire when a device name is set on a device that has no name. The alert can reset automatically.
Values:
-
scope.type: One of Group or Device.
-
scope.value: If type is Group, then value is the full group path (with no leading slash). If type is Device, then value is the full device ID. If type is XBeeNode, then the value is the XBee node extended src address.
-
timeout: Reset automatically if the value does not change for this amount of time.
-
timeUnit: One of seconds, minutes, hours.
{
"type":"Device Name On Change",
"reset":{
"parameters":{
"timeout":"12",
"timeUnit":"hours"
}
},
"scope":{
"type":"Group",
"value":"Deployments/Europe/UK"
}
}
Device Offline
The following payload creates a Device Offline alert. This alert type fires when a device disconnects for a period of time.
Values:
-
scope.type: One of Group or Device.
-
scope.value: If type is Group, then value is the full group path (with no leading slash). If type is Device, then value is the full device ID. If type is XBeeNode, then the value is the XBee node extended src address.
-
reconnectWindowDuration: Fires if the device does not reconnect within this number of minutes.
-
reset.disabled: Is set to true to cause this alert to not auto-reset. The default is false.
{
"name":"Network offline",
"type":"Device Offline",
"description":"Detect if any midwest office networks are offline",
"priority":"high",
"fire":{
"parameters":{
"reconnectWindowDuration":"12"
}
},
"reset": {
"disabled": true
},
"scope": {
"type":"Group",
"value":"Stores/North America/Midwest"
}
}
Dia Channel Datapoint Condition Match
The following payload creates a Dia channel data point condition match alert. This alert type fires when the value reported in a DIA channel matches the condition criteria.
Values:
-
scope.type: One of Group or Device.
-
scope.value: If type is Group, then value is the full group path (with no leading slash). If type is Device, then value is the full device ID. If type is XBeeNode, then the value is the XBee node extended src address.
-
channelName: The dia channel name or wildcard (*) for all channels.
-
instanceName: The dia channel instance name or wildcard (*) for all instances.
-
timeout: Fire or reset if the value matches for this amount of time.
-
timeUnit: One of seconds, minutes, hours.
-
operator: One of <, <=, >, >=, =, !=.
-
type: One of string or numeric.
-
thresholdValue: The target value for the condition.
{
"type": "Dia channel data point condition match",
"scope": {
"type": "Group",
"value": "New York/Sensors"
},
"fire": {
"disabled": false,
"parameters": {
"channelName": "chan1",
"instanceName": "stream",
"operator": ">=",
"thresholdValue": "25",
"timeUnit": "seconds",
"timeout": "30",
"type": "numeric"
}
},
"reset": {
"disabled": false,
"parameters": {
"channelName": "chan1",
"instanceName": "stream",
"operator": "<",
"thresholdValue": "25",
"timeUnit": "seconds",
"timeout": "30",
"type": "numeric"
}
}
}
Missing Datapoint
The following payload creates a Missing DataPoint alert. This alert type fires when the interval between data point uploads or data point measurements exceeds the requested time. Devices may cache data uploads, uploading infrequently (for example 24 hours), but uploading many measurements (for example, 24 total measurements if sampling every hour).
This alert automatically resets when data is reported.
Values:
-
scope.type: Always Resource.
-
scope.value: The stream with wildcard (*) for device id or path components.
-
uploadInterval: Fire if the amount of time between uploads exceeds this interval.
-
uploadTimeUnit: The units of the uploadInterval value—seconds, minutes, hours.
-
readingInterval: Fire if the amount of time between individual samples/reading exceeds this interval.
readingInterval}} value—seconds, minutes, hours.
-
reset.disabled: Resets automatically when data is reported, you can disable this by specifying true.
{
"name":"Fleet sensor not reporting",
"type":"Missing DataPoint",
"scope":{
"type":"Resource",
"value":"*/drivestats/voltage"
},
"fire":{
"parameters":{
"readingTimeUnit":"seconds",
"uploadTimeUnit":"minutes",
"uploadInterval":"1",
"readingInterval":"5"
}
},
"reset": {
"disabled": true
}
}
Missing Dia Channel Datapoint
The following payload creates a Missing DiaChannel DataPoint alert. This alert type fires when the interval between data point uploads or data point measurements exceeds the requested time. Devices may cache data uploads, uploading infrequently (for example 24 hours), but uploading many measurements (for example, 24 total measurements if sampling every hour).
This alert automatically resets when data is reported.
Values:
-
scope.type: One of Group or Device.
-
scope.value: If type is Group, then value is the full group path (with no leading slash). If type is Device, then value is the full device ID. If type is XBeeNode, then the value is the XBee node extended src address.
-
uploadInterval: Fire if the amount of time between uploads exceeds this interval.
-
uploadTimeUnit: The units of the uploadInterval value—seconds, minutes, hours.
-
readingInterval: Fire if the amount of time between individual samples/reading exceeds this interval.
readingInterval}} value—seconds, minutes, hours.
-
channelName: The dia channel name or wildcard (*) for all channels.
-
instanceName: The dia channel instance name or wildcard (*) for all instances.
-
reset.disabled: Resets automatically when data is reported, you can disable this by specifying true.
{
"type": "Missing DiaChannel DataPoint",
"scope": {
"type": "Device",
"value": "00000000-00000000-000000FF-FF000000"
},
"fire": {
"parameters": {
"channelName": "chan1",
"instanceName": "*",
"readingInterval": "10",
"readingTimeUnit": "minutes",
"uploadInterval": "1",
"uploadTimeUnit": "hours"
}
}
}
Missing Smart Energy Datapoint
The following payload creates a Missing Smart Energy DataPoint alert. This alert type fires when the interval between data point uploads or data point measurements exceeds the requested time. Devices may cache data uploads, uploading infrequently (for example 24 hours), but uploading many measurements (for example, 24 total measurements if sampling every hour).
This alert automatically resets when data is reported.
Values:
-
scope.type: One of Group, Device, or XBeeNode.
-
scope.value: If type is Group, then value is the full group path (with no leading slash). If type is Device, then value is the full device ID. If type is XBeeNode, then the value is the XBee node extended src address.
-
uploadInterval: Fire if the amount of time between uploads exceeds this interval.
-
uploadTimeUnit: The units of the uploadInterval value—seconds, minutes, hours.
-
readingInterval: Fire if the amount of time between individual samples/reading exceeds this interval.
readingInterval}} value—seconds, minutes, hours.
-
attributeId: The XBee attribute id.
-
clusterId: The XBee cluster id.
-
clusterType: The XBee cluster type.
-
endpointId: The XBee endpoint id.
-
reset.disabled: Resets automatically when data is reported, you can disable this by specifying true.
{
"type": "Missing Smart Energy DataPoint",
"scope": {
"type": "Group",
"value": "New York/Sensors"
},
"fire": {
"parameters": {
"attributeId": "1",
"clusterId": "1794",
"clusterType": "0",
"endpointId": "1",
"readingInterval": "1",
"readingTimeUnit": "hours",
"uploadInterval": "24",
"uploadTimeUnit": "hours"
}
},
}
Smart Energy Datapoint Condition Match
The following payload creates a Smart energy data point condition match alert. This alert type fires when the value reported in a DIA channel matches the condition criteria.
Values:
-
scope.type: One of Group, Device, or XBeeNode.
-
scope.value: If type is Group, then value is the full group path (with no leading slash). If type is Device, then value is the full device ID. If type is XBeeNode, then the value is the XBee node extended src address.
-
timeout: Fire or reset if the value matches for this amount of time.
-
timeUnit: One of seconds, minutes, hours.
-
operator: One of <, <=, >, >=, =, !=.
-
type: One of string or numeric.
-
thresholdValue: The target value for the condition.
-
attributeId: The XBee attribute id.
-
clusterId: The XBee cluster id.
-
clusterType: The XBee cluster type.
-
endpointId: The XBee endpoint id.
{
"type": "Smart energy data point condition match",
"scope": {
"type": "Group",
"value": ""
},
"fire": {
"disabled": false,
"parameters": {
"attributeId": "1",
"clusterId": "1794",
"clusterType": "0",
"endpointId": "1",
"thresholdValue": "50",
"timeUnit": "seconds",
"timeout": "1",
"type": "numeric"
}
},
"reset": {
"disabled": false,
"parameters": {
"attributeId": "1",
"clusterId": "1794",
"clusterType": "0",
"endpointId": "1",
"thresholdValue": "49",
"timeUnit": "seconds",
"timeout": "1",
"type": "numeric"
}
}
}
Subscription Usage
The following payload creates a Subscription Usage alert. This alert type fires when the account uses 95 percent of the devices available for use based on the Remote Manager subscription.
There are a wide variety of values for the parameters of this alert. It is recommended that an alert is created with the Remote Manager Web UI, and you determine the acceptable values from a call to GET ws/v1/alerts/inventory.
Values:
-
scope.type: Always Global.
-
scope.value: Always empty string.
-
svcId: The service identifier.
-
unit: The unit being checked.
-
metric: The metric for the subscription data.
-
thresholdValue: The target value for the condition.
{
"name":"Too many devices",
"type":"Subscription Usage",
"scope":{
"type":"Global",
"value":""
},
"fire":{
"parameters":{
"svcId":"3",
"unit":"%",
"metric":"devices",
"thresholdValue":"90"
}
}
}
XbeeNode Excessive Deactivations
The following payload creates an XBeeNode Excessive Deactivations alert. This alert type fires when a device goes offline many times during a time period.
Values:
-
scope.type: One of Group, Device, or XBeeNode.
-
scope.value: If type is Group, then value is the full group path (with no leading slash). If type is Device, then value is the full device ID. If type is XBeeNode, then the value is the XBee node extended src address.
-
deactivationCount: Fires if the device deactivates more than this many times in the deactivationWindow
-
deactivationWindow: The period of time in minutes for which to count deactivations.
-
activationWindow: Resets when the Xbee node activates and stays activated for this number of minutes.
{
"type":"XBeeNode Excessive Deactivations",
"scope":{
"type":"XbeeNode",
"value":"00:00:00:00:00:00:00:00"
},
"fire":{
"parameters":{
"deactivationWindow":"5",
"deactivationCount":"1"
}
},
"reset":{
"parameters":{
"activationWindow":"1"
}
}
}
Xbeenode Offline
The following payload creates an XBeeNode Offline alert. This alert type fires when an XBee node is offline for a period of time.
Values:
-
scope.type: One of Group, Device, or XBeeNode.
-
scope.value: If type is Group, then value is the full group path (with no leading slash). If type is Device, then value is the full device ID. If type is XBeeNode, then the value is the XBee node extended src address.
-
reconnectWindowDuration: Fires if the device does not reconnect within this number of minutes.
-
reset.disabled: Is set to true to cause this alert to not auto-reset. The default is false.
{
"type":"XBeeNode Offline",
"scope":{
"type":"Group",
"value":"New York/Manhattan/Sensors"
},
"fire":{
"parameters":{
"reconnectWindowDuration":"1"
}
}
}