By configuring ServiceMonitor, you can collect metrics exposed at the specified pod in a Container Service for Kubernetes (ACK) cluster. This way, you can use Alibaba Cloud Managed Service for Prometheus to monitor the ACK cluster in a flexible, automated, and efficient manner.
Limits
You can configure ServiceMonitor to collect metrics only of ACK clusters.
Billing
The ServiceMonitor feature incurs fees. For more information, see Billing.
Prerequisites
An ACK cluster is created. For more information, see Create an ACK managed cluster.
A service is created for the pod in the ACK cluster, and the metrics are exposed. For more information, see Getting started.
Procedure
Log on to the Managed Service for Prometheus console.
In the left-side navigation pane, click Integration Management.
On the Integrated Environments tab, view the environment list on the Container Service tab. Find the ACK environment instance and click Metric Scraping in the Actions column. The Metric Scraping tab appears.
On the Metric Scraping tab, click Service Monitor.
Enable the ServiceMonitor feature
On the Service Monitor tab, click Enabled. Then, you can view all ServiceMonitor configurations and details in the ACK cluster. ARMS captures metrics based on the path of the pod at the specified time interval.
ServiceMonitor is disabled by default.
Manage ServiceMonitor configurations
Add a ServiceMonitor configuration
On the ServiceMonitor tab, click Create. In the Add ServiceMonitor Configuration panel, specify the ServiceMonitor configuration and click Create.
Quick Start
Specify the Namespace, Service, Port, Metric Path, and Collection Interval parameters, and then click Check. If the parameter values are valid, you can click Create to create a ServiceMonitor configuration.
YAML
Specify a YAML file to create a ServiceMonitor configuration. Click Check to check whether the configuration is valid. Then, click Create.
Modify a ServiceMonitor configuration
On the ServiceMonitor tab, find the ServiceMonitor configuration and click Edit in the Actions column. In the Edit Service Monitor Configuration panel, modify the YAML file.
Delete a ServiceMonitor configuration
On the ServiceMonitor tab, find the ServiceMonitor configuration and click Delete in the Actions column.
Disable a ServiceMonitor configuration
On the ServiceMonitor tab, find the ServiceMonitor configuration and click Disable in the Actions column. After the configuration is disabled, it loses effectiveness.
Disable the ServiceMonitor feature
On the Service Monitor tab, click Feature Disabled. After the ServiceMonitor feature is disabled, Prometheus does not detect or collect metrics exposed at the pod, though targets that are being collected continue to be collected.