Update Active Alarm Template

PUT/zstack/v1/zwatch/activealarms/templates/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "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/actions

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

  • GreaterThanOrEqualTo
  • GreaterThan
  • LessThan
  • LessThanOrEqualTo

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.

  • Emergent
  • Important
  • Normal

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"
  }
}
NameTypeDescriptionStarting Version
successboolean 4.7.0
inventoryActiveAlarmTemplateInventorySee inventory for details.4.7.0
errorErrorCodeThe error code. If not null, the operation failed. This field is null on success. See error for details.4.7.0

inventory

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource.4.7.0
alarmNameString 4.7.0
periodint 4.7.0
repeatIntervalint 4.7.0
repeatCountint 4.7.0
namespaceString 4.7.0
metricNameString 4.7.0
thresholddouble 4.7.0
labelsString 4.7.0
createDateTimestampCreation time.4.7.0
lastOpDateTimestampLast modification time.4.7.0
comparisonOperatorComparisonOperatorSee comparisonOperator for details.4.7.0
emergencyLevelEmergencyLevelSee emergencyLevel for details.4.7.0

comparisonOperator

NameTypeDescriptionStarting Version
GreaterThanOrEqualToComparisonOperator 4.7.0
GreaterThanComparisonOperator 4.7.0
LessThanComparisonOperator 4.7.0
LessThanOrEqualToComparisonOperator 4.7.0

emergencyLevel

NameTypeDescriptionStarting Version
EmergentEmergencyLevel 4.7.0
ImportantEmergencyLevel 4.7.0
NormalEmergencyLevel 4.7.0

error

NameTypeDescriptionStarting Version
codeStringThe error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001.4.7.0
descriptionStringA brief description of the error.4.7.0
detailsStringDetailed information about the error.4.7.0
elaborationStringA reserved field. Default is null.4.7.0
opaqueLinkedHashMapA reserved field. Default is null.4.7.0
causeErrorCodeThe 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()