Update Active Alarm Template
Headers
Authorization: OAuth the-session-uuidBody
{
"updateActiveAlarmTemplate": {
"alarmName": "VM-CPUAverageUsedUtilization",
"comparisonOperator": "LessThanOrEqualTo",
"period": 60,
"threshold": 80.0,
"repeatInterval": 1800,
"repeatCount": -1,
"emergencyLevel": "Emergent"
},
"systemTags": [],
"userTags": []
}In the above example, the systemTags and userTags fields can be omitted. They are listed here to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateActiveAlarmTemplate":{"alarmName":"VM-CPUAverageUsedUtilization","comparisonOperator":"LessThanOrEqualTo","period":60,"threshold":80.0,"repeatInterval":1800,"repeatCount":-1,"emergencyLevel":"Emergent"}}' http://localhost:8080/zstack/v1/zwatch/activealarms/templates/c3e82dade74732009d5f4fd0b462f65d/actionsParameter List
Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
uuid | String | url | Template UUID. |
| 4.7.0 |
alarmName (Optional) | String | body (contained in the updateActiveAlarmTemplate structure) | Template name. |
| 4.7.0 |
comparisonOperator (Optional) | String | body (contained in the updateActiveAlarmTemplate structure) | Comparison operator. |
| 4.7.0 |
period (Optional) | Integer | body (contained in the updateActiveAlarmTemplate structure) | Threshold duration. |
| 4.7.0 |
threshold (Optional) | Double | body (contained in the updateActiveAlarmTemplate structure) | Threshold. |
| 4.7.0 |
repeatInterval (Optional) | Integer | body (contained in the updateActiveAlarmTemplate structure) | Alarm repeat interval. |
| 4.7.0 |
repeatCount (Optional) | Integer | body (contained in the updateActiveAlarmTemplate structure) | Alarm repeat count. |
| 4.7.0 |
emergencyLevel (Optional) | String | body (contained in the updateActiveAlarmTemplate structure) | Alarm level. |
| 4.7.0 |
labels (Optional) | String | body (contained in the updateActiveAlarmTemplate structure) |
|
| 4.7.0 |
systemTags (Optional) | List | body | System tags. |
| 4.7.0 |
userTags (Optional) | List | body | User tags. |
| 4.7.0 |
API Response
Response Example
{
"inventory": {
"uuid": "ea8aa7b6b2e43d4a9f3a19ba121ab72a",
"alarmName": "VM CPU Alarm",
"comparisonOperator": "LessThanOrEqualTo",
"period": 60,
"repeatInterval": 60,
"repeatCount": -1,
"namespace": "zstack/VM",
"metricName": "CPUIdleUtilization",
"threshold": 30.0,
"emergencyLevel": "Emergent",
"labels": "[{\"uuid\":\"48cc4d3273a249009ea2166b71495785\",\"key\":\"VMUuid\",\"operator\":\"=\",\"value\":\"c69d93586ca349b9a3bc074e2739e20a\"}]",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 4.7.0 | |
| inventory | ActiveAlarmTemplateInventory | See inventory for details. | 4.7.0 |
| error | ErrorCode | The error code. If not null, the operation failed. This field is null on success. See error for details. | 4.7.0 |
inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 4.7.0 |
| alarmName | String | 4.7.0 | |
| period | int | 4.7.0 | |
| repeatInterval | int | 4.7.0 | |
| repeatCount | int | 4.7.0 | |
| namespace | String | 4.7.0 | |
| metricName | String | 4.7.0 | |
| threshold | double | 4.7.0 | |
| labels | String | 4.7.0 | |
| createDate | Timestamp | Creation time. | 4.7.0 |
| lastOpDate | Timestamp | Last modification time. | 4.7.0 |
| comparisonOperator | ComparisonOperator | See comparisonOperator for details. | 4.7.0 |
| emergencyLevel | EmergencyLevel | See emergencyLevel for details. | 4.7.0 |
comparisonOperator
| Name | Type | Description | Starting Version |
|---|---|---|---|
| GreaterThanOrEqualTo | ComparisonOperator | 4.7.0 | |
| GreaterThan | ComparisonOperator | 4.7.0 | |
| LessThan | ComparisonOperator | 4.7.0 | |
| LessThanOrEqualTo | ComparisonOperator | 4.7.0 |
emergencyLevel
| Name | Type | Description | Starting Version |
|---|---|---|---|
| Emergent | EmergencyLevel | 4.7.0 | |
| Important | EmergencyLevel | 4.7.0 | |
| Normal | EmergencyLevel | 4.7.0 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001. | 4.7.0 |
| description | String | A brief description of the error. | 4.7.0 |
| details | String | Detailed information about the error. | 4.7.0 |
| elaboration | String | A reserved field. Default is null. | 4.7.0 |
| opaque | LinkedHashMap | A reserved field. Default is null. | 4.7.0 |
| cause | ErrorCode | The root error. The source error that caused the current error. This field is null if there is no root error. | 4.7.0 |
SDK Examples
Java SDK
UpdateActiveAlarmTemplateAction action = new UpdateActiveAlarmTemplateAction();
action.uuid = "c3e82dade74732009d5f4fd0b462f65d";
action.alarmName = "VM-CPUAverageUsedUtilization";
action.comparisonOperator = "LessThanOrEqualTo";
action.period = 60;
action.threshold = 80.0;
action.repeatInterval = 1800;
action.repeatCount = -1;
action.emergencyLevel = "Emergent";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateActiveAlarmTemplateAction.Result res = action.call();Python SDK
UpdateActiveAlarmTemplateAction action = UpdateActiveAlarmTemplateAction()
action.uuid = "c3e82dade74732009d5f4fd0b462f65d"
action.alarmName = "VM-CPUAverageUsedUtilization"
action.comparisonOperator = "LessThanOrEqualTo"
action.period = 60
action.threshold = 80.0
action.repeatInterval = 1800
action.repeatCount = -1
action.emergencyLevel = "Emergent"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateActiveAlarmTemplateAction.Result res = action.call()