Collect metrics at scale from applications, open source middleware, hosts, processes, and GPU computing power on ECS instances by using managed Prometheus collectors in Cloud Monitor 2.0.
Scope
-
You have activated Managed Service for Prometheus.
-
You have applications or middleware that run on ECS and provide a Prometheus metrics interface. Ensure that the relevant ports in the security group are open to the current VPC CIDR block. If your application metrics are not yet defined, you can integrate a Prometheus SDK to define them.
-
You can also collect metrics from applications on non-ECS machines in the same VPC. Ensure that the machines are reachable over the network.
-
If your target application is accessible only through the public network, select a VPC that supports public network access. In the security group that is generated for the agent, you must also configure an outbound policy for the public CIDR block.
Procedure
Quick method
-
Go to the Cloud Monitor 2.0 console. Select the workspace in your target region.
-
In the left-side navigation pane, choose Integration Center. Search for and select "Prometheus Custom Metric Collection". For Runtime Environment Type, select ECS(VPC).
-
Select an integration policy and observation objects. Then, click OK to go to the collection configuration page.
-
Select a service discovery method: static addresses for fixed targets, or automatic discovery to find targets dynamically by ECS tags, instance IDs, or IP CIDR blocks. The internal IP address and configured service port of each ECS instance form the target address. Additional parameters:
-
Automatically Configure Security Group: Available only in automatic discovery mode. When a target ECS instance is discovered, a security group policy is automatically configured for the inbound service port.
-
Metric Collection Path: The HTTP path that exposes Prometheus-format metrics. Default: /metrics.
-
Collection Interval (s): The interval at which metrics are collected.
-
Use Source Metric Timestamp: Uses the generation time as the metric timestamp instead of the default collection time.
-
Prioritize Source Label: When labels from the collection configuration conflict with the original metric labels, the source label takes precedence.
-
Custom ECS Tag Injection: Injects ECS instance tags into metric labels. Specify the tag keys to inject, separated by commas (
,).
-
-
After you confirm the integration, a managed Prometheus collector and corresponding storage are automatically installed based on the VPC. By default, metrics are written to the shared Prometheus instance in the region.
Custom method
The custom method lets you install Prometheus collectors and select custom Prometheus instances, supporting multiple collectors and instances in a single VPC. Use this method in the following scenarios:
-
You need to plan your Prometheus storage instances.
-
The number of applications in a single VPC exceeds the maximum limit for a single collector cluster. A single collector cluster cannot have more than 20,000 collection targets.
Follow these steps:
-
Go to the Cloud Monitor 2.0 console. Select the workspace in your target region.
-
In the left-side navigation pane, choose Integration Center. Search for "Prometheus agent". For Runtime Environment Type, select ECS(VPC).
-
Select an integration policy and observation objects. Then, click OK to go to the collection configuration page.
-
On the integration configuration page, set Storage Mode to Custom Storage and select the Prometheus instance that you want to use. Then, confirm the installation.
-
After the installation is complete, follow the Quick method section to complete the integration configuration. The integration policy must match the one you selected for the Prometheus agent.