Get Metric Label Values

GET/zstack/v1/zwatch/metrics/label-values

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/metrics/label-values?namespace=ZStack/VM&metricName=CPUIdleUtilization&startTime=1.58806818E9&endTime=1.58806824E9&labelNames=CPUNum&filterLabels=VMUuid=e47f7145f4cd4fca8e2856038ecdf3e1

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
namespaceStringqueryNamespace name 2.3
metricNameStringqueryMetric name 2.3
labelNamesListqueryLabel name list for retrieving values 2.3
filterLabels (optional)ListqueryLabel filter list. For example, you can specify the label HostUuid=e47f7145f4cd4fca8e2856038ecdf3e1 to select a specific host and retrieve the values of labels specified in labelNames. 2.3
startTime (optional)LongqueryStart time 3.9.0
endTime (optional)LongqueryEnd time 3.9.0
systemTags (optional)ListquerySystem tags 2.3
userTags (optional)ListqueryUser tags 2.3

API Response

Response Example

{
  "labels": [
    {
      "VMUuid": "e47f7145f4cd4fca8e2856038ecdf3e1",
      "CPUNum": "1"
    }
  ]
}
NameTypeDescriptionStarting Version
labelsListLabel values0.6
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error0.6

error

NameTypeDescriptionStarting Version
codeStringError code. The globally unique error identifier, for example, SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field. Default is null0.6
opaqueLinkedHashMapReserved field. Default is null0.6
causeErrorCodeRoot error. The source error that caused the current error. This field is null if no root error exists0.6

SDK Examples

Java SDK

GetMetricLabelValueAction action = new GetMetricLabelValueAction();
action.namespace = "ZStack/VM";
action.metricName = "CPUIdleUtilization";
action.startTime = 1.58806818E9;
action.endTime = 1.58806824E9;
action.labelNames = asList("CPUNum");
action.filterLabels = asList("VMUuid=e47f7145f4cd4fca8e2856038ecdf3e1");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetMetricLabelValueAction.Result res = action.call();

Python SDK

GetMetricLabelValueAction action = GetMetricLabelValueAction()
action.namespace = "ZStack/VM"
action.metricName = "CPUIdleUtilization"
action.startTime = 1.58806818E9
action.endTime = 1.58806824E9
action.labelNames = [CPUNum]
action.filterLabels = [VMUuid=e47f7145f4cd4fca8e2856038ecdf3e1]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetMetricLabelValueAction.Result res = action.call()