Navigation
You were redirected from a different version of the documentation. Click here to go back.

Return the Latest Targets for Prometheus

Note

Groups and projects are synonymous terms. Your {PROJECT-ID} is the same as your project id. For existing groups, your group/project id remains the same. This page uses the more familiar term group when referring to descriptions. The endpoint remains as stated in the document.

Base URL: https://cloud.mongodb.com/prometheus/v1.0

Syntax

GET /groups/{GROUP-ID}/discovery

Request Path Parameters

Parameter Necessity Description
{PROJECT-ID} Required Project identifier.

Request Query Parameters

This endpoint doesn’t use HTTP request query parameters.

Request Body Parameters

This endpoint doesn’t use HTTP request body parameters.

Response Elements

The response includes an array of your latest targets from which to scrape and a document containing their labels.

Name Type Description
targets array of objects Each host and port from which to scrape metrics.
labels document Document that contains the label and value that differentiates your metrics.

labels Embedded Document

Label Description
group_id Unique hexadecimal digit string that identifies the project.
group_name Human-readable label that identifies the project.
org_id Unique hexadecimal digit string that identifies the organization.

Example Request

curl --header 'Accept: application/json'
# Sets the `Authorization` header on every scrape request with the
# configured username and password.
--user prom_user_61e6e34e93eac1632d39f457:V7hTyLfkjwiWQbv
# The URL that Prometheus fetches the targets from.
--request GET "https://cloud.mongodb.com/prometheus/v1.0/groups/61e6e34e93eac1632d39f457/discovery"

Example Response

[
  {
      "targets":[
        "mongodbd-prometheus:9216"
      ],
      "labels":{
        "group_id":"61e6e34e93eac1632d39f457",
        "group_name":"CM-Testing",
        "org_id":"61e6e32093eac1632d39f447"
      }
  }
]