All Products
Search
Document Center

Application Real-Time Monitoring Service:CreatePrometheusMonitoring

Last Updated:Aug 28, 2026

Creates a monitoring configuration for a Prometheus instance.

Note

This API has been deprecated with no replacement. While temporary access is maintained, no further updates or bug fixes will be provided. To ensure continued functionality, plan your migration and contact your account manager for support.

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

RegionId

string

Yes

The region ID.

cn-hangzhou

ClusterId

string

Yes

The ID of the Prometheus instance.

cc7a37ee31aea4ed1a059eff8034b****

Type

string

Yes

The type of monitoring configuration. Valid values for Prometheus instances for Container Service: serviceMonitor, podMonitor, customJob, and probe. Valid values for Prometheus instances for ECS: customJob and probe.

serviceMonitor

Status

string

No

The status of the monitoring configuration. Valid values: run and stop. Default value: run. Not applicable when Type is set to Probe.

run

ConfigYaml

string

Yes

The monitoring configuration. Specify a YAML string.

See the request parameter examples below.

ServiceMonitor example:

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: tomcat-demo
  namespace: default
spec:
  endpoints:
    - interval: 30s
      path: /metrics
      port: tomcat-monitor
  namespaceSelector:
    any: true
  selector:
    matchLabels:
      app: tomcat

PodMonitor example:

apiVersion: "monitoring.coreos.com/v1"
kind: "PodMonitor"
metadata:
  name: "podmonitor-demo"
  namespace: "default"
spec:
  namespaceSelector:
    any: true
  podMetricsEndpoints:
    - interval: "30s"
      path: "/metrics"
      port: "tomcat-monitor"
  selector:
    matchLabels:
      app: "nginx2-exporter"

CustomJob example:

scrape_configs:
  - job_name: prometheus1
    honor_timestamps: false
    honor_labels: false
    scheme: http
    metrics_path: /metric
    static_configs:
      - targets:
          - 127.0.0.1:9090

Probe example:

apiVersion: monitoring.coreos.com/v1
kind: Probe
metadata:
  name: name1-tcp-blackbox #Rule: xxx-{tcp/http/ping}-blackbox
  namespace: arms-prom # Optional.
spec:
  interval: 30s
  jobName: blackbox
  module: tcp_connect
  prober:
    path: /blackbox/probe
    scheme: http
    url: 'localhost:9335'
  targets:
    staticConfig:
      static:
        - 'arms-prom-admin.arms-prom:9335'

Response elements

Element

Type

Description

Example

object

The response structure.

RequestId

string

The request ID.

21E85B16-75A6-429A-9F65-8AAC9A54****

Code

integer

The HTTP status code. 200 indicates success.

200

Data

string

The name of the created monitoring configuration, or error details.

name1

Message

string

The returned message.

message

Examples

Success response

JSON format

{
  "RequestId": "21E85B16-75A6-429A-9F65-8AAC9A54****",
  "Code": 200,
  "Data": "name1",
  "Message": "message"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.