Help Center/ Cloud Eye/ API Reference/ API v2/ Graphs/ Querying Information About a Graph
Updated on 2024-05-16 GMT+08:00

Querying Information About a Graph

Function

This API is used to query information about a graph.

Constraints

This API is not supported at the following regions: CN East-Qingdao, LA-Mexico City1, TR-Istanbul, AP-Jakarta, ME-Riyadh.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

GET /v2/{project_id}/widgets/{widget_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the tenant ID.

Minimum: 1

Maximum: 64

Regex Pattern: ^[a-zA-Z0-9-]{1,64}$

widget_id

Yes

String

Specifies the graph ID.

Regex Pattern: ^wg([a-z]|[A-Z]|[0-9]){22}$

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Specifies the MIME type of the request body. Default value application/json is recommended.

Default: application/json;charset=UTF-8

Minimum: 1

Maximum: 64

X-Auth-Token

Yes

String

Specifies the user token. It is a response to the API for obtaining a user token. This API is the only one that does not require authentication. The value of X-Subject-Token in the response header is the token.

Minimum: 1

Maximum: 16000

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

widget_id

String

Specifies the graph ID.

Regex Pattern: ^wg([a-z]|[A-Z]|[0-9]){22}$

metrics

Array of WidgetMetric objects

Specifies the metric list.

Array Length: 1 - 200

title

String

Specifies the graph name.

Minimum: 1

Maximum: 128

Regex Pattern: ^([\u4E00-\u9FFF]|[a-z]|[A-Z]|[0-9]|_|-|:|;|\(|\)|\.|~|(|))+$

threshold

Double

Specifies the threshold of metrics on the graph.

Minimum: 0

Maximum: 1.7976931348623157E308

threshold_enabled

Boolean

Specifies whether to display the threshold of metrics. The value can be true (to display) or false (not to display).

view

String

Specifies the graph type. The value can be ** bar** (bar chart) or ** line** (line chart).

Enumeration values:

  • bar
  • line

metric_display_mode

String

Specifies how many metrics will be displayed on one graph. The value can be single or multiple.

Enumeration values:

  • single
  • multiple

properties

properties object

Specifies additional information. This parameter takes effect only when you set view to bar.

location

location object

Specifies the graph coordinates.

unit

String

Specifies the metric unit.

create_time

Long

Specifies when the dashboard was created.

Minimum: 1111111111111

Maximum: 9999999999999

Table 4 WidgetMetric

Parameter

Type

Description

namespace

String

Specifies the cloud service dimension.

Minimum: 3

Maximum: 32

Regex Pattern: ^([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_)*\.([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_)*$

dimensions

DimensionInfo object

Specifies the dimension list.

metric_name

String

Specifies the metric name.

Minimum: 1

Maximum: 96

Regex Pattern: ^([A-Za-z]){1}([0-9A-Za-z]|_|-)*$

alias

Array of strings

Specifies the alias list of metrics on the graph.

Minimum: 1

Maximum: 128

Array Length: 0 - 200

extra_info

ExtraInfo object

Specifies the metric information.

Table 5 DimensionInfo

Parameter

Type

Description

name

String

Specifies the dimension name. Use commas (,) to separate multiple dimensions. For details about dimensions supported by each cloud service, see "[Services Interconnected with Cloud Eye] (https://support.huaweicloud.com/intl/en-us/usermanual-ces/en-us_topic_0202622212.html)".

Minimum: 1

Maximum: 131

Regex Pattern: ^([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_|-){0,31}(,([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_|-){0,31}){0,3}$

filter_type

String

Specifies the resource type. The value can be all_instances (all resources) or specific_instances (specified resources).

Enumeration values:

  • all_instances
  • specific_instances

values

Array of strings

Specifies the dimension value list.

Minimum: 1

Maximum: 1024

Array Length: 0 - 200

Table 6 ExtraInfo

Parameter

Type

Description

origin_metric_name

String

Specifies the metric name.

Minimum: 1

Maximum: 4096

Regex Pattern: ^([a-z]|[A-Z]|[0-9]|_|-|~|\.|/|:)*$

metric_prefix

String

Specifies the metric name prefix.

Minimum: 1

Maximum: 4096

Regex Pattern: ^([a-z]|[A-Z]|[0-9]|_|-|~|\.|/|:)*$

metric_type

String

Specifies the metric type.

Minimum: 1

Maximum: 32

Regex Pattern: ^([a-z]|[A-Z]|[0-9]|_|-|~|\.|/|:)*$

custom_proc_name

String

Specifies the custom process name.

Minimum: 1

Maximum: 250

Table 7 properties

Parameter

Type

Description

filter

String

Specifies how metric data is aggregated. The value can only be TopN.

Enumeration values:

  • topN

topN

Integer

Specifies the top n resources sorted by a metric.

Minimum: 1

Maximum: 2147483647

Default: 100

order

String

Specifies how top n resources by a metric are sorted on a graph. The value can be asc or desc.

Enumeration values:

  • asc
  • desc
Table 8 location

Parameter

Type

Description

top

Integer

Specifies the grids between the graph and the top of the dashboard.

Minimum: 0

Maximum: 2147483647

left

Integer

Specifies the grids between the graph and the left side of the dashboard.

Minimum: 0

Maximum: 9

width

Integer

Specifies the graph width.

Minimum: 3

Maximum: 12

height

Integer

Specifies the graph height.

Minimum: 3

Maximum: 2147483647

Status code: 400

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the status codes customized by each cloud service when a request error occurs.

Minimum: 0

Maximum: 256

error_msg

String

Specifies the request error message.

Minimum: 0

Maximum: 256

request_id

String

Specifies the request ID.

Minimum: 0

Maximum: 256

Status code: 401

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the status codes customized by each cloud service when a request error occurs.

Minimum: 0

Maximum: 256

error_msg

String

Specifies the request error message.

Minimum: 0

Maximum: 256

request_id

String

Specifies the request ID.

Minimum: 0

Maximum: 256

Status code: 500

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the status codes customized by each cloud service when a request error occurs.

Minimum: 0

Maximum: 256

error_msg

String

Specifies the request error message.

Minimum: 0

Maximum: 256

request_id

String

Specifies the request ID.

Minimum: 0

Maximum: 256

Example Requests

None

Example Responses

Status code: 200

OK

{
  "widget_id" : "wg1234567890123456789012",
  "metrics" : [ {
    "namespace" : "SYS.ECS",
    "dimensions" : {
      "name" : "instance_id",
      "filter_type" : "specific_instances",
      "values" : [ "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ]
    },
    "metric_name" : "cpu_util",
    "alias" : [ "cpuutilalias" ],
    "extra_info" : {
      "origin_metric_name" : "cpu_util",
      "metric_prefix" : "cpu",
      "metric_type" : "type",
      "custom_proc_name" : "app.sh"
    }
  } ],
  "view" : "view",
  "metric_display_mode" : "single",
  "threshold" : 0.7,
  "threshold_enabled" : true,
  "title" : "widget_title",
  "properties" : {
    "filter" : "topN",
    "topN" : 100,
    "order" : "desc"
  },
  "location" : {
    "left" : 0,
    "top" : 0,
    "width" : 4,
    "height" : 3
  },
  "unit" : "%",
  "create_time" : 1111111111111
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

401

Unauthorized

500

Internal Server Error

Error Codes

See Error Codes.