Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Monitoring
  • Getting started
    • All guides
      • Metrics overview
      • Delivering Linux system metrics
      • Delivering custom application metrics
      • Delivering metrics from HAProxy and other third-party applications
      • Delivering metrics from hosts outside Yandex Cloud
      • Writing custom metrics via the API
      • Getting a list of metrics
      • Downloading metrics
      • Exporting metrics in Prometheus format
  • Access management
  • Terraform reference
  • Release notes
  1. Step-by-step guides
  2. Working with metrics
  3. Downloading metrics

Downloading metrics

Written by
Yandex Cloud
Improved by
Denis R.
Updated at April 28, 2025

To download metric data, use the read method.

Getting startedGetting started

To follow the examples in this section:

  1. Make sure you have installed cURL that is used in the examples.
  2. Get the ID of the folder for which you have the monitoring.viewer role or higher.
  3. Get an IAM token:
    • Guide for users with a Yandex account.
    • Guide for a service account.
    • Guide for a federated account.

Request exampleRequest example

  1. Create a file with the request body, e.g., body.json:

    For example, the request below gets metric data on the CPU usage for the VM with the epdpfhoh1r83******** ID from July 24 to July 31 (00:00 UTC).

    body.json:

    {
        "query": "cpu_usage{service=\"compute\", resource_id=\"epdpfhoh1r83********\"}",
        "fromTime": "2021-07-24T00:00:00Z",
        "toTime": "2021-07-31T00:00:00Z",
        "downsampling": {
            "maxPoints": 10
        }
    }
    

    Where:

    • query: Query text:
      • cpu_usage: CPU usage.
      • resource_id: VM ID.
    • fromTime: Start of the period.
    • toTime: End of the period.
  2. Send the request and save the response to a file, e.g., output.json:

    export IAM_TOKEN=CggaATEVAgA...
    curl \
      --request POST \
      --header "Content-Type: application/json" \
      --header "Authorization: Bearer ${IAM_TOKEN}" \
      --data '@body.json' \
      'https://monitoring.api.cloud.yandex.net/monitoring/v2/data/read?folderId=b2ghmo15rmnl********' > output.json
    

    Response example:

    output.json:

    {
        "metrics": [
            {
                "type": "DGAUGE",
                "name": "cpu_usage",
                "labels": {
                    "resource_type": "vm",
                    "cluster": "b2ghmo15rmnl********",
                    "project": "b1gbkpesobgv********",
                    "resource_id": "epdpfhoh1r83********",
                    "service": "compute"
                },
                "timeseries": {
                    "timestamps": [
                        1562069440800,
                        1562405369712,
                        1562741298624,
                        1563077227536,
                        1563413156448,
                        1563749085360,
                        1564085014272,
                        1564420943184
                    ],
                    "doubleValues": [
                        53.6475600118669,
                        65.5547751323391,
                        70.7148916473759,
                        49.4514634827568,
                        54.3817816479781,
                        81.9327383032693,
                        99.3035341016667,
                        99.982002860023
                    ]
                }
            }
        ]
    }
    

Was the article helpful?

Previous
Getting a list of metrics
Next
Exporting metrics in Prometheus format
Yandex project
© 2025 Yandex.Cloud LLC