GetMetricLabelValue

API Request

URLs
GET zstack/v1/zwatch/metrics/label-values
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/metrics/label-values?namespace=ZStack/VM&metricName=CPUIdleUtilization&startTime=1.58806818E9&endTime=1.58806824E9&labelNames=CPUNum&filterLabels=VMUuid=e47f7145f4cd4fca8e2856038ecdf3e1
Request Parameters
Name Type Location Description Optional Value Starting Version
namespace String query The namespace. 2.3
metricName String query The metric name. 2.3
labelNames List query The name list of the target labels. 2.3
filterLabels List query Optional. The label filter list. For example, you can set the HostUuid label to e47f7145f4cd4fca8e2856038ecdf3e1 to filter values specified in labelNames. 2.3
startTime Long query Optional. The start time. 3.9.0
endTime Long query Optional. The end time. 3.9.0
systemTags List query Optional. The system tags. 2.3
userTags List query Optional. The user tags. 2.3

API Response

Sample Response
{
  "labels": [
    {
      "VMUuid": "e47f7145f4cd4fca8e2856038ecdf3e1",
      "CPUNum": "1"
    }
  ]
}
Name Type Description Starting Version
labels List The label values. 0.6
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
#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. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

SDK Sample

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()