This solution integrates Yet Another CloudWatch Exporter (YACE), a community-developed, high-performance Amazon CloudWatch exporter optimized for lightweight metric scraping, with Managed Service for Prometheus ingesting Amazon CloudWatch metrics for cross-cloud monitoring.
Solution
Metric scraping: YACE periodically pulls metric data, such as CPU utilization and disk I/O of Amazon Elastic Compute Cloud (Amazon EC2), from CloudWatch through AWS APIs.
Format conversion: It transforms CloudWatch metrics into Prometheus-compatible format for seamless integration.
Endpoint exposure: A
/metrics
endpoint is exposed via HTTP (default port: 5000), enabling automated metric scraping by Alibaba Cloud Managed Service for Prometheus through service discovery.
Prerequisites
Procedure
Step 1: Deploy YACE in an ACK cluster
1. Download and modify the values.yaml
configuration file.
Example:
# Configure the scrape path and port of Managed Service for Prometheus.
podAnnotations: {
prometheus.io/path: /metrics,
prometheus.io/port: "5000",
prometheus.io/scrape: "true"
}
# Choose one of the following methods for AWS authentication. An AccessKey ID (AK)/AccessKey secret (SK) is recommended.
aws:
role:
# The name of a secret you prepared for storing AWS credentials. When it's
# set, aws_access_key_id is stored in the access_key field,
# aws_secret_access_key in the secret_key field, and the
# session token, if any, in the security_token field.
secret:
name:
includesSessionToken: false
# Note: Do not specify aws_access_key_id and aws_secret_access_key if you configured the role or secret name.
aws_access_key_id:
aws_secret_access_key:
# The following lists the parameters for collecting CloudWatch metrics. Configure only the required products, metrics, and statistical operators. Amazon CloudWatch charges by the number of metric requests.
config: |-
apiVersion: v1alpha1
sts-region: us-west-1 # The AWS authentication region, which must be consistent with the region of the cloud product.
discovery:
jobs:
- type: AWS/EC2 # The supported product namespace. For more information, see https://github.com/prometheus-community/yet-another-cloudwatch-exporter.
regions:
- us-west-1 # The region of the cloud product.
searchTags: # The tag of the cloud product instances written to Managed Service for Prometheus.
- key: scrapedEnable
value: ^(ali)$
metrics: # The list of metrics to scrape. For information about which AWS services publish metrics to CloudWatch, see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/aws-services-cloudwatch-metrics.html. The following example collects EC2 metrics. Set the parameters for other products similarly.
- name: CPUUtilization
statistics: # The statistics aggregation method, also listed in AWS documentation.
- Average
- Minimum
- Maximum
period: 60
length: 600
- name: DiskReadOps
statistics:
- Sum
- Average
- Minimum
- Maximum
period: 60
length: 600
- name: DiskWriteOps
statistics:
- Sum
- Average
- Minimum
- Maximum
period: 60
length: 600
- name: DiskReadBytes
statistics:
- Sum
- Average
- Minimum
- Maximum
period: 60
length: 600
2. Download and install the latest version of the Helm application:
helm install -f values.yaml yace-exporter-cw ./prometheus-yet-another-cloudwatch-exporter-0.40.0.tgz -n aws-cloudwatch
Or install it by pulling the image online:
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install -f values.yaml yane-exporter-cw prometheus-community/prometheus-yet-another-cloudwatch-exporter -n aws-cloudwatch
Step 2: Automatically collect metric data in Managed Service for Prometheus
Log on to the ARMS console. In the left-side navigation pane, click Integration Management.
In the upper part of the page, select the region where the ACK cluster is located. On the Container Service tab, click the target environment name.
On the page that appears, click the Metric Scraping tab. Then, on the Default Service Discovery tab, click Enabled on the right.
After this feature is enabled, the system scrapes YACE metrics by default.
Click the Self-Monitoring tab to view the scraping task named
kubernetes-pods
automatically created.The
up
state indicates that metric scraping is configured.
Step 3: Validate metrics
Click the Metrics Explorer tab. Then, check if metrics starting with aws_
are available.
Related steps
To configure alerts and dashboards, follow steps 3 and 4 in Monitor an Alibaba Cloud service.