All Products
Search
Document Center

Application Real-Time Monitoring Service:Collect custom metrics with a ServiceMonitor

Last Updated:Sep 08, 2026

Configure a ServiceMonitor to automatically scrape monitoring metrics from Pods of a specified Service in a container cluster.

Limitations

Only container clusters are supported.

Billing

  • Billing

  • If your cluster has an open-source Prometheus service with ServiceMonitor configurations, after you connect it to Managed Service for Prometheus, Managed Service for Prometheus inherits those configurations and incurs ServiceMonitor-related charges. For billing information, see Billing.

Prerequisites

  • You have created a container cluster. For more information, see Create an ACK managed cluster.

  • You have created a Service for Pods that expose monitoring metrics on the ports defined in the Service. For more information, see Service management.

Procedure

  1. Log on to the ARMS console.

  2. In the navigation pane on the left, click Integration Management.

  3. On the Integrated Environments tab, find the target environment in the Container Environment list. Click Metric Scraping in the Actions column to open the Metric Scraping page.

  4. On the Metric Scraping page, click the ServiceMonitor tab.

Enable the feature

On the ServiceMonitor page, click Enable Feature. Once enabled, you can view all ServiceMonitors and their configurations within the current container cluster. ARMS then scrapes monitoring metrics at the configured interval and path.

Note

This feature is enabled by default.

In the Actions column of the target ServiceMonitor, click Enable.

Manage ServiceMonitors

Add ServiceMonitor

On the ServiceMonitor page, click Create. In the Add ServiceMonitor Configuration panel, configure the required information, and then click Create .

Quick edit

Select the Namespace, Service, and Port for the container cluster. Then, configure the Metric Path and Collection Interval (in seconds). Click Check. If the configuration is valid, click Create .

YAML

Enter a YAML configuration that conforms to the Prometheus ServiceMonitor specification. Then click Check. If the configuration is valid, click Create .

In the sample YAML configuration, apiVersion is monitoring.coreos.com/v1, and kind is ServiceMonitor. The metadata.annotations section must include arms.prometheus.io/discovery: 'true' to enable service discovery. In the spec.endpoints section, configure scraping parameters such as interval: 15s, port: operator, and path: /metrics. You must also configure the namespaceSelector and selector fields.

Edit ServiceMonitor

In the ServiceMonitor list, click Edit Configuration in the Operation column of the target ServiceMonitor. In the Edit ServiceMonitor Configuration panel, modify the YAML content.

Delete ServiceMonitor

In the ServiceMonitor list, click Delete in the Operation column of the target ServiceMonitor.

Disable ServiceMonitor

In the ServiceMonitor list, click Disable in the Operation column of the target ServiceMonitor. Once disabled, the ServiceMonitor configuration no longer takes effect.

Disable feature

On the ServiceMonitor page, click Disable Feature. Once disabled, Prometheus no longer discovers new targets based on ServiceMonitor configurations. However, scraping continues for previously discovered targets.