[Yandex Cloud documentation](../../../index.md) > [Monium](../../index.md) > Metrics > [Delivering and exporting metrics](../index.md) > Exporting metrics in Prometheus format

# Exporting metrics in Prometheus format

To export metrics in Prometheus format, use the [prometheusMetrics](../../api-ref/MetricsData/prometheusMetrics.md) method. Set up metric collection in Prometheus before pushing metrics to it.

Here is an example of setting up Monium.Metrics metric collection in Prometheus:
1. Select the folder you want to collect data from.
1. Select a service from the following list:
   * `application-load-balancer`: Application Load Balancer.
   * `audit-trails`: Audit Trails.
   * `yccdn`: 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`: Monium.Logs.
   * `managed-clickhouse`: Managed Service for ClickHouse®.
   * `managed-gitlab`: Managed Service for GitLab.
   * `managed-greenplum`: Yandex MPP Analytics for PostgreSQL.
   * `managed-kafka`: Managed Service for Apache Kafka®.
   * `managed-kubernetes`: Managed Service for Kubernetes.
   * `managed-mongodb`: Yandex StoreDoc.
   * `managed-mysql`: Managed Service for MySQL®.
   * `managed-opensearch`: Managed Service for OpenSearch.
   * `managed-postgresql`: Managed Service for PostgreSQL.
   * `managed-valkey`: Yandex Managed Service for Valkey™.
   * `managed-sqlserver`: Managed Service for SQL Server.
   * `message-queue`: Message Queue.
   * `monitoring`: Monium.Metrics.
   * `network-load-balancer`: Network Load Balancer.
   * `postbox`: Yandex Cloud Postbox.
   * `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.

1. Create an [API key](../../../iam/operations/authentication/manage-api-keys.md#create-api-key) for the [service account](../../../iam/concepts/users/service-accounts.md).
1. [Assign the service account the `monitoring.viewer`](../../../iam/operations/roles/grant.md#access-to-sa) role for the selected folder.
1. In the [Prometheus configuration](https://prometheus.io/docs/prometheus/latest/configuration/configuration), add another `job` to the data collection section:

   ```yaml
   ...
   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>'
   ```

1. Restart Prometheus.
1. Check data collection in the Prometheus UI: `http://localhost:9090/targets` (replace `localhost` with the name of your host running Prometheus).
1. If you need to change label names, use [relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config).

{% note tip %}

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

{% endnote %}

_ClickHouse® is a registered trademark of [ClickHouse, Inc](https://clickhouse.com)._