Update Alert Rule¶
Update an alert rule. Any parameter (that is not null) included the request body can be updated.
Request Format¶
POST https://{apigw-address}/event-service/v2.1/alert-rules?action=update
Request Parameters (URI)¶
Name |
Location (Path/Query) |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|---|
orgId |
Query |
Mandatory |
String |
The organization ID which the asset belongs to. How to get orgId>> |
isPatchUpdate |
Query |
Mandatory |
Boolean |
Request Parameters (Body)¶
Note
You must specify either measurepointId
or deviceStatus
as the trigger of the alert.
Name |
Mandatory/Optional |
Data type |
Description |
---|---|---|---|
ruleId |
Mandatory |
String |
The alert rule ID. |
ruleDesc |
Mandatory |
StringI18n |
Specify the alert rule’s description in its respective locale’s language. For more details on the structure and locales supported, see Internationalized name struct |
modelId |
Mandatory |
String |
The model ID. How to get modelID>> |
measurepointId |
Optional |
String |
The measurement point ID. You must specify either |
deviceStatus |
Optional |
String |
The device status, such as “offline”. You must specify either |
condition |
Mandatory |
String |
The query expression. For example, “${temperature} = 19” indicates that the value of the measurement point “temperature” is 19. A slash “/” is used to express the hierarchical relationship, for which only one downward layer is supported now. For example, “${pointA/att1} = 18” indicates the “att1” attribute value of the measurement point “A” is 18. How to use expression>> |
severityId |
Mandatory |
String |
The alert severity ID. |
contentId |
Mandatory |
String |
The alert content ID. |
tags |
Optional |
Map |
The user-defined tags. (The Key and Value are of String type.) For details, see How to use tags |
scope |
Mandatory |
Array of AssetNode Structs |
Indicates the scope of the asset to which the alert applies to. For details, see AssetNode struct. |
isEnabled |
Optional |
Boolean |
|
triggeringDelayTimer |
Optional |
Integer |
The amount of time to delay triggering the alert. The unit is seconds with a range between [60 - 10800]. The alert will only be triggered when an anomaly that matches the alert rule occurs and does not return to normal within the set time. To trigger the alert immediately, set the time to 0. For more information, see Tutorial: Setting Alert Triggering Delay Timer. |
AssetNode Struct ¶
Name |
Required or Not |
Data Type |
Description |
---|---|---|---|
treeId |
true |
String |
The asset tree ID. If it is set as “all”, it indicates that this is a special node, standing for the globality of the organization. |
assetId |
true |
String |
The asset ID. How to get assetId>> |
Samples¶
Request Sample¶
url: https://{apigw-address}/event-service/v2.1/alert-rules?action=update&orgId=yourOrgId&isPatchUpdate=false
method: POST
requestBody:
{
"alertRule": {
"ruleId": "user BID",
"ruleDesc": {
"defaultValue": "Grid is connected from converter",
"i18nValue": {
"en_US": "Grid is connected from converter",
"zh_CN": "电网由变频器连接"
}
},
"modelId": "EnOS_Solar_CombinerBox",
"measurepointId": "CBX.BranchStateAttr",
"condition": "${CBX.BranchStateAttr} = 18",
"severityId": "WARN",
"contentId": "planetTemperature",
"tags": {
"key1": "v1"
},
"scope": [{
"treeId": "ptde66nd",
"assetId": "FbFy8qyz"
}],
"isEenabled": true
}
}
Return Sample¶
{
"code": 0,
"msg": "OK",
"requestId": "4873095e-621d-4cfd-bc2c-edb520f574ea",
"data": null
}
SDK Samples¶
You can access the SDK samples for alert engine service on GitHub: