• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference
  4. Metrics and Logs (Proprietary APIs)
  5. Obtaining Cluster Monitoring Metrics

Obtaining Cluster Monitoring Metrics

Function

This API is used to obtain cluster monitoring metrics over a specified period of time.

URI

GET /api/v1/ops/clusters/{clusteruuid}/metrics

Table 1 describes the parameters of this API.

Table 1 Parameter description

Parameter

Mandatory

Description

clusteruuid

Yes

Cluster uuid obtained using the API described in Obtaining Information About All Clusters.

startTime

Yes

NOTICE:

The timeFrame and startTime/endTime are mutually exclusive.

Unix time stamp of the metric query start time.

The startTime is accurate to the second and must be used together with the endTime.

endTime

Yes

NOTICE:

The timeFrame and startTime/endTime are mutually exclusive.

Unix time stamp of the metric query end time.

The endTime is accurate to the second and must be used together with the startTime.

timeFrame

Yes

NOTICE:

The timeFrame and startTime/endTime are mutually exclusive.

Time range (in seconds) of metric query.

The maxQueryTime is 7*24*60*60 seconds.

For example, timeFrame=120 means monitoring metrics over the last 120 seconds will be returned.

period

No

Sampling period (in seconds).

Historical monitoring metrics are sampled by means of interpolation.

If this parameter is left unspecified or set to 1, raw monitoring metrics are returned.

Value:

  • 1
  • 30
  • 60
  • 300
  • 600
  • 1200
  • 3600

fillPolicy

No

Policy for inserting a blank filler field in the event that no monitoring metrics are available for sampling.

If this parameter is left unspecified, no sample is produced for the time when no monitoring metrics are generated. This parameter must be used with the period parameter.

Value:

  • nan: The blank filler field NaN is inserted in the event that no monitoring metrics are available for sampling.
  • zero: The blank filler field 0 is inserted in the event that no monitoring metrics are available for sampling.

Request

Request parameters:

N/A

Example request:

curl "http://{cce-domain-name}/api/v1/ops/clusters/{clusteruuid}/metrics?startTime=1469759447&endTime=1469759760&period=60&fillPolicy=nan"
curl "http://{cce-domain-name}/api/v1/ops/clusters/{clusteruuid}/metrics?timeFrame=120

Response

Response parameters:

Table 2 describes the response parameters.

Table 2 Values of monitoring metrics

Parameter

Type

Description

kind

String

Type of query object.

Value:

  • cluster
  • node
  • pod

apiVersion

String

API version number.

metadata

Table 3

Object metadata.

spec

Table 4

Object monitoring data.

Table 3 Data structure of the metadata field

Parameter

Type

Description

name

String

Object name.

uuid

String

Object uuid.

Table 4 Data structure of the spec field

Parameter

Type

Description

metricsList

Table 5

List of monitoring metrics.

Table 5 Data structure of the metricsList

Parameter

Type

Description

metric_name

String

Metric name.

datapoints

Table 6

Metrics data points.

Table 6 Data structure of the datapoint field

Parameter

Type

Description

timestamp

int64

Unix time stamp (in seconds).

metricvalue

int64

float64

Values of monitoring metrics.

If a monitoring metric has no value, a blank filler field NaN is inserted according to the fillPolicy.

unit

String

Measurement unit of monitoring metrics.

Example response:

