Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Querying Metrics

Updated on 2024-05-17 GMT+08:00

Function

This API is used to query metrics supported by Cloud Eye. You can specify the namespace, metric, dimension, sorting order, start records, and the maximum number of records when using this API to query metrics.

NOTICE:

After a cloud service resource is deleted, its data is cached for 3 hours, so metrics of the resource can still be queried within the 3 hours.

Debugging

You can debug the API in API Explorer which supports automatic authentication. API Explorer can automatically generate and debug example SDK code.

URI

GET /V1.0/{project_id}/metrics

  • Parameter description
    Table 1 Parameter description

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Specifies the project ID.

    For details about how to obtain the project ID, see Obtaining a Project ID.

    Table 2 Query parameter description

    Parameter

    Mandatory

    Type

    Description

    namespace

    No

    String

    Specifies the namespace of a service. For details, see Services Interconnected with Cloud Eye.

    The namespace must be in the service.item format and contain 3 to 32 characters. service and item each must start with a letter and contain only letters, digits, and underscores (_).

    metric_name

    No

    String

    Specifies the metric ID. For example, if the monitoring metric of an ECS is CPU usage, metric_name is cpu_util. For details, see Services Interconnected with Cloud Eye.

    dim

    No

    String

    Specifies the dimension. For example, the ECS dimension is instance_id. For details about each service dimension, see Services Interconnected with Cloud Eye.

    A maximum of three dimensions are supported, and the dimensions are numbered from 0 in dim.{i}=key,value format. key cannot exceed 32 characters and value cannot exceed 256 characters.

    Single dimension: dim.0=instance_id,6f3c6f91-4b24-4e1b-b7d1-a94ac1cb011d

    Multiple dimensions: dim.0=key,value&dim.1=key,value

    start

    No

    String

    Specifies the paging start value.

    The format is namespace.metric_name.key:value.

    Example: start=SYS.ECS.cpu_util.instance_id:d9112af5-6913-4f3b-bd0a-3f96711e004d.

    limit

    No

    Integer

    Supported range: 1 to 1000 (default)

    This parameter is used to limit the number of query results.

    order

    No

    String

    Specifies the result sorting method, which is sorted by timestamp.

    The default method is desc.

    • asc: The query results are displayed in the ascending order.
    • desc: The query results are displayed in the descending order.
  • Example requests
    Example request 1: Query all metrics that can be monitored.
    GET https://{Cloud Eye endpoint}/V1.0/{project_id}/metrics
    Example request 2: Query the CPU usage of the ECS whose ID is 6f3c6f91-4b24-4e1b-b7d1-a94ac1cb011d. Retain 10 records in descending order by timestamp.
    GET https://{Cloud Eye endpoint}/V1.0/{project_id}/metrics?namespace=SYS.ECS&metric_name=cpu_util&dim.0=instance_id,6f3c6f91-4b24-4e1b-b7d1-a94ac1cb011d&limit=10&order=desc

Request

None

Response

  • Response parameters
    Table 3 Parameter description

    Parameter

    Type

    Description

    metrics

    Array of objects

    Specifies the list of metric objects.

    For details, see Table 4.

    meta_data

    Object

    Specifies the metadata of query results, including the pagination information.

    For details, see Table 6.

    Table 4 metrics data structure description

    Parameter

    Type

    Description

    namespace

    String

    Specifies the metric namespace.

    dimensions

    Array of objects

    Specifies the list of metric dimensions.

    For details, see Table 5.

    metric_name

    String

    Specifies the metric name, such as cpu_util.

    unit

    String

    Specifies the metric unit.

    Table 5 dimensions data structure description

    Parameter

    Type

    Description

    name

    String

    Specifies the dimension. For example, the ECS dimension is instance_id. For details about the dimension of each service, see the key column in Services Interconnected with Cloud Eye.

    value

    String

    Specifies the dimension value, for example, an ECS ID.

    Enter 1 to 256 characters.

    Table 6 meta_data data structure description

    Parameter

    Type

    Description

    count

    Integer

    Specifies the number of returned results.

    marker

    String

    Specifies the pagination marker.

    For example, you have queried 10 records this time and the tenth record is about cpu_util. In your next query, if start is set to cpu_util, you can start your query from the next metric of cpu_util.

    total

    Integer

    Specifies the total number of metrics.

  • Example response
    {
        "metrics": [
            {
                "namespace": "SYS.ECS", 
                "dimensions": [
                    {
                        "name": "instance_id", 
                        "value": "d9112af5-6913-4f3b-bd0a-3f96711e004d"
                    }
                ], 
                "metric_name": "cpu_util", 
                "unit": "%"
            }
        ], 
        "meta_data": {
            "count": 1, 
            "marker": "SYS.ECS.cpu_util.instance_id:d9112af5-6913-4f3b-bd0a-3f96711e004d", 
            "total": 7
        }
    }

Returned Values

  • Normal

    200

  • Abnormal

    Returned Value

    Description

    400 Bad Request

    Request error.

    401 Unauthorized

    The authentication information is not provided or is incorrect.

    403 Forbidden

    Access to the requested page is forbidden.

    408 Request Timeout

    The request timed out.

    429 Too Many Requests

    Concurrent requests are excessive.

    500 Internal Server Error

    Failed to complete the request because of an internal service error.

    503 Service Unavailable

    The service is currently unavailable.

Error Codes

See Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback