All Products
Search
Document Center

Managed Service for Prometheus:ListEnvironmentMetricTargets

Last Updated:Aug 28, 2026

Queries the metric scrape targets in a Managed Service for Prometheus environment.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

EnvironmentId

string

Yes

The environment ID.

env-xxx

RegionId

string

No

The region ID.

cn-hangzhou

JobName

string

No

The job name.

blackbox

Response elements

Element

Type

Description

Example

object

response

RequestId

string

The request ID.

16AF921B-8187-489F-9913-43C808B4****

Code

integer

The HTTP status code. A value of 200 indicates a successful request.

200

Message

string

The returned message.

success

Success

boolean

Indicates whether the request was successful. Valid values:

  • true

  • false

true

Data

object

The response data.

ActiveTargets

array<object>

The active targets.

array<object>

The target information.

DiscoveredLabels

object

The labels discovered during service discovery.

string

The tag value.

{ "__meta_kubernetes_pod_label_pod_template_hash": "7477c58b8d", "__meta_kubernetes_endpoints_name": "mysql-exporter-mysql-1694448841945-service", "__meta_kubernetes_endpoint_port_name": "metrics" }

GlobalUrl

string

The target URL.

http://xxx

Health

string

The health status.

up

Labels

object

The labels attached to the target after relabeling.

string

The tag value.

{ "endpoint": "metrics", "instance": "172.16.0.9:9104", "pod": "mysql-1694570927659-7655486df8-djg22", "service": "mysql-exporter-mysql-1694570927659-service", "namespace": "arms-prom", "job": "mysql-exporter-mysql-1694570927659-service" }

LastError

string

The last error message.

Get \"http://172.16.0.86:9104/metrics\": dial tcp 172.16.0.86:9104: connect: connection refused

LastScrape

string

The timestamp of the last scrape.

2023-10-12T07:15:47.306691514Z

LastScrapeDuration

number

The duration of the last scrape, in seconds.

0.00127593

LastScrapeSeries

integer

The number of time series returned in the last scrape.

122

ScrapePool

string

The scrape pool name.

arms-prom/mysql-exporter-mysql-1694429267986-sm/0"

ScrapeUrl

string

The scrape URL.

http://xxxx

DroppedTargets

array<object>

The dropped targets.

array<object>

The target information.

DiscoveredLabels

object

The labels discovered during service discovery.

string

The tag value.

{ "__meta_kubernetes_pod_label_pod_template_hash": "7477c58b8d", "__meta_kubernetes_endpoints_name": "mysql-exporter-mysql-1694448841945-service", "__meta_kubernetes_endpoint_port_name": "metrics" }

GlobalUrl

string

The target URL.

http://xxx

Health

string

The health status.

up

Labels

object

The labels attached to the target after relabeling.

string

The tag value.

{ "endpoint": "metrics", "instance": "172.16.0.9:9104", "pod": "mysql-1694570927659-7655486df8-djg22", "service": "mysql-exporter-mysql-1694570927659-service", "namespace": "arms-prom", "job": "mysql-exporter-mysql-1694570927659-service" }

LastError

string

The last error message.

Get \"http://172.16.0.86:9104/metrics\": dial tcp 172.16.0.86:9104: connect: connection refused

LastScrape

string

The timestamp of the last scrape.

2023-10-12T07:15:47.306691514Z

LastScrapeDuration

number

The duration of the last scrape, in seconds.

0.00127593

LastScrapeSeries

integer

The number of time series returned in the last scrape.

122

ScrapePool

string

The scrape pool name.

arms-prom/mysql-exporter-mysql-1694429267986-sm/0"

ScrapeUrl

string

The scrape URL.

http://xxxx

Examples

Success response

JSON format

{
  "RequestId": "16AF921B-8187-489F-9913-43C808B4****",
  "Code": 200,
  "Message": "success",
  "Success": true,
  "Data": {
    "ActiveTargets": [
      {
        "DiscoveredLabels": {
          "key": "{\n            \"__meta_kubernetes_pod_label_pod_template_hash\": \"7477c58b8d\",\n            \"__meta_kubernetes_endpoints_name\": \"mysql-exporter-mysql-1694448841945-service\",\n            \"__meta_kubernetes_endpoint_port_name\": \"metrics\"\n}"
        },
        "GlobalUrl": "http://xxx",
        "Health": "up",
        "Labels": {
          "key": "{\n            \"endpoint\": \"metrics\",\n            \"instance\": \"172.16.0.9:9104\",\n            \"pod\": \"mysql-1694570927659-7655486df8-djg22\",\n            \"service\": \"mysql-exporter-mysql-1694570927659-service\",\n            \"namespace\": \"arms-prom\",\n            \"job\": \"mysql-exporter-mysql-1694570927659-service\"\n          }"
        },
        "LastError": "Get \\\"http://172.16.0.86:9104/metrics\\\": dial tcp 172.16.0.86:9104: connect: connection refused",
        "LastScrape": "2023-10-12T07:15:47.306691514Z",
        "LastScrapeDuration": 0.00127593,
        "LastScrapeSeries": 122,
        "ScrapePool": "arms-prom/mysql-exporter-mysql-1694429267986-sm/0\"",
        "ScrapeUrl": "http://xxxx"
      }
    ],
    "DroppedTargets": [
      {
        "DiscoveredLabels": {
          "key": "{\n            \"__meta_kubernetes_pod_label_pod_template_hash\": \"7477c58b8d\",\n            \"__meta_kubernetes_endpoints_name\": \"mysql-exporter-mysql-1694448841945-service\",\n            \"__meta_kubernetes_endpoint_port_name\": \"metrics\"\n}"
        },
        "GlobalUrl": "http://xxx",
        "Health": "up",
        "Labels": {
          "key": "{\n            \"endpoint\": \"metrics\",\n            \"instance\": \"172.16.0.9:9104\",\n            \"pod\": \"mysql-1694570927659-7655486df8-djg22\",\n            \"service\": \"mysql-exporter-mysql-1694570927659-service\",\n            \"namespace\": \"arms-prom\",\n            \"job\": \"mysql-exporter-mysql-1694570927659-service\"\n          }"
        },
        "LastError": "Get \\\"http://172.16.0.86:9104/metrics\\\": dial tcp 172.16.0.86:9104: connect: connection refused",
        "LastScrape": "2023-10-12T07:15:47.306691514Z",
        "LastScrapeDuration": 0.00127593,
        "LastScrapeSeries": 122,
        "ScrapePool": "arms-prom/mysql-exporter-mysql-1694429267986-sm/0\"",
        "ScrapeUrl": "http://xxxx"
      }
    ]
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.