UpdateAlarm
API Request
URLs
PUT zstack/v1/zwatch/alarms/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"updateAlarm": {
"name": "VM CPU Alarm",
"comparisonOperator": "LessThanOrEqualTo",
"period": 60.0,
"enableRecovery": true
},
"systemTags": [],
"userTags": []
}

Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateAlarm":{"name":"VM CPU Alarm","comparisonOperator":"LessThanOrEqualTo","period":60.0,"enableRecovery":true}}' http://localhost:8080/zstack/v1/zwatch/alarms/28397feb3d083fdc9346edb066fbf589/actions
Request Parameters
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
uuid | String | url | The resource UUID. | 2.3 | |
name | String | body (contained in the updateAlarm structure) | Optional. The resource name. | 2.3 | |
description | String | body (contained in the updateAlarm structure) | Optional. The detailed description of the resource. | 2.3 | |
comparisonOperator | String | body (contained in the updateAlarm structure) | Optional. The threshold comparison operator. |
|
2.3 |
period | Integer | body (contained in the updateAlarm structure) | Optional. The threshold duration. | 2.3 | |
threshold | Double | body (contained in the updateAlarm structure) | Optional. The threshold. | 2.3 | |
repeatInterval | Integer | body (contained in the updateAlarm structure) | Optional. The alarm repeat interval. | 2.3 | |
repeatCount | Integer | body (contained in the updateAlarm structure) | Optional. The alarm repeat count. | 3.3.0 | |
systemTags | List | body | Optional. The system tags. | 2.3 | |
userTags | List | body | Optional. The user tags. | 2.3 | |
repeatCount | Integer | body (contained in the updateAlarm structure) | Optional. The alarm repeat count. | 3.2 | |
enableRecovery | Boolean | body (contained in the updateAlarm structure) | Optional. Whether to enable the recovery notification. | 3.4.0 | |
emergencyLevel | String | body (contained in the updateAlarm structure) | The alarm emergency level. |
|
3.8.0 |
API Response
Sample
Response
{
"inventory": {
"uuid": "33e642a1eb3c4f27a7da7acc5891de0a",
"name": "VM CPU Alarm",
"comparisonOperator": "LessThanOrEqualTo",
"period": 60.0,
"namespace": "ZStack/VM",
"metricName": "org.zstack.zwatch.datatype.Metric@22c0dd63",
"threshold": 30.0,
"repeatInterval": 1800.0,
"repeatCount": -1.0,
"status": "Alarm",
"state": "Enabled",
"createDate": "Jan 8, 2019 4:11:27 PM",
"lastOpDate": "Jan 8, 2019 4:11:27 PM",
"labels": [
{
"uuid": "c4da2db2fa454368a3a05016ae8c8070",
"key": "VMUuid",
"operator": "\u003d",
"value": "396d863211e446938ea01eb10bc9fd18"
}
],
"actions": [
{
"alarmUuid": "0d18a844bbf544bb914ab9287651f59f",
"actionType": "sns",
"actionUuid": "17b884822b284e6e9a0b67307a28955c"
}
]
}
}
Name | Type | Description | Starting Version |
---|---|---|---|
error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 2.3 |
inventory | AlarmInventory | See inventory. | 2.3 |
#error
Name | Type | Description | Starting Version |
---|---|---|---|
code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 2.3 |
description | String | The brief description of the error. | 2.3 |
details | String | The details about the error. | 2.3 |
elaboration | String | The reserved field. Default value: null. | 2.3 |
opaque | LinkedHashMap | The reserved field. Default value: null. | 2.3 |
cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 2.3 |
#inventory
Name | Type | Description | Starting Version |
---|---|---|---|
uuid | String | The resource UUID. | 2.3 |
name | String | Th resource name. | 2.3 |
description | String | The detailed description of the resource. | 2.3 |
period | Integer | The threshold duration. | 2.3 |
namespace | String | The namespace. | 2.3 |
metricName | String | The metric name. | 2.3 |
threshold | Double | The threshold. | 2.3 |
repeatInterval | Integer | The alarm repeat interval. | 2.3 |
enableRecovery | Boolean | Whether to enable the recovery notification. | 3.4.0 |
createDate | Timestamp | The creation date. | 2.3 |
lastOpDate | Timestamp | The last operation date. | 2.3 |
comparisonOperator | ComparisonOperator | See comparisonOperator. | 2.3 |
status | AlarmStatus | See status. | 2.3 |
labels | List | See labels. | 2.3 |
actions | List | See actions. | 2.3 |
#comparisonOperator
Name | Type | Description | Starting Version |
---|---|---|---|
name | String | The resource name. | 2.3 |
ordinal | int | 2.3 |
#status
Name | Type | Description | Starting Version |
---|---|---|---|
OK | AlarmStatus | The alarm is in normal status. | 2.3 |
Alarm | AlarmStatus | The alarm is triggered. | 2.3 |
InsufficientData | AlarmStatus | The data is insufficient. | 2.3 |
#labels
Name | Type | Description | Starting Version |
---|---|---|---|
uuid | String | The resource UUID. | 2.3 |
key | String | The label key. | 2.3 |
operator | String | The comparison operator. | 2.3 |
value | String | The label value. | 2.3 |
#actions
Name | Type | Description | Starting Version |
---|---|---|---|
alarmUuid | String | The alarm UUID. | 2.3 |
actionType | String | The action type. | 2.3 |
actionUuid | String | The action UUID. | 2.3 |
SDK Sample
Java
SDK
UpdateAlarmAction action = new UpdateAlarmAction();
action.uuid = "28397feb3d083fdc9346edb066fbf589";
action.name = "VM CPU Alarm";
action.comparisonOperator = "LessThanOrEqualTo";
action.period = 60.0;
action.enableRecovery = true;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAlarmAction.Result res = action.call();
Python
SDK
UpdateAlarmAction action = UpdateAlarmAction()
action.uuid = "28397feb3d083fdc9346edb066fbf589"
action.name = "VM CPU Alarm"
action.comparisonOperator = "LessThanOrEqualTo"
action.period = 60.0
action.enableRecovery = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateAlarmAction.Result res = action.call()