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
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
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. Exporting metrics in Prometheus format

Exporting metrics in Prometheus format

Written by
Yandex Cloud
Improved by
peter-volkov
Updated at April 28, 2025

To export metrics in Prometheus format, use the prometheusMetrics method. Set up metric collection in Prometheus before pushing metrics to it.

Here is an example of setting up Monitoring metric collection in Prometheus:

  1. Select the folder you want to collect data from.

  2. Select a service from the following list:

    • application-load-balancer: Application Load Balancer.
    • audit-trails: Audit Trails.
    • cdn: Cloud CDN.
    • certificate-manager: Certificate Manager.
    • compute: Compute Cloud.
    • container-registry: Container Registry.
    • data-proc: Yandex Data Processing.
    • data-streams: Data Streams.
    • data-transfer: Data Transfer.
    • iam: Identity and Access Management.
    • interconnect: Cloud Interconnect.
    • kms: Key Management Service.
    • logging: Cloud Logging.
    • managed-clickhouse: Managed Service for ClickHouse®.
    • managed-elasticsearch: Managed Service for Elasticsearch.
    • managed-gitlab: Managed Service for GitLab.
    • managed-greenplum: Managed Service for Greenplum®.
    • managed-kafka: Managed Service for Apache Kafka®.
    • managed-kubernetes: Managed Service for Kubernetes.
    • managed-mongodb: Managed Service for MongoDB.
    • managed-mysql: Managed Service for MySQL®.
    • managed-opensearch: Managed Service for OpenSearch.
    • managed-postgresql: Managed Service for PostgreSQL.
    • managed-redis: Yandex Managed Service for Valkey™.
    • managed-sqlserver: Managed Service for SQL Server.
    • message-queue: Message Queue.
    • monitoring: Monitoring.
    • network-load-balancer: Network Load Balancer.
    • serverless-apigateway: API Gateway.
    • serverless-containers: Serverless Containers.
    • serverless-functions: Cloud Functions.
    • speechkit: SpeechKit.
    • storage: Object Storage.
    • translate: Translate.
    • vision: Vision OCR.
    • ydb: Managed Service for YDB.
  3. Create a static API key for the service account.

  4. Assign the service account the monitoring.viewer role for the selected folder.

  5. In the Prometheus configuration, add another job to the data collection section:

    ...
    scrape_configs:
      ...
      - job_name: 'yc-monitoring-export'
        metrics_path: '/monitoring/v2/prometheusMetrics'
        scheme: 'https'
        params:
          folderId:
          - '<folder_ID>' # For example, it can be `aoeng2krmasi`********.
          service:
          - '<service>' # For example, it can be `managed-mongodb`.
        bearer_token: '<API_key>'
        # Alternatively, you can use a file (recommended):
        # bearer_token_file: '<name_of_file_with_API_key>'
        static_configs:
        - targets: ['monitoring.api.cloud.yandex.net']
          labels:
            folderId: '<folder_ID>'
            service: '<service_ID>'
    
  6. Restart Prometheus.

  7. Check data collection in the Prometheus UI: http://localhost:9090/targets (replace localhost with the name of your host running Prometheus).

  8. If you need to change label names, use relabeling.

Tip

When dealing with lots of metrics, increase scrape_timeout to 60s.

ClickHouse® is a registered trademark of ClickHouse, Inc.

Was the article helpful?

Previous
Downloading metrics
Next
Creating a dashboard
© 2025 Direct Cursus Technology L.L.C.