---
title: "Databases & Analytics - How to fetch service metrics with Prometheus"
description: "Learn how to set up a Prometheus exporter for your Cloud Databases and Analytics service so that a Prometheus server can collect metrics."
url: https://docs.us.ovhcloud.com/en/public-cloud/data-analytics/fetch-service-metrics-prometheus
lang: en
---
> For AI agents: the complete documentation index is available at https://docs.us.ovhcloud.com/en/llms.txt, the full documentation bundle is available at https://docs.us.ovhcloud.com/en/llms-full.txt.

# Databases & Analytics - How to fetch service metrics with Prometheus

**Learn how to set up a Prometheus exporter for your Cloud Databases and Analytics service so that a Prometheus server can collect metrics.**

 

## Requirements

- A[ Cloud Database or Analytics service](https://us.ovhcloud.com/public-cloud/databases/) up and running
- Access to the [OVHcloud API](https://api.us.ovhcloud.com/)
- A [Prometheus](https://prometheus.io/) server to collect metrics

 

## Instructions

**Warning:**

**NOTE:** We will be using MongoDB[®](#go-further) in the example API calls below. If you are using a different engine flavor, you must find the API calls for that specific service in the [OVHcloud API](https://api.us.ovhcloud.com/).

### Enable the Prometheus exporter for your service

You can enable a Prometheus exporter for your service using the API endpoint:

[PUT /cloud/project/{serviceName}/database/mongodb/{clusterId}](https://api.us.ovhcloud.com/console/?section=/cloud&branch=v1#put-/cloud/project/-serviceName-/database/mongodb/-clusterId-)

The boolean property `enablePrometheus` should be set to `true` to activate the Prometheus exporter for your service.

 

### Retrieve the Prometheus exporter access info

Use the following API endpoint to get the data needed to access the Prometheus exporter:

[GET /cloud/project/{serviceName}/database/mongodb/{clusterId}/prometheus](https://api.us.ovhcloud.com/console/?section=/cloud&branch=v1#get-/cloud/project/-serviceName-/database/mongodb/-clusterId-/prometheus)

You will also need to reset the credentials to obtain the password required for access:

[DELETE /cloud/project/{serviceName}/database/mongodb/{clusterId}/prometheus/credentials/reset](https://api.us.ovhcloud.com/console/?section=/cloud&branch=v1#delete-/cloud/project/-serviceName-/database/mongodb/-clusterId-/prometheus/credentials/reset)

 

### Configure your Prometheus server and start pulling metrics

Use the data from the previous state to configure your Prometheus server and start pulling metrics for your service. Here is an example of such a Prometheus configuration for a MongoDB® service:

```yaml
scrape_configs:
- job_name: mongo-metrics
  scrape_interval: 10s
  metrics_path: /metrics
  scheme : https
  basic_auth:
    username: prometheus
    password: "xxx"
  dns_sd_configs:
    - names:
      - '_prometheus._tcp.mongodb-7bfb5d40-oa85dff3e.database.cloud.ovh.us' 

```

The other engines use a slightly different format:

```yaml
scrape_configs:
- job_name: postgresql-metrics
  scrape_interval: 10s
  metrics_path: /metrics
  scheme : https
  basic_auth:
    username: prometheus
    password: "xxx"
  tls_config:
      insecure_skip_verify: true
  static_configs:
    - targets: 
        - postgresql-02d6a757-ovh-dev.database.cloud.ovh.us:9273
        - replica-postgresql-02d6a757-ovh-dev.database.cloud.ovh.us:9273

```

 

## Limitations

Cloud Databases and Analytics[\*](#go-further) offer service metrics via Prometheus for the following engines:

- Kafka®
- Kafka® Connect
- Kafka® MirrorMaker
- MongoDB®
- MySQL®
- OpenSearch™
- PostgreSQL®
- Valkey

Prometheus endpoints are subject to the same networking limitations as the associated service. Thus, IP restrictions apply, and for services using private networking, the Prometheus exporter endpoint is only reachable from the private network your service is attached to.

 

## Go further

Browse all the [Databases guides](https://docs.us.ovhcloud.com/en/public-cloud/databases/landing-page-databases.md).

Browse the rest of the [OVHcloud US documentation](https://docs.us.ovhcloud.com/en/index.md) for guides on our other products and services.

Learn more about [Managed Databases](https://us.ovhcloud.com/public-cloud/databases/) on the OVHcloud US website.

If you need training or technical assistance to implement our solutions, contact your sales representative or click on [this link](https://us.ovhcloud.com/support/professional-services/) to get a quote and ask our Professional Services experts for a custom analysis of your project.

OVHcloud Managed Databases and Analytics:

- Grafana® is a registered trademark of Grafana Labs and is used with the permission of Grafana Labs. OVH SAS and its subsidiaries are not affiliated with or endorsed by Grafana Labs.
- Kafka® is a registered trademark of The Apache Software Foundation and has been licensed for use by OVHcloud, who has no affiliation with and is not endorsed by The Apache Software Foundation.
- MongoDB® is a registered trademark of MongoDB, Inc.
- MySQL® is a registered trademark of Oracle and/or its affiliates.
- PostgreSQL® is a registered trademark of the PostgreSQL Community Association of Canada.