[
  {
    "kind": "cluster",
    "apiVersion": "v1.0",
    "metadata": {
      "name": "cluster002",
      "uuid": "234a3e64-506e-4441-aef3-761a306f9e59"
    },
    "spec": {
      "metricsList": [
        {
          "metric_name": "cpu_util",
          "datapoints": [
            {
              "timestamp": 1489507999,
              "metricvalue": 8.200000000000001,
              "unit": "percent"
            },
            {
              "timestamp": 1489508014,
              "metricvalue": 8.200000000000001,
              "unit": "percent"
            },
            {
              "timestamp": 1489508029,
              "metricvalue": 8.200000000000001,
              "unit": "percent"
            },
            {
              "timestamp": 1489508044,
              "metricvalue": 8.125,
              "unit": "percent"
            },
            {
              "timestamp": 1489508059,
              "metricvalue": 8.125,
              "unit": "percent"
            },
            {
              "timestamp": 1489508074,
              "metricvalue": 8.125,
              "unit": "percent"
            },
            {
              "timestamp": 1489508089,
              "metricvalue": 8.125,
              "unit": "percent"
            },
            {
              "timestamp": 1489508104,
              "metricvalue": 8.25,
              "unit": "percent"
            },
            {
              "timestamp": 1489508119,
              "metricvalue": 8.25,
              "unit": "percent"
            },
            {
              "timestamp": 1489508134,
              "metricvalue": 8.25,
              "unit": "percent"
            },
            {
              "timestamp": 1489508149,
              "metricvalue": 8.25,
              "unit": "percent"
            },
            {
              "timestamp": 1489508164,
              "metricvalue": 8.325000000000001,
              "unit": "percent"
            },
            {
              "timestamp": 1489508179,
              "metricvalue": 8.325000000000001,
              "unit": "percent"
            },
            {
              "timestamp": 1489508194,
              "metricvalue": 8.325000000000001,
              "unit": "percent"
            },
            {
              "timestamp": 1489508209,
              "metricvalue": 8.325000000000001,
              "unit": "percent"
            },
            {
              "timestamp": 1489508224,
              "metricvalue": 8.125,
              "unit": "percent"
            },
            {
              "timestamp": 1489508239,
              "metricvalue": 8.125,
              "unit": "percent"
            },
            {
              "timestamp": 1489508254,
              "metricvalue": 8.125,
              "unit": "percent"
            },
            {
              "timestamp": 1489508269,
              "metricvalue": 8.125,
              "unit": "percent"
            }
          ]
        },
        {
          "metric_name": "mem_util",
          "datapoints": [
            {
              "timestamp": 1489507999,
              "metricvalue": 5.014848709106445,
              "unit": "percent"
            },
            {
              "timestamp": 1489508014,
              "metricvalue": 5.014848709106445,
              "unit": "percent"
            },
            {
              "timestamp": 1489508029,
              "metricvalue": 5.014848709106445,
              "unit": "percent"
            },
            {
              "timestamp": 1489508044,
              "metricvalue": 5.014801025390625,
              "unit": "percent"
            },
            {
              "timestamp": 1489508059,
              "metricvalue": 5.014801025390625,
              "unit": "percent"
            },
            {
              "timestamp": 1489508074,
              "metricvalue": 5.014801025390625,
              "unit": "percent"
            },
            {
              "timestamp": 1489508089,
              "metricvalue": 5.014801025390625,
              "unit": "percent"
            },
            {
              "timestamp": 1489508104,
              "metricvalue": 4.983091354370117,
              "unit": "percent"
            },
            {
              "timestamp": 1489508119,
              "metricvalue": 4.983091354370117,
              "unit": "percent"
            },
            {
              "timestamp": 1489508134,
              "metricvalue": 4.983091354370117,
              "unit": "percent"
            },
            {
              "timestamp": 1489508149,
              "metricvalue": 4.983091354370117,
              "unit": "percent"
            },
            {
              "timestamp": 1489508164,
              "metricvalue": 4.982137680053711,
              "unit": "percent"
            },
            {
              "timestamp": 1489508179,
              "metricvalue": 4.982137680053711,
              "unit": "percent"
            },
            {
              "timestamp": 1489508194,
              "metricvalue": 4.982137680053711,
              "unit": "percent"
            },
            {
              "timestamp": 1489508209,
              "metricvalue": 4.982137680053711,
              "unit": "percent"
            },
            {
              "timestamp": 1489508224,
              "metricvalue": 4.981851577758789,
              "unit": "percent"
            },
            {
              "timestamp": 1489508239,
              "metricvalue": 4.981851577758789,
              "unit": "percent"
            },
            {
              "timestamp": 1489508254,
              "metricvalue": 4.981851577758789,
              "unit": "percent"
            },
            {
              "timestamp": 1489508269,
              "metricvalue": 4.981851577758789,
              "unit": "percent"
            }
          ]
        }
      ]
    }
  }
]

Status Code

Table 7 describes the status code of this API.

Table 7 Status code

Status Code

Description

200

Monitoring information about all clusters over a specified period of time is returned.

For the description about status codes, see Status Codes.