Get Alarm Data

GET/zstack/v1/zwatch/alarm-histories

Headers

Authorization: OAuth the-session-uuid

Curl 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.0

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
startTime (Optional)LongqueryStart time. 2.3
endTime (Optional)LongqueryEnd time. 2.3
limit (Optional)IntegerqueryMaximum number of records to return. 2.3
conditions (Optional)ListqueryCondition list for filtering results. 2.3
count (Optional)booleanqueryWhether to query message count. 3.3.0
excludeOtherAccount (Optional)booleanqueryWhether to exclude messages from other accounts (only effective for SystemAdmin). 3.3.0
endpointUuid (Optional)StringqueryEndpoint UUID. 3.10.0
systemTags (Optional)ListquerySystem tags. 2.3
userTags (Optional)ListqueryUser 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": 1510669257141.0
    }
  ]
}
NameTypeDescriptionStarting Version
errorErrorCodeThe error code. If not null, the operation failed. This field is null on success. See error for details.2.3
historiesListSee histories 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

histories

NameTypeDescriptionStarting Version
alarmUuidStringAlarm UUID.2.3
namespaceStringNamespace.2.3
metricNameStringMetric name.2.3
accountUuidStringAccount UUID.2.3
resourceUuidStringResource UUID.2.3
resourceTypeStringResource type.2.3
alarmStatusStringAlarm status.2.3
alarmNameStringAlarm name.2.3
thresholdDoubleAlarm threshold.2.3
periodIntegerThreshold duration.2.3
labelsStringTag list.2.3
metricValueDoubleMetric value at the time.2.3
timelongAlarm 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()