GetAlarmData
API Request
URLs
GET zstack/v1/zwatch/alarm-histories
Headers
Authorization: OAuth the-session-uuid
Curl
Sample
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
Request Parameters
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
startTime | Long | query | Optional. The start time. | 2.3 | |
endTime | Long | query | Optional. The end time. | 2.3 | |
limit | Integer | query | Optional. The maximum number of returned records. | 2.3 | |
conditions | List | query | Optional. The conditions to filter the results. | 2.3 | |
count | boolean | query | Optional. Whether to query the message count. | 3.3.0 | |
excludeOtherAccount | boolean | query | Optional. Whether to exclude messages other than the current account (only effective for SystemAdmin). | 3.3.0 | |
endpointUuid | String | query | Optional. The endpoint UUID. | 3.10.0 | |
systemTags | List | query | Optional. The system tags. | 2.3 | |
userTags | List | query | Optional. The user tags. | 2.3 |
API Response
Sample
Response
{
"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 fails, or vice versa. For more information, see error. | 2.3 |
histories | List | See histories. | 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 |
#histories
Name | Type | Description | Starting Version |
---|---|---|---|
alarmUuid | String | The alarm UUID. | 2.3 |
namespace | String | The namespace. | 2.3 |
metricName | String | The metric name. | 2.3 |
accountUuid | String | The account UUID. | 2.3 |
resourceUuid | String | The resource UUID. | 2.3 |
resourceType | String | The resource type. | 2.3 |
alarmStatus | String | The alarm status. | 2.3 |
alarmName | String | The alarm name. | 2.3 |
threshold | Double | The alarm threshold. | 2.3 |
period | Integer | The threshold duration. | 2.3 |
labels | String | The label list. | 2.3 |
metricValue | Double | The metric value. | 2.3 |
time | long | The time that the alarm record was generated. | 2.3 |
SDK Sample
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()