Çok bulutlu izleme için Amazon CloudWatch ölçümlerini Managed Service for Prometheus hizmetine aktarmak üzere Yet Another CloudWatch Exporter (yace-exporter) kullanın.
Ön koşullar
Çalışma mantığı
Ölçüm toplama: yace-exporter, AWS API'leri aracılığıyla Amazon CloudWatch'tan EC2 CPU kullanımı ve disk G/Ç gibi ölçümleri düzenli olarak çeker.
Biçim dönüştürme: yace-exporter, AWS ölçümlerini standart Prometheus biçimine dönüştürür.
Uç nokta sunumu: yace-exporter, yapılandırılan HTTP bağlantı noktasında (varsayılan:
5000) bir/metricsuç noktası sunar. Managed Service for Prometheus, hizmet keşfi yoluyla bu uç noktayı tarar.
Yordam
Adım 1: yace-exporter'ı bir ACK kümesine dağıtın
yace-exporter, yüksek performanslı, maliyet açısından verimli ve topluluk tarafından geliştirilen bir CloudWatch ölçüm dışa aktarıcıdır.
1,1 values.yaml dosyasını indirin ve değiştirin
values.yaml dosyasını indirin.
Yapılandırma ayrıntıları:
# Configure the Prometheus scrape path and port.
podAnnotations: {
prometheus.io/path: /metrics,
prometheus.io/port: "5000",
prometheus.io/scrape: "true"
}
# Configure the AWS authentication method. Choose one of the following methods. The AccessKey pair method is recommended.
aws:
role:
# The name of a pre-created secret in which AWS credentials are stored. When
# set, aws_access_key_id is assumed to be in a field called access_key,
# aws_secret_access_key is assumed to be in a field called secret_key, and the
# session token, if it exists, is assumed to be in a field called
# security_token
secret:
name:
includesSessionToken: false
# Note: Do not specify the aws_access_key_id and aws_secret_access_key if you specified role or secret.name before
aws_access_key_id:
aws_secret_access_key:
# Configure the metrics to be collected from Amazon CloudWatch. To minimize costs, configure only the required products, metrics, and statistics. Amazon CloudWatch bills based on the number of requested metrics.
config: |-
apiVersion: v1alpha1
sts-region: us-west-1 # We recommend that you set the AWS authentication region to be the same as the region of your cloud service.
discovery:
jobs:
- type: AWS/EC2 # For the supported product namespaces, see https://github.com/prometheus-community/yet-another-cloudwatch-exporter.
regions:
- us-west-1 # The region where the cloud service resides.
searchTags: # Configure the tags of cloud service instances from which metrics are scraped into Prometheus.
- key: scrapedEnable
value: ^(ali)$
metrics: # Configure the list of metrics to collect. For information about the metrics supported by each cloud service in Amazon CloudWatch, see https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/aws-services-cloudwatch-metrics.html. The following code provides an example of how to collect several metrics for Amazon EC2. The configurations for other services are similar.
- name: CPUUtilization
statistics: # The aggregation method. Valid values are also listed in the AWS documentation: Average, Minimum, Maximum, and Sum.
- 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
1,2 Helm grafiğini yükleyin
En son Helm grafiğini indirin.
helm install -f values.yaml yace-exporter-cw ./prometheus-yet-another-cloudwatch-exporter-0.40.0.tgz -n aws-cloudwatch
Alternatif olarak, depoyu ekleyip grafiği doğrudan yükleyebilirsiniz:
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install -f values.yaml yace-exporter-cw prometheus-community/prometheus-yet-another-cloudwatch-exporter -n aws-cloudwatch
Adım 2: Managed Service for Prometheus hizmetinde otomatik toplamayı etkinleştirin
Managed Service for Prometheus konsolu üzerinde oturum açın. Sol gezinme bölmesinde Integration Management öğesine tıklayın.
Üst gezinme çubuğundan ACK kümenizin bulunduğu bölgeyi seçin. Container Service sekmesinde küme adınıza tıklayın.
-
Metric Scraping sekmesine tıklayın. Default Service Discovery sayfasında Enabled düğmesine tıklayın.
Bu özelliği etkinleştirdiğinizde yace-exporter ölçümleri otomatik olarak toplanır.
-
Toplama görevlerini görüntülemek için Self-Monitoring sekmesine tıklayın.
kubernetes-podsadlı bir toplama görevi otomatik olarak oluşturulur.updurumu, toplamanın aktif olduğunu doğrular.
Adım 3: Ölçümleri doğrulayın ve panolar ile uyarıları yapılandırın
Toplama yapılandırıldıktan sonra Metrics Explorer bölümünü açın ve Managed Service for Prometheus hizmetinin bu ölçümleri topladığını onaylamak için aws_ ön ekiyle başlayan ölçümleri arayın.
Panoları ve uyarıları yapılandırmak için Bulut Hizmeti Gözlemlenebilirliği konusundaki 3. ve 4. adımları uygulayın.