Alarm
CreateAlarm
API Request
URLs
POST zstack/v1/zwatch/alarmsHeaders
Authorization: OAuth the-session-uuidBody
Note: In the above example, the systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.
{
"params": {
"name": "VM CPU Alarm",
"comparisonOperator": "LessThanOrEqualTo",
"period": 60.0,
"namespace": "ZStack/VM",
"metricName": "org.zstack.zwatch.datatype.Metric@53fa9b19",
"threshold": 60.0,
"repeatInterval": 1800.0,
"enableRecovery": true,
"labels": [
{
"key": "VMUuid",
"value": "ca6b4ad7a0e446c6a8c4f52d93215f6e",
"op": "Equal"
}
],
"actions": [
{
"actionUuid": "19b7cfaf6134408897d95588b01308fe",
"actionType": "sns"
}
],
"repeatCount": -1.0,
"type": "Any"
"enableRecovery": true
},
"systemTags": [],
"userTags": []
}
Note: In the above example, the systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.Curl Example
curl -H "Content-Type: application/json" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"VM CPU Alarm","comparisonOperator":"LessThanOrEqualTo","period":60.0,"namespace":"ZStack/VM","metricName":"org.zstack.zwatch.datatype.Metric@53fa9b19","threshold":60.0,"repeatInterval":1800.0,"labels":[{"key":"VMUuid","value":"61f6b705fcb944df8138ea6b52b0b4a6","op":"Equal"}],"actions":[{"actionUuid":"699541db497e4d3e9c49020c2dad8d6c","actionType":"sns"}],"repeatCount":-1.0,"type":"Any","enableRecovery":true}}' http://localhost:8080/zstack/v1/zwatch/alarmsParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The resource name. | 2.3 | |
| description (Optional) | String | body (contained in the params structure) | The detailed description of the resource. | 2.3 | |
| comparisonOperator | String | body (contained in the params structure) | The threshold comparison operator. |
|
2.3 |
| period(Optional) | Integer | body (contained in the params structure) | The threshold duration. | 2.3 | |
| namespace | String | body (contained in the params structure) | The namespace. | 2.3 | |
| metricName | String | body (contained in the params structure) | The metric name. | 2.3 | |
| threshold | Double | body (contained in the params structure) | The threshold. | 2.3 | |
| repeatInterval (Optional) | Integer | body (contained in the params structure) | The alarm repeat interval. | 2.3 | |
| labels (Optional) | List | body (contained in the params structure) | The label list. | 2.3 | |
| actions (Optional) | List | body (contained in the params structure) | The alarm action list. | 2.3 | |
| resourceUuid (Optional) | String | body (contained in the params structure) | Optional. The resource UUID. | 2.3 | |
| repeatCount (Optional) | Integer | body (contained in the params structure) | The alarm repeat count. | 3.3.0 | |
| type (Optional) | String | body (contained in the params structure) | The alarm type. | 3.3.0 | |
| systemTags (Optional) | List | body | System tags. | 2.3 | |
| userTags (Optional) | List | body | User tags. | 2.3 | |
| enableRecovery | Boolean | body (contained in the params structure) | Whether to enable recovery notification. | 3.4.0 | |
| emergencyLevel (Optional) | String | body (contained in the params structure) | The alarm level. |
|
3.8.0 |
API Response
Response Example
{
"inventory": {
"uuid": "6ff094db7e8b4640880751c5a17e7b63",
"name": "VM CPU Alarm",
"comparisonOperator": "LessThanOrEqualTo",
"period": 60.0,
"namespace": "ZStack/VM",
"metricName": "org.zstack.zwatch.datatype.Metric@c2e79f0",
"threshold": 30.0,
"repeatInterval": 1800.0,
"repeatCount": -1.0,
"status": "Alarm",
"state": "Enabled",
"enableRecovery": true,
"createDate": "Jul 6, 2018 1:51:02 PM",
"lastOpDate": "Jul 6, 2018 1:51:02 PM",
"labels": [
{
"uuid": "cccd980c3bb84f4486d96a960eb08edb",
"key": "VMUuid",
"operator": "\u003d",
"value": "f486fd81583747459d8a6cd47f9228e5"
}
],
"actions": [
{
"alarmUuid": "8a6a98e3cc484388a746d725265886b3",
"actionType": "sns",
"actionUuid": "86a2b51fbc7f406c906711081852fa49"
}
]
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation failed. This field is null when the operation succeeds. See error for details. | 2.3 |
| inventory | AlarmInventory | See inventory for details. | 2.3 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code number. A globally unique identifier for the error, e.g., SYS.1000, HOST.1001. | 2.3 |
| description | String | A brief description of the error. | 2.3 |
| details | String | The detailed error information. | 2.3 |
| elaboration | String | A reserved field. Default is null. | 2.3 |
| opaque | LinkedHashMap | A reserved field. Default is null. | 2.3 |
| cause | ErrorCode | The root error. The source error that caused the current error. This field is null if there is no root cause. | 2.3 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 2.3 |
| name | String | The 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 recovery notification. | 3.4.0 |
| createDate | Timestamp | The creation time. | 2.3 |
| lastOpDate | Timestamp | The last modification time. | 2.3 |
| comparisonOperator | ComparisonOperator | See comparisonOperator for details. | 2.3 |
| status | AlarmStatus | See status for details. | 2.3 |
| labels | List | See labels for details. | 2.3 |
| actions | List | See actions for details. | 2.3 |
#comparisonOperator
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | The resource name. | 2.3 |
| ordinal | int | The ordinal number. | 2.3 |
#status
| Name | Type | Description | Starting Version |
|---|---|---|---|
| OK | AlarmStatus | Monitoring. | 2.3 |
| Alarm | AlarmStatus | Triggered. | 2.3 |
| InsufficientData | AlarmStatus | Insufficient data. | 2.3 |
#labels
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 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 alarm action type. | 2.3 |
| actionUuid | String | The alarm action UUID. | 2.3 |
SDK Examples
Java
SDK
CreateAlarmAction action = new CreateAlarmAction();
action.name = "VM CPU Alarm";
action.comparisonOperator = "LessThanOrEqualTo";
action.period = 60.0;
action.namespace = "ZStack/VM";
action.metricName = "org.zstack.zwatch.datatype.Metric@c2e79f0";
action.threshold = 60.0;
action.repeatInterval = 1800.0;
action.labels = asList([key:VMUuid, value:45821a26f579447fa77bfb82b1b0268e, op:Equal]);
action.actions = asList([actionUuid:8e06ec09862c46c3aaf9fc6337815ffb, actionType:sns]);
action.repeatCount = -1.0;
action.type = "Any";
action.enableRecovery = true;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateAlarmAction.Result res = action.call();Python
SDK
CreateAlarmAction action = CreateAlarmAction()
action.name = "VM CPU Alarm"
action.comparisonOperator = "LessThanOrEqualTo"
action.period = 60.0
action.namespace = "ZStack/VM"
action.metricName = "org.zstack.zwatch.datatype.Metric@c2e79f0"
action.threshold = 60.0
action.repeatInterval = 1800.0
action.labels = [[key:VMUuid, value:7dd44bfe750f42859528b27ef90f1412, op:Equal]]
action.actions = [[actionUuid:b1acb139666140d09f4f93b8dd96f49f, actionType:sns]]
action.repeatCount = -1.0
action.type = "Any"
action.enableRecovery = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateAlarmAction.Result res = action.call()DeleteAlarm
API Request
URLs
DELETE zstack/v1/zwatch/alarms/{uuid}Headers
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/zwatch/alarms/2aae360b1240374696d79a0cca10bf24Parameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the resource. Uniquely identifies the resource. | 2.3 | |
| deleteMode (Optional) | String | body | Optional. The delete mode. | 2.3 | |
| systemTags (Optional) | List | body | System tags. | 2.3 | |
| userTags (Optional) | List | body | User tags. | 2.3 |
API Response
On success, this API returns an empty JSON structure
{}. On failure, the returned JSON structure contains an error field. For example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Examples
Java
SDK
DeleteAlarmAction action = new DeleteAlarmAction();
action.uuid = "2aae360b1240374696d79a0cca10bf24";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteAlarmAction.Result res = action.call();Python
SDK
DeleteAlarmAction action = DeleteAlarmAction()
action.uuid = "2aae360b1240374696d79a0cca10bf24"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteAlarmAction.Result res = action.call()UpdateAlarm
API Request
URLs
PUT zstack/v1/zwatch/alarms/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: 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.
{
"updateAlarm": {
"name": "VM CPU Alarm",
"comparisonOperator": "LessThanOrEqualTo",
"period": 60.0,
"enableRecovery": true
},
"systemTags": [],
"userTags": []
}
Note: 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 '{"updateAlarm":{"name":"VM CPU Alarm","comparisonOperator":"LessThanOrEqualTo","period":60.0,"enableRecovery":true}}' http://localhost:8080/zstack/v1/zwatch/alarms/28397feb3d083fdc9346edb066fbf589/actionsParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the resource. Uniquely identifies the resource. | 2.3 | |
| name (Optional) | String | body (contained in the updateAlarm structure) | Resource name. | 2.3 | |
| description (Optional) | String | body (contained in the updateAlarm structure) | Detailed description of the resource. | 2.3 | |
| comparisonOperator (Optional) | String | body (contained in the updateAlarm structure) | Comparison operator. |
|
2.3 |
| period (Optional) | Integer | body (contained in the updateAlarm structure) | Threshold duration. | 2.3 | |
| threshold (Optional) | Double | body (contained in the updateAlarm structure) | Threshold. | 2.3 | |
| repeatInterval (Optional) | Integer | body (contained in the updateAlarm structure) | Alarm repeat interval. | 2.3 | |
| repeatCount (Optional) | Integer | body (contained in the updateAlarm structure) | Alarm repeat count. | 3.3.0 | |
| systemTags (Optional) | List | body | System tags. | 2.3 | |
| userTags (Optional) | List | body | User tags. | 2.3 | |
| repeatCount (Optional) | Integer | body (contained in the updateAlarm structure) | Alarm repeat count. | 3.2 | |
| enableRecovery (Optional) | Boolean | Enable recovery notification. | Optional. Whether recovery is enabled. | 3.4.0 | |
| emergencyLevel (Optional) | String | body (contained in the updateAlarm structure) | Alarm level. |
|
3.8.0 |
API Response
Response Example
{
"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 failed. This field is null on success. See error for details. | 2.3 |
| inventory | AlarmInventory | See inventory for details. | 2.3 |
#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. | 2.3 |
| description | String | A brief description of the error. | 2.3 |
| details | String | Detailed information about the error. | 2.3 |
| elaboration | String | A reserved field. Default is null. | 2.3 |
| opaque | LinkedHashMap | A reserved field. Default is null. | 2.3 |
| cause | ErrorCode | The root error. The source error that caused the current error. This field is null if there is no root error. | 2.3 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 2.3 |
| name | String | Resource name. | 2.3 |
| description | String | Detailed description of the resource. | 2.3 |
| period | Integer | Threshold duration. | 2.3 |
| namespace | String | Namespace. | 2.3 |
| metricName | String | Metric name. | 2.3 |
| threshold | Double | Threshold. | 2.3 |
| repeatInterval | Integer | Alarm repeat interval. | 2.3 |
| enableRecovery | Boolean | Enable recovery notification. | 3.4.0 |
| createDate | Timestamp | Creation time. | 2.3 |
| lastOpDate | Timestamp | Last modification time. | 2.3 |
| comparisonOperator | ComparisonOperator | See comparisonOperator for details. | 2.3 |
| status | AlarmStatus | See status for details. | 2.3 |
| labels | List | See labels for details. | 2.3 |
| actions | List | See actions for details. | 2.3 |
#comparisonOperator
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Resource name. | 2.3 |
| ordinal | int | The ordinal number. | 2.3 |
#status
| Name | Type | Description | Starting Version |
|---|---|---|---|
| OK | AlarmStatus | Monitoring. | 2.3 |
| Alarm | AlarmStatus | Triggered. | 2.3 |
| InsufficientData | AlarmStatus | Insufficient data. | 2.3 |
#labels
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 2.3 |
| key | String | Label key. | 2.3 |
| operator | String | Comparison operator. | 2.3 |
| value | String | Label value. | 2.3 |
#actions
| Name | Type | Description | Starting Version |
|---|---|---|---|
| alarmUuid | String | Alarm UUID. | 2.3 |
| actionType | String | Alarm action type. | 2.3 |
| actionUuid | String | Alarm action UUID. | 2.3 |
SDK Examples
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()UpdateSubscribeEvent
API Request
URLs
PUT zstack/v1/zwatch/events/subscriptions/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: 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.
{
"updateSubscribeEvent": {
"emergencyLevel": "Emergent"
},
"systemTags": [],
"userTags": []
}
Note: 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 '{"updateSubscribeEvent":{"emergencyLevel":"Emergent"}}' http://localhost:8080/zstack/v1/zwatch/events/subscriptions/37fc1fcc0fa93fb493702469039edbfb/actionsParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | Event alarm UUID. | 3.8.0 | |
| emergencyLevel (Optional) | String | body (contained in the updateSubscribeEvent structure) | Alarm level. |
|
3.8.0 |
| systemTags (Optional) | List | body | Optional. The system tags. | 3.8.0 | |
| userTags (Optional) | List | body | Optional. The user tags. | 3.8.0 |
API Response
Response Example:
{
"inventory": {
"uuid": "d1b38b37691948218df07900a2c1c065",
"name": "vm_state_change_event",
"namespace": "ZStack/VM",
"eventName": "org.zstack.zwatch.datatype.EventFamily@35324244",
"state": "Enabled",
"actions": [
{
"subscriptionUuid": "30d1075270c94f6e9312c1a4404cc67a",
"actionType": "sns",
"actionUuid": "33308113390a472286df32a99cd477ef"
}
],
"labels": [
{
"uuid": "26246baade39495c99d018d826ae576e",
"key": "DestinationHostUuid",
"operator": "Equal",
"value": "79e249b6995a4c819d8e6cd33798135a"
}
],
"lastOpDate": "Jan 11, 2020 11:48:35 PM",
"createDate": "Jan 11, 2020 11:48:35 PM",
"emergencyLevel": "Emergent"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation failed. This field is null on success. See error for details. | 3.8.0 |
| inventory | EventSubscriptionInventory | See inventory for details. | 3.8.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. | 3.8.0 |
| description | String | A brief description of the error. | 3.8.0 |
| details | String | Detailed information about the error. | 3.8.0 |
| elaboration | String | A reserved field. Default is null. | 3.8.0 |
| opaque | LinkedHashMap | A reserved field. Default is null. | 3.8.0 |
| cause | ErrorCode | The root error. The source error that caused the current error. This field is null if there is no root error. | 3.8.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 3.8.0 |
| name | String | Resource name. | 3.8.0 |
| namespace | String | Namespace. | 3.8.0 |
| eventName | String | Event name. | 3.8.0 |
| lastOpDate | Timestamp | Last modification time. | 3.8.0 |
| createDate | Timestamp | Creation time. | 3.8.0 |
| emergencyLevel | String | Alarm level. | 3.8.0 |
| state | EventSubscriptionState | See state for details. | 3.8.0 |
| actions | List | See actions for details. | 3.8.0 |
| labels | List | See labels for details. | 3.8.0 |
#state
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Resource name. | 3.8.0 |
| ordinal | int | The ordinal number. | 3.8.0 |
#actions
| Name | Type | Description | Starting Version |
|---|---|---|---|
| subscriptionUuid | String | Event subscription UUID. | 3.8.0 |
| actionType | String | Action type. | 3.8.0 |
| actionUuid | String | Action UUID. | 3.8.0 |
#labels
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 3.8.0 |
| key | String | Label name. | 3.8.0 |
| value | String | Label value. | 3.8.0 |
| operator | Operator | See operator for details. | 3.8.0 |
#operator
| Name | Type | Description | Starting Version |
|---|---|---|---|
| op | String | The op. | 3.8.0 |
| name | String | Resource name. | 3.8.0 |
| ordinal | int | The ordinal number. | 3.8.0 |
SDK Examples
Java
SDK
UpdateSubscribeEventAction action = new UpdateSubscribeEventAction();
action.uuid = "37fc1fcc0fa93fb493702469039edbfb";
action.emergencyLevel = "Emergent";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateSubscribeEventAction.Result res = action.call();Python
SDK
UpdateSubscribeEventAction action = UpdateSubscribeEventAction()
action.uuid = "37fc1fcc0fa93fb493702469039edbfb"
action.emergencyLevel = "Emergent"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateSubscribeEventAction.Result res = action.call()AddActionToAlarm
API Request
URLs
POST zstack/v1/zwatch/alarms/{alarmUuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: 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.
{
"params": {
"actionUuid": "a48c9fa0454238a4b731279b92d8bad1",
"actionType": "sns"
},
"systemTags": [],
"userTags": []
}
Note: 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 POST -d '{"params":{"actionUuid":"a48c9fa0454238a4b731279b92d8bad1","actionType":"sns"}}' http://localhost:8080/zstack/v1/zwatch/alarms/3edde2bd29493568a2640f75d218ed05/actionsParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| alarmUuid | String | url | Alarm UUID. | 2.3 | |
| actionUuid | String | body (contained in the params structure) | Alarm action UUID. | 2.3 | |
| actionType | String | body (contained in the params structure) | Alarm action type. | 2.3 | |
| systemTags (Optional) | List | body | System tags. | 2.3 | |
| userTags (Optional) | List | body | User tags. | 2.3 |
API Response
Response Example
{
"inventory": {
"uuid": "6b9ce7e8a6c04476aa22ce6c851a7f80",
"name": "VM CPU Alarm",
"comparisonOperator": "LessThanOrEqualTo",
"period": 60.0,
"namespace": "ZStack/VM",
"metricName": "org.zstack.zwatch.datatype.Metric@565e1ebe",
"threshold": 30.0,
"repeatInterval": 1800.0,
"status": "Alarm",
"state": "Enabled",
"createDate": "Jul 6, 2018 1:50:39 PM",
"lastOpDate": "Jul 6, 2018 1:50:39 PM",
"labels": [
{
"uuid": "f183fec66c3d40938621568943f4c0bf",
"key": "VMUuid",
"operator": "\u003d",
"value": "7d46ab7f0f104ad0908f23d648bcaa9e"
}
],
"actions": [
{
"alarmUuid": "7379b3951c9f4c82a0571cc55ebc98b3",
"actionType": "sns",
"actionUuid": "27e18067eb614fd4bcb047c008e3a4c0"
}
]
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation failed. This field is null on success. See error for details. | 2.3 |
| inventory | AlarmInventory | See inventory for details. | 2.3 |
#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. | 2.3 |
| description | String | A brief description of the error. | 2.3 |
| details | String | Detailed information about the error. | 2.3 |
| elaboration | String | A reserved field. Default is null. | 2.3 |
| opaque | LinkedHashMap | A reserved field. Default is null. | 2.3 |
| cause | ErrorCode | The root error. The source error that caused the current error. This field is null if there is no root error. | 2.3 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 2.3 |
| name | String | Resource name. | 2.3 |
| description | String | Detailed description of the resource. | 2.3 |
| period | Integer | Threshold duration. | 2.3 |
| namespace | String | Namespace. | 2.3 |
| metricName | String | Metric name. | 2.3 |
| threshold | Double | Threshold. | 2.3 |
| repeatInterval | Integer | Alarm repeat interval. | 2.3 |
| createDate | Timestamp | Creation time. | 2.3 |
| lastOpDate | Timestamp | Last modification time. | 2.3 |
| comparisonOperator | ComparisonOperator | See comparisonOperator for details. | 2.3 |
| status | AlarmStatus | See status for details. | 2.3 |
| labels | List | See labels for details. | 2.3 |
| actions | List | See actions for details. | 2.3 |
#comparisonOperator
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Resource name. | 2.3 |
| ordinal | int | The ordinal number. | 2.3 |
#status
| Name | Type | Description | Starting Version |
|---|---|---|---|
| OK | AlarmStatus | Monitoring. | 2.3 |
| Alarm | AlarmStatus | Triggered. | 2.3 |
| InsufficientData | AlarmStatus | Insufficient data. | 2.3 |
#labels
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 2.3 |
| key | String | Label key. | 2.3 |
| operator | String | Comparison operator. | 2.3 |
| value | String | Label value. | 2.3 |
#actions
| Name | Type | Description | Starting Version |
|---|---|---|---|
| alarmUuid | String | Alarm UUID. | 2.3 |
| actionType | String | Alarm action type. | 2.3 |
| actionUuid | String | Alarm action UUID. | 2.3 |
SDK Examples
Java
SDK
AddActionToAlarmAction action = new AddActionToAlarmAction();
action.alarmUuid = "3edde2bd29493568a2640f75d218ed05";
action.actionUuid = "a48c9fa0454238a4b731279b92d8bad1";
action.actionType = "sns";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddActionToAlarmAction.Result res = action.call();Python
SDK
AddActionToAlarmAction action = AddActionToAlarmAction()
action.alarmUuid = "3edde2bd29493568a2640f75d218ed05"
action.actionUuid = "a48c9fa0454238a4b731279b92d8bad1"
action.actionType = "sns"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddActionToAlarmAction.Result res = action.call()RemoveActionFromAlarm
API Request
URLs
DELETE zstack/v1/zwatch/alarms/{alarmUuid}/actions/{actionUuid}Headers
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/zwatch/alarms/2c95bdf5490131bbb421622579b59eb8/actions/41c582ab1cea31d5addd02bb00bb173dParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| alarmUuid | String | url | Alarm UUID. | 2.3 | |
| actionUuid | String | url | Alarm action UUID. | 2.3 | |
| deleteMode (Optional) | String | body | Optional. The delete mode. | 2.3 | |
| systemTags (Optional) | List | body | System tags. | 2.3 | |
| userTags (Optional) | List | body | User tags. | 2.3 |
API Response
Response Example
{
"inventory": {
"uuid": "3f753a2f9dd44becb0435b2a517fd5d4",
"name": "VM CPU Alarm",
"comparisonOperator": "LessThanOrEqualTo",
"period": 60.0,
"namespace": "ZStack/VM",
"metricName": "org.zstack.zwatch.datatype.Metric@565e1ebe",
"threshold": 30.0,
"repeatInterval": 1800.0,
"status": "Alarm",
"state": "Enabled",
"createDate": "Jul 6, 2018 1:50:59 PM",
"lastOpDate": "Jul 6, 2018 1:50:59 PM",
"labels": [
{
"uuid": "cf7ff04d570f4f509e6b22851ceb231d",
"key": "VMUuid",
"operator": "\u003d",
"value": "cda155f903f1417f951578ea74623f5e"
}
],
"actions": [
{
"alarmUuid": "5d2a502edc8d4c34b90ae499c7fdb437",
"actionType": "sns",
"actionUuid": "4b7903efe370462aab75bb5890971e6d"
}
]
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation failed. This field is null on success. See error for details. | 2.3 |
| inventory | AlarmInventory | See inventory for details. | 2.3 |
#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. | 2.3 |
| description | String | A brief description of the error. | 2.3 |
| details | String | Detailed information about the error. | 2.3 |
| elaboration | String | A reserved field. Default is null. | 2.3 |
| opaque | LinkedHashMap | A reserved field. Default is null. | 2.3 |
| cause | ErrorCode | The root error. The source error that caused the current error. This field is null if there is no root error. | 2.3 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 2.3 |
| name | String | Resource name. | 2.3 |
| description | String | Detailed description of the resource. | 2.3 |
| period | Integer | Threshold duration. | 2.3 |
| namespace | String | Namespace. | 2.3 |
| metricName | String | Metric name. | 2.3 |
| threshold | Double | Threshold. | 2.3 |
| repeatInterval | Integer | Alarm repeat interval. | 2.3 |
| createDate | Timestamp | Creation time. | 2.3 |
| lastOpDate | Timestamp | Last modification time. | 2.3 |
| comparisonOperator | ComparisonOperator | See comparisonOperator for details. | 2.3 |
| status | AlarmStatus | See status for details. | 2.3 |
| labels | List | See labels for details. | 2.3 |
| actions | List | See actions for details. | 2.3 |
#comparisonOperator
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Resource name. | 2.3 |
| ordinal | int | The ordinal number. | 2.3 |
#status
| Name | Type | Description | Starting Version |
|---|---|---|---|
| OK | AlarmStatus | Monitoring. | 2.3 |
| Alarm | AlarmStatus | Triggered. | 2.3 |
| InsufficientData | AlarmStatus | Insufficient data. | 2.3 |
#labels
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 2.3 |
| key | String | Label key. | 2.3 |
| operator | String | Comparison operator. | 2.3 |
| value | String | Label value. | 2.3 |
#actions
| Name | Type | Description | Starting Version |
|---|---|---|---|
| alarmUuid | String | Alarm UUID. | 2.3 |
| actionType | String | Alarm action type. | 2.3 |
| actionUuid | String | Alarm action UUID. | 2.3 |
SDK Examples
Java
SDK
RemoveActionFromAlarmAction action = new RemoveActionFromAlarmAction();
action.alarmUuid = "2c95bdf5490131bbb421622579b59eb8";
action.actionUuid = "41c582ab1cea31d5addd02bb00bb173d";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveActionFromAlarmAction.Result res = action.call();Python
SDK
RemoveActionFromAlarmAction action = RemoveActionFromAlarmAction()
action.alarmUuid = "2c95bdf5490131bbb421622579b59eb8"
action.actionUuid = "41c582ab1cea31d5addd02bb00bb173d"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveActionFromAlarmAction.Result res = action.call()AddLabelToAlarm
API Request
URLs
POST zstack/v1/zwatch/alarms/{alarmUuid}/labelsHeaders
Authorization: OAuth the-session-uuidBody
Note: 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.
{
"params": {
"key": "VMUuid",
"value": "2840f151485641cca48b190ebb989cbf",
"operator": "Equal"
},
"systemTags": [],
"userTags": []
}
Note: 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 POST -d '{"params":{"key":"VMUuid","value":"165af818089b4e9f8c07691de549f8d4","operator":"Equal"}}' http://localhost:8080/zstack/v1/zwatch/alarms/00b90ca9d59d3f539530fbcc8572c403/labelsParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| alarmUuid | String | url | Alarm UUID. | 2.3 | |
| key | String | body (contained in the params structure) | Label key. | 2.3 | |
| value | String | body (contained in the params structure) | Label value. | 2.3 | |
| operator | String | body (contained in the params structure) | Operator. |
|
2.3 |
| resourceUuid (Optional) | String | body (contained in the params structure) | Optional. The resource UUID. | 2.3 | |
| systemTags (Optional) | List | body | System tags. | 2.3 | |
| userTags (Optional) | List | body | User tags. | 2.3 |
API Response
Response Example
{
"inventory": {
"uuid": "3f54b760c8d64e17bc282258335b718a",
"key": "VMUuid",
"operator": "\u003d",
"value": "dd5b28c103594573b7bb21a02cb000c4"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation failed. This field is null on success. See error for details. | 2.3 |
| inventory | AlarmInventory | See inventory for details. | 2.3 |
#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. | 2.3 |
| description | String | A brief description of the error. | 2.3 |
| details | String | Detailed information about the error. | 2.3 |
| elaboration | String | A reserved field. Default is null. | 2.3 |
| opaque | LinkedHashMap | A reserved field. Default is null. | 2.3 |
| cause | ErrorCode | The root error. The source error that caused the current error. This field is null if there is no root error. | 2.3 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 2.3 |
| name | String | Resource name. | 2.3 |
| description | String | Detailed description of the resource. | 2.3 |
| period | Integer | Threshold duration. | 2.3 |
| namespace | String | Namespace. | 2.3 |
| metricName | String | Metric name. | 2.3 |
| threshold | Double | Threshold. | 2.3 |
| repeatInterval | Integer | Alarm repeat interval. | 2.3 |
| createDate | Timestamp | Creation time. | 2.3 |
| lastOpDate | Timestamp | Last modification time. | 2.3 |
| comparisonOperator | ComparisonOperator | See comparisonOperator for details. | 2.3 |
| status | AlarmStatus | See status for details. | 2.3 |
| labels | List | See labels for details. | 2.3 |
| actions | List | See actions for details. | 2.3 |
#comparisonOperator
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Resource name. | 2.3 |
| ordinal | int | The ordinal number. | 2.3 |
#status
| Name | Type | Description | Starting Version |
|---|---|---|---|
| OK | AlarmStatus | Monitoring. | 2.3 |
| Alarm | AlarmStatus | Triggered. | 2.3 |
| InsufficientData | AlarmStatus | Insufficient data. | 2.3 |
#labels
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 2.3 |
| key | String | Label key. | 2.3 |
| operator | String | Comparison operator. | 2.3 |
| value | String | Label value. | 2.3 |
#actions
| Name | Type | Description | Starting Version |
|---|---|---|---|
| alarmUuid | String | Alarm UUID. | 2.3 |
| actionType | String | Alarm action type. | 2.3 |
| actionUuid | String | Alarm action UUID. | 2.3 |
SDK Examples
Java
SDK
AddLabelToAlarmAction action = new AddLabelToAlarmAction();
action.alarmUuid = "00b90ca9d59d3f539530fbcc8572c403";
action.key = "VMUuid";
action.value = "bfaa02ec5c37490d829ae95bebf15b78";
action.operator = "Equal";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddLabelToAlarmAction.Result res = action.call();Python
SDK
AddLabelToAlarmAction action = AddLabelToAlarmAction()
action.alarmUuid = "00b90ca9d59d3f539530fbcc8572c403"
action.key = "VMUuid"
action.value = "b4eb5d369bfb45719fbe862484011563"
action.operator = "Equal"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddLabelToAlarmAction.Result res = action.call()UpdateAlarmLabel
API Request
URLs
PUT zstack/v1/zwatch/alarms/labels/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: 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.
{
"updateAlarmLabel": {
"key": "VMUuid",
"value": "e9859e9eb51e4ea583a7c529407208a2",
"operator": "Equal"
},
"systemTags": [],
"userTags": []
}
Note: 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 '{"updateAlarmLabel":{"key":"VMUuid","value":"59ab62f070784eb2b0d98f0d12386f0d","operator":"Equal"}}' http://localhost:8080/zstack/v1/zwatch/alarms/labels/3c228226ca213c18b54627668dd37d80/actionsParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the resource. Uniquely identifies the resource. | 3.3 | |
| key | String | body (contained in the updateAlarmLabel structure) | Label key. | 3.3 | |
| value | String | body (contained in the updateAlarmLabel structure) | Label value. | 3.3 | |
| operator | String | body (contained in the updateAlarmLabel structure) | Label operator. |
|
3.3 |
| systemTags (Optional) | List | body | System tags. | 3.3 | |
| userTags (Optional) | List | body | User tags. | 3.3 |
API Response
Response Example
{
"inventory": {
"uuid": "5ea6d350f0e64d0b9467d033e9c6d052",
"key": "VMUuid",
"operator": "\u003d",
"value": "35956236f261467cb2cef1db8626024e"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation failed. This field is null on success. See error for details. | 3.3.0 |
| inventory | AlarmLabelInventory | See inventory for details. | 3.3.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. | 3.3.0 |
| description | String | A brief description of the error. | 3.3.0 |
| details | String | Detailed information about the error. | 3.3.0 |
| elaboration | String | A reserved field. Default is null. | 3.3.0 |
| opaque | LinkedHashMap | A reserved field. Default is null. | 3.3.0 |
| cause | ErrorCode | The root error. The source error that caused the current error. This field is null if there is no root error. | 3.3.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 3.3.0 |
| key | String | The key. | 3.3.0 |
| operator | String | The operator. | 3.3.0 |
| value | String | The field value. | 3.3.0 |
SDK Examples
Java
SDK
UpdateAlarmLabelAction action = new UpdateAlarmLabelAction();
action.uuid = "3c228226ca213c18b54627668dd37d80";
action.key = "VMUuid";
action.value = "1a33d5ce225241e0b2cbc80123e36351";
action.operator = "Equal";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAlarmLabelAction.Result res = action.call();Python
SDK
UpdateAlarmLabelAction action = UpdateAlarmLabelAction()
action.uuid = "3c228226ca213c18b54627668dd37d80"
action.key = "VMUuid"
action.value = "20034c6b21a24918912857c8ed923c6b"
action.operator = "Equal"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateAlarmLabelAction.Result res = action.call()RemoveLabelFromAlarm
API Request
URLs
DELETE zstack/v1/zwatch/alarms/labels/{uuid}Headers
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/zwatch/alarms/labels/160037fc792d3815ba25fe8a48d1b237Parameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the resource. Uniquely identifies the resource. | 2.3 | |
| deleteMode (Optional) | String | body | Optional. The delete mode. | 2.3 | |
| systemTags (Optional) | List | body | System tags. | 2.3 | |
| userTags (Optional) | List | body | User tags. | 2.3 |
API Response
On success, this API returns an empty JSON structure
{}. On failure, the returned JSON structure contains an error field. For example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Examples
Java
SDK
RemoveLabelFromAlarmAction action = new RemoveLabelFromAlarmAction();
action.uuid = "160037fc792d3815ba25fe8a48d1b237";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveLabelFromAlarmAction.Result res = action.call();Python
SDK
RemoveLabelFromAlarmAction action = RemoveLabelFromAlarmAction()
action.uuid = "160037fc792d3815ba25fe8a48d1b237"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RemoveLabelFromAlarmAction.Result res = action.call()ChangeAlarmState
API Request
URLs
PUT zstack/v1/zwatch/alarms/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: 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.
{
"changeAlarmState": {
"stateEvent": "disable"
},
"systemTags": [],
"userTags": []
}
Note: 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 '{"changeAlarmState":{"stateEvent":"disable"}}' http://localhost:8080/zstack/v1/zwatch/alarms/226149ca389f387e95d0f671bd6b551f/actionsParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the resource. Uniquely identifies the resource. | 2.3 | |
| stateEvent | String | body (contained in the changeAlarmState structure) | State event. |
|
2.3 |
| systemTags (Optional) | List | body | System tags. | 2.3 | |
| userTags (Optional) | List | body | User tags. | 2.3 |
API Response
Response Example
{
"inventory": {
"uuid": "3b57de3128b545a18bb7da2f086f6362",
"name": "VM CPU Alarm",
"comparisonOperator": "LessThanOrEqualTo",
"period": 60.0,
"namespace": "ZStack/VM",
"metricName": "org.zstack.zwatch.datatype.Metric@565e1ebe",
"threshold": 30.0,
"repeatInterval": 1800.0,
"status": "Alarm",
"state": "Enabled",
"createDate": "Jul 6, 2018 1:50:57 PM",
"lastOpDate": "Jul 6, 2018 1:50:57 PM",
"labels": [
{
"uuid": "61f43f3a05f74ef39b5b2c30354a5246",
"key": "VMUuid",
"operator": "\u003d",
"value": "23958e475ae34735a4ca0b808df0cf50"
}
],
"actions": [
{
"alarmUuid": "f01eb4d0ec1d4cdc81dc478c87f9fceb",
"actionType": "sns",
"actionUuid": "c9d79c14e37a4ebb83cf0d76fb7b8dbc"
}
]
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation failed. This field is null on success. See error for details. | 2.3 |
| inventory | AlarmInventory | See inventory for details. | 2.3 |
#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. | 2.3 |
| description | String | A brief description of the error. | 2.3 |
| details | String | Detailed information about the error. | 2.3 |
| elaboration | String | A reserved field. Default is null. | 2.3 |
| opaque | LinkedHashMap | A reserved field. Default is null. | 2.3 |
| cause | ErrorCode | The root error. The source error that caused the current error. This field is null if there is no root error. | 2.3 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 2.3 |
| name | String | Resource name. | 2.3 |
| description | String | Detailed description of the resource. | 2.3 |
| period | Integer | Threshold duration. | 2.3 |
| namespace | String | Namespace. | 2.3 |
| metricName | String | Metric name. | 2.3 |
| threshold | Double | Threshold. | 2.3 |
| repeatInterval | Integer | Alarm repeat interval. | 2.3 |
| createDate | Timestamp | Creation time. | 2.3 |
| lastOpDate | Timestamp | Last modification time. | 2.3 |
| comparisonOperator | ComparisonOperator | See comparisonOperator for details. | 2.3 |
| status | AlarmStatus | See status for details. | 2.3 |
| labels | List | See labels for details. | 2.3 |
| actions | List | See actions for details. | 2.3 |
#comparisonOperator
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Resource name. | 2.3 |
| ordinal | int | The ordinal number. | 2.3 |
#status
| Name | Type | Description | Starting Version |
|---|---|---|---|
| OK | AlarmStatus | Monitoring. | 2.3 |
| Alarm | AlarmStatus | Triggered. | 2.3 |
| InsufficientData | AlarmStatus | Insufficient data. | 2.3 |
#labels
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 2.3 |
| key | String | Label key. | 2.3 |
| operator | String | Comparison operator. | 2.3 |
| value | String | Label value. | 2.3 |
#actions
| Name | Type | Description | Starting Version |
|---|---|---|---|
| alarmUuid | String | Alarm UUID. | 2.3 |
| actionType | String | Alarm action type. | 2.3 |
| actionUuid | String | Alarm action UUID. | 2.3 |
SDK Examples
Java
SDK
ChangeAlarmStateAction action = new ChangeAlarmStateAction();
action.uuid = "226149ca389f387e95d0f671bd6b551f";
action.stateEvent = "disable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeAlarmStateAction.Result res = action.call();Python
SDK
ChangeAlarmStateAction action = ChangeAlarmStateAction()
action.uuid = "226149ca389f387e95d0f671bd6b551f"
action.stateEvent = "disable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeAlarmStateAction.Result res = action.call()QueryAlarm
API Request
URLs
GET zstack/v1/zwatch/alarms
GET zstack/v1/zwatch/alarms/{uuid}Headers
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/zwatch/alarms?q=name=VMcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/zwatch/alarms/572c61c4a1393b6ebce520a0102dc46cQueryable Fields
Run the CLI command-line tool, enter QueryAlarm and press Tab to view all queryable fields and cross-table queryable resource names.
API Response
Response Example
{
"inventories": [
{
"uuid": "5c9ef4b25c2a485da77eab50745d53cf",
"name": "VM CPU Alarm",
"comparisonOperator": "LessThanOrEqualTo",
"period": 60.0,
"namespace": "ZStack/VM",
"metricName": "org.zstack.zwatch.datatype.Metric@565e1ebe",
"threshold": 30.0,
"repeatInterval": 1800.0,
"status": "Alarm",
"state": "Enabled",
"createDate": "Jul 6, 2018 1:50:51 PM",
"lastOpDate": "Jul 6, 2018 1:50:51 PM",
"labels": [
{
"uuid": "5ab29656f8df43a3a78d672af8940896",
"key": "VMUuid",
"operator": "\u003d",
"value": "b128326b8b944c0499992c00cabd4711"
}
],
"actions": [
{
"alarmUuid": "2028f51e88b6449fb33442215810845f",
"actionType": "sns",
"actionUuid": "9486671b2f4c4413976f1d6938ac1d01"
}
]
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation failed. This field is null on success. See error for details. | 2.3 |
| inventories | List | See inventories for details. | 2.3 |
#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. | 2.3 |
| description | String | A brief description of the error. | 2.3 |
| details | String | Detailed information about the error. | 2.3 |
| elaboration | String | A reserved field. Default is null. | 2.3 |
| opaque | LinkedHashMap | A reserved field. Default is null. | 2.3 |
| cause | ErrorCode | The root error. The source error that caused the current error. This field is null if there is no root error. | 2.3 |
#inventories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 2.3 |
| name | String | Resource name. | 2.3 |
| description | String | Detailed description of the resource. | 2.3 |
| period | Integer | Threshold duration. | 2.3 |
| namespace | String | Namespace. | 2.3 |
| metricName | String | Metric name. | 2.3 |
| threshold | Double | Threshold. | 2.3 |
| repeatInterval | Integer | Alarm repeat interval. | 2.3 |
| createDate | Timestamp | Creation time. | 2.3 |
| lastOpDate | Timestamp | Last modification time. | 2.3 |
| comparisonOperator | ComparisonOperator | See comparisonOperator for details. | 2.3 |
| status | AlarmStatus | See status for details. | 2.3 |
| labels | List | See labels for details. | 2.3 |
| actions | List | See actions for details. | 2.3 |
#comparisonOperator
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Resource name. | 2.3 |
| ordinal | int | The ordinal number. | 2.3 |
#status
| Name | Type | Description | Starting Version |
|---|---|---|---|
| OK | AlarmStatus | Monitoring. | 2.3 |
| Alarm | AlarmStatus | Triggered. | 2.3 |
| InsufficientData | AlarmStatus | Insufficient data. | 2.3 |
#labels
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The UUID of the resource. Uniquely identifies the resource. | 2.3 |
| key | String | Label key. | 2.3 |
| operator | String | Comparison operator. | 2.3 |
| value | String | Label value. | 2.3 |
#actions
| Name | Type | Description | Starting Version |
|---|---|---|---|
| alarmUuid | String | Alarm UUID. | 2.3 |
| actionType | String | Alarm action type. | 2.3 |
| actionUuid | String | Alarm action UUID. | 2.3 |
SDK Examples
Java
SDK
QueryAlarmAction action = new QueryAlarmAction();
action.conditions = asList("name=VM");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAlarmAction.Result res = action.call();Python
SDK
QueryAlarmAction action = QueryAlarmAction()
action.conditions = ["name=VM"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAlarmAction.Result res = action.call()GetAlarmData
API Request
URLs
GET zstack/v1/zwatch/alarm-historiesHeaders
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/zwatch/alarm-histories?startTime=1.596444525E9&endTime=1.596530925E9&limit=200.0&count=false&excludeOtherAccount=false&start=0.0Parameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| startTime (Optional) | Long | query | Start time. | 2.3 | |
| endTime (Optional) | Long | query | End time. | 2.3 | |
| limit (Optional) | Integer | query | Maximum number of records to return. | 2.3 | |
| conditions (Optional) | List | query | Condition list for filtering results. | 2.3 | |
| count (Optional) | boolean | query | Whether to query message count. | 3.3.0 | |
| excludeOtherAccount (Optional) | boolean | query | Whether to exclude messages from other accounts (only effective for SystemAdmin). | 3.3.0 | |
| endpointUuid (Optional) | String | query | Endpoint UUID. | 3.10.0 | |
| systemTags (Optional) | List | query | System tags. | 2.3 | |
| userTags (Optional) | List | query | User tags. | 2.3 |
API Response
Response Example
{
"histories": [
{
"alarmUuid": "143b24a12d193c1992c4774dc3b34fda",
"namespace": "ZStack/VM",
"metricName": "CPUUsedUtilization",
"accountUuid": "90aea7a1dfe93cf7bd3379254dddbdf9",
"resourceUuid": "4e6bb5390d3938cb9ce830a4766ee4d8",
"resourceType": "VmInstanceVO",
"alarmStatus": "Alarm",
"alarmName": "test-alarm",
"threshold": 90.0,
"labels": "VMUuid Equal 4e6bb5390d3938cb9ce830a4766ee4d8, CPUNum Equal 2",
"metricValue": 10.0,
"comparisonOperator": "LessThan",
"time": 1.510669257141E12
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation failed. This field is null on success. See error for details. | 2.3 |
| histories | List | See histories for details. | 2.3 |
#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. | 2.3 |
| description | String | A brief description of the error. | 2.3 |
| details | String | Detailed information about the error. | 2.3 |
| elaboration | String | A reserved field. Default is null. | 2.3 |
| opaque | LinkedHashMap | A reserved field. Default is null. | 2.3 |
| cause | ErrorCode | The root error. The source error that caused the current error. This field is null if there is no root error. | 2.3 |
#histories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| alarmUuid | String | Alarm UUID. | 2.3 |
| namespace | String | Namespace. | 2.3 |
| metricName | String | Metric name. | 2.3 |
| accountUuid | String | Account UUID. | 2.3 |
| resourceUuid | String | Resource UUID. | 2.3 |
| resourceType | String | Resource type. | 2.3 |
| alarmStatus | String | Alarm status. | 2.3 |
| alarmName | String | Alarm name. | 2.3 |
| threshold | Double | Alarm threshold. | 2.3 |
| period | Integer | Threshold duration. | 2.3 |
| labels | String | Tag list. | 2.3 |
| metricValue | Double | Metric value at the time. | 2.3 |
| time | long | Alarm record generation time. | 2.3 |
SDK Examples
Java
SDK
GetAlarmDataAction action = new GetAlarmDataAction();
action.startTime = 1.530856218E9;
action.endTime = 1.530942618E9;
action.limit = 200.0;
action.count = false;
action.excludeOtherAccount = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetAlarmDataAction.Result res = action.call();Python
SDK
GetAlarmDataAction action = GetAlarmDataAction()
action.startTime = 1.530856218E9
action.endTime = 1.530942618E9
action.limit = 200.0
action.count = false;
action.excludeOtherAccount = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetAlarmDataAction.Result res = action.call()UpdateAlarmData
API Request
URLs
PUT zstack/v1/zwatch/alarm-histories/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: 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.
{
"updateAlarmData": {
"dataUuid": "514d4a1ed3573bf8a14ac350de0a2513",
"updateMode": "OnlyOne",
"readStatus": "Read"
},
"systemTags": [],
"userTags": []
}
Note: 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 '{"updateAlarmData":{"dataUuid":"514d4a1ed3573bf8a14ac350de0a2513","updateMode":"OnlyOne","readStatus":"Read"}}' http://localhost:8080/zstack/v1/zwatch/alarm-histories/actionsParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| dataUuid (Optional) | String | body (contained in the updateAlarmData structure) | The UUID of the resource. Uniquely identifies the resource. | 3.3.0 | |
| dataStartTime (Optional) | Long | body (contained in the updateAlarmData structure) | Start time for selecting target messages. The updateMode must be set to InRange. | 3.3.0 | |
| dataEndTime (Optional) | Long | body (contained in the updateAlarmData structure) | End time for selecting target messages. The updateMode must be set to InRange. | 3.3.0 | |
| updateMode | String | body (contained in the updateAlarmData structure) | The scope of target messages to update. OnlyOne updates only the specified message, InRange updates messages within a time range, and All updates all messages. |
|
3.3.0 |
| readStatus (Optional) | String | body (contained in the updateAlarmData structure) | Update message read status. |
|
3.3.0 |
| systemTags (Optional) | List | body | System tags. | 3.3.0 | |
| userTags (Optional) | List | body | User tags. | 3.3.0 |
API Response
On success, this API returns an empty JSON structure
{}. On failure, the returned JSON structure contains an error field. For example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Examples
Java
SDK
UpdateAlarmDataAction action = new UpdateAlarmDataAction();
action.dataUuid = "514d4a1ed3573bf8a14ac350de0a2513";
action.updateMode = "OnlyOne";
action.readStatus = "Read";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateAlarmDataAction.Result res = action.call();Python
SDK
UpdateAlarmDataAction action = UpdateAlarmDataAction()
action.dataUuid = "514d4a1ed3573bf8a14ac350de0a2513"
action.updateMode = "OnlyOne"
action.readStatus = "Read"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateAlarmDataAction.Result res = action.call()GetZWatchAlertHistogram
API Request
URLs
GET zstack/v1/zwatch/alert-histories/histogramHeaders
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/zwatch/alert-histories/histogram?startTime=1.623414899E9&endTime=1.623501299E9&intervalHours=8.0&groupColumns=emergencyLevelParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| tableName | String | query | Message type. | 4.1.0 | |
| startTime | Long | query | Start time. | 4.1.0 | |
| endTime | Long | query | End time. | 4.1.0 | |
| intervalHours | String | query | Interval hours. | 4.1.0 | |
| groupColumns (Optional) | List | query | Group columns. | 4.1.0 | |
| systemTags (Optional) | List | query | System tags. | 4.1.0 | |
| userTags (Optional) | List | query | User tags. | 4.1.0 |
API Response
Response Example
{
"histograms": [
{
"time": 1.510669257141E12,
"count": 50.0,
"tags": [
{
"name": "emergencyLevel",
"value": "Emergent"
}
]
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeded. | 4.1.0 |
| error | ErrorCode | The error code. If not null, the operation failed. This field is null on success. See error for details. | 4.1.0 |
| histograms | List | The histograms. | 4.1.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.1.0 |
| description | String | A brief description of the error. | 4.1.0 |
| details | String | Detailed information about the error. | 4.1.0 |
| elaboration | String | A reserved field. Default is null. | 4.1.0 |
| opaque | LinkedHashMap | A reserved field. Default is null. | 4.1.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.1.0 |
#histories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| time | long | Time. | 4.1.0 |
| count | long | Count. | 4.1.0 |
| tags | List | See tags for details. | 4.1.0 |
#tags
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Tag name. | 4.1.0 |
| value | String | Tag value. | 4.1.0 |
SDK Examples
Java
SDK
GetZWatchAlertHistogramAction action = new GetZWatchAlertHistogramAction();
action.startTime = 1.623414899E9;
action.endTime = 1.623501299E9;
action.intervalHours = 8.0;
action.groupColumns = asList("emergencyLevel");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetZWatchAlertHistogramAction.Result res = action.call();Python
SDK
GetZWatchAlertHistogramAction action = GetZWatchAlertHistogramAction()
action.startTime = 1.623414899E9
action.endTime = 1.623501299E9
action.intervalHours = 8.0
action.groupColumns = [emergencyLevel]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetZWatchAlertHistogramAction.Result res = action.call()QueryAlarmRecord
API Request
URLs
GET zstack/v1/zwatch/alarm-recordsHeaders
Authorization: OAuth the-session-uuidCurl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/zwatch/alarm-records?q=dataUuid=f30e0a92898a3cf39b98c7b20d5d09d7Queryable Fields
Run the CLI command-line tool, enter QueryAlarmRecord and press Tab to view all queryable fields and cross-table queryable resource names.
API Response
Response Example
{
"inventories": [
{
"id": 1.0,
"createTime": 1.510669257141E12,
"accountUuid": "ce8e0ae7bfb93fb09c3339443fb79b5a",
"alarmName": "ZStack Primary Storage Physical Available Capacity Alarm",
"alarmStatus": "Alarm",
"alarmUuid": "701f9528318737bb9db81c4f9b5721a7",
"comparisonOperator": "LessThan",
"context": "{\"PrimaryStorageType\":\"LocalStorage\"}",
"dataUuid": "2e6afdb668443ef9a9a82fcba794d21b",
"emergencyLevel": "Emergent",
"metricName": "AvailablePhysicalCapacityInPercent",
"metricValue": 20.0,
"namespace": "ZStack/PrimaryStorage",
"period": 600.0,
"readStatus": false,
"resourceUuid": "8a596bd1689c3e83a408c2713d99fc6e",
"threshold": 21.0
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation failed. This field is null on success. See error for details. | 4.1.0 |
| histograms | List | The histograms. | 4.1.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.1.0 |
| description | String | A brief description of the error. | 4.1.0 |
| details | String | Detailed information about the error. | 4.1.0 |
| elaboration | String | A reserved field. Default is null. | 4.1.0 |
| opaque | LinkedHashMap | A reserved field. Default is null. | 4.1.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.1.0 |
#inventories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | long | Message ID. | 4.1.0 |
| createTime | long | Creation time. | 4.1.0 |
| accountUuid | String | Account UUID. | 4.1.0 |
| alarmName | String | Alarm name. | 4.1.0 |
| alarmStatus | String | Alarm status. | 4.1.0 |
| alarmUuid | String | Alarm UUID. | 4.1.0 |
| comparisonOperator | String | Comparison operator. | 4.1.0 |
| context | String | Content. | 4.1.0 |
| dataUuid | String | Message UUID. | 4.1.0 |
| emergencyLevel | String | Alarm level. | 4.1.0 |
| labels | String | Tag list. | 4.1.0 |
| metricName | String | Metric name. | 4.1.0 |
| metricValue | Double | Metric value. | 4.1.0 |
| namespace | String | Namespace. | 4.1.0 |
| period | int | Threshold duration. | 4.1.0 |
| readStatus | Boolean | Read status. | 4.1.0 |
| resourceUuid | String | Resource UUID. | 4.1.0 |
| threshold | Double | Threshold. | 4.1.0 |
SDK Examples
Java
SDK
QueryAlarmRecordAction action = new QueryAlarmRecordAction();
action.conditions = asList("dataUuid=8860f33a964e3141aee2c3ffde2918b7");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAlarmRecordAction.Result res = action.call();Python
SDK
QueryAlarmRecordAction action = QueryAlarmRecordAction()
action.conditions = ["dataUuid=a83224ddc145340b9b7b12170ba614ba"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAlarmRecordAction.Result res = action.call()UpdateActiveAlarmTemplate
API Request
URLs
PUT zstack/v1/zwatch/activealarms/templates/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: 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.
{
"updateActiveAlarmTemplate": {
"alarmName": "VM-CPUAverageUsedUtilization",
"comparisonOperator": "LessThanOrEqualTo",
"period": 60,
"threshold": 80.0,
"repeatInterval": 1800,
"repeatCount": -1,
"emergencyLevel": "Emergent"
},
"systemTags": [],
"userTags": []
}
Note: 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) | Optional. The labels. | 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\":\"\u003d\",\"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 | Whether the operation succeeded. | 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 | The alarm name. | 4.7.0 |
| period | int | The period. | 4.7.0 |
| repeatInterval | int | The repeat interval. | 4.7.0 |
| repeatCount | int | The number of repeat. | 4.7.0 |
| namespace | String | The namespace. | 4.7.0 |
| metricName | String | The metric name. | 4.7.0 |
| threshold | double | The threshold. | 4.7.0 |
| labels | String | The labels. | 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 | The GreaterThanOrEqualTo value. | 4.7.0 |
| GreaterThan | ComparisonOperator | The GreaterThan value. | 4.7.0 |
| LessThan | ComparisonOperator | The LessThan value. | 4.7.0 |
| LessThanOrEqualTo | ComparisonOperator | The LessThanOrEqualTo value. | 4.7.0 |
#emergencyLevel
| Name | Type | Description | Starting Version |
|---|---|---|---|
| Emergent | EmergencyLevel | The Emergent value. | 4.7.0 |
| Important | EmergencyLevel | The Important value. | 4.7.0 |
| Normal | EmergencyLevel | The Normal value. | 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()ChangeEventSubscriptionState
API Request
URLs
PUT zstack/v1/zwatch/change/eventSubscription/{uuid}/stateHeaders
Authorization: OAuth the-session-uuidBody
Note: 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.
{
"changeEventSubscriptionState": {
"state": "Disabled"
},
"systemTags": [],
"userTags": []
}
Note: 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 '{"changeEventSubscriptionState":{"state":"Disabled"}}' http://localhost:8080/zstack/v1/zwatch/change/eventSubscription/2140655d1d183a6690c0eecdbc721ec0/stateParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The UUID of the resource. Uniquely identifies the resource. | 4.7.0 | |
| state | String | body (contained in the changeEventSubscriptionState structure) | Event alarm state. |
|
4.7.0 |
| systemTags (Optional) | List | body | System tags. | 4.7.0 | |
| userTags (Optional) | List | body | User tags. | 4.7.0 |
API Response
On success, this API returns an empty JSON structure
{}. On failure, the returned JSON structure contains an error field. For example:{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Examples
Java
SDK
ChangeEventSubscriptionStateAction action = new ChangeEventSubscriptionStateAction();
action.uuid = "2140655d1d183a6690c0eecdbc721ec0";
action.state = "Disabled";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeEventSubscriptionStateAction.Result res = action.call();Python
SDK
ChangeEventSubscriptionStateAction action = ChangeEventSubscriptionStateAction()
action.uuid = "2140655d1d183a6690c0eecdbc721ec0"
action.state = "Disabled"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeEventSubscriptionStateAction.Result res = action.call()