Update Alarm

PUT/zstack/v1/zwatch/alarms/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateAlarm": {
    "name": "VM CPU Alarm",
    "comparisonOperator": "LessThanOrEqualTo",
    "period": 60.0,
    "enableRecovery": true
  },
  "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 '{"updateAlarm":{"name":"VM CPU Alarm","comparisonOperator":"LessThanOrEqualTo","period":60.0,"enableRecovery":true}}' http://localhost:8080/zstack/v1/zwatch/alarms/28397feb3d083fdc9346edb066fbf589/actions

Parameter 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.

  • GreaterThanOrEqualTo
  • GreaterThan
  • LessThan
  • LessThanOrEqualTo

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.

 

 

3.4.0

emergencyLevel (Optional)

String

body (contained in the updateAlarm structure)

Alarm level.

  • Emergent
  • Important
  • Normal

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": "=",
        "value": "396d863211e446938ea01eb10bc9fd18"
      }
    ],
    "actions": [
      {
        "alarmUuid": "0d18a844bbf544bb914ab9287651f59f",
        "actionType": "sns",
        "actionUuid": "17b884822b284e6e9a0b67307a28955c"
      }
    ]
  }
}
NameTypeDescriptionStarting Version
errorErrorCodeThe error code. If not null, the operation failed. This field is null on success. See error for details.2.3
inventoryAlarmInventorySee inventory for details.2.3

error

NameTypeDescriptionStarting Version
codeStringThe error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001.2.3
descriptionStringA brief description of the error.2.3
detailsStringDetailed information about the error.2.3
elaborationStringA reserved field. Default is null.2.3
opaqueLinkedHashMapA reserved field. Default is null.2.3
causeErrorCodeThe root error. The source error that caused the current error. This field is null if there is no root error.2.3

inventory

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource.2.3
nameStringResource name.2.3
descriptionStringDetailed description of the resource.2.3
periodIntegerThreshold duration.2.3
namespaceStringNamespace.2.3
metricNameStringMetric name.2.3
thresholdDoubleThreshold.2.3
repeatIntervalIntegerAlarm repeat interval.2.3
enableRecoveryBooleanEnable recovery notification.3.4.0
createDateTimestampCreation time.2.3
lastOpDateTimestampLast modification time.2.3
comparisonOperatorComparisonOperatorSee comparisonOperator for details.2.3
statusAlarmStatusSee status for details.2.3
labelsListSee labels for details.2.3
actionsListSee actions for details.2.3

comparisonOperator

NameTypeDescriptionStarting Version
nameStringResource name.2.3
ordinalint 2.3

status

NameTypeDescriptionStarting Version
OKAlarmStatusMonitoring.2.3
AlarmAlarmStatusTriggered.2.3
InsufficientDataAlarmStatusInsufficient data.2.3

labels

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource.2.3
keyStringLabel key.2.3
operatorStringComparison operator.2.3
valueStringLabel value.2.3

actions

NameTypeDescriptionStarting Version
alarmUuidStringAlarm UUID.2.3
actionTypeStringAlarm action type.2.3
actionUuidStringAlarm 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()