

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# Prometheus 在亚马逊 EKS 上进行监控
<a name="prometheus-monitoring-eks"></a>

[适用于 Prometheus 的亚马逊托管服务为](https://docs.aws.amazon.com//prometheus/latest/userguide/what-is-Amazon-Managed-Service-Prometheus.html)开源 Prometheus 提供可扩展、安全的 AWS 托管服务。您可以使用 Prometheus 查询语言 (PromQL) 监控容器化工作负载的性能，而无需管理用于接收、存储和查询运营指标的底层基础架构。你可以[使用 OpenTelemetry Distro for (ADOT](https://docs.aws.amazon.com//prometheus/latest/userguide/AMP-onboard-ingest-metrics-OpenTelemetry.html)) 或 Prometheus 服务器作为收集代理，从亚马逊 EKS 和 Amazon ECS AWS 收集 Prometheus 指标。

[CloudWatch Prometheus 的 Container Insights 监控](https://docs.aws.amazon.com//AmazonCloudWatch/latest/monitoring/ContainerInsights-Prometheus.html)使您能够配置和使用 CloudWatch 代理来发现 Amazon ECS、Amazon EKS 和 Kubernetes 工作负载中的 Prometheus 指标，并将其作为指标摄取。 CloudWatch如果这是您的主要可观测性和监控解决方案，则此解决方案 CloudWatch 是合适的。但是，以下列表概述了适用于 Prometheus 的亚马逊托管服务为提取、存储和查询 Prometheus 指标提供了更大的灵活性的用例：
+ 亚马逊 Prometheus 托管服务使您能够使用部署在亚马逊 EKS 或自行管理的 Kubernetes 中的现有 Prometheus 服务器，并将其配置为写入适用于 Prometheus 的亚马逊托管服务，而不是本地配置的数据存储。这消除了为 Prometheus 服务器及其基础架构管理高可用性数据存储所带来的无差别繁重的工作。如果您想在云端使用成熟的 Prometheus 部署，那么适用于 Prometheus 的亚马逊托管服务是一个不错的选择。 AWS 
+ Grafana 直接支持 Prometheus 作为可视化的数据源。如果您想使用带有 Prometheus 的 Grafana 而不是控制面板来监控容器，那么适用于 Prometheus CloudWatch 的亚马逊托管服务可以满足您的要求。适用于 Prometheus 的亚马逊托管服务与 Amazon Managed Grafana 集成，提供托管式开源监控和可视化解决方案。
+ Prometheus 使您能够使用 PromQL 查询对运营指标进行分析。相比之下，[ CloudWatch 代理会将嵌入指标格式 CloudWatch 的 Prometheus 指标提取到日志中，从而生成指标](https://docs.aws.amazon.com//AmazonCloudWatch/latest/monitoring/ContainerInsights-Prometheus-Setup-configure-ECS.html#ContainerInsights-Prometheus-Setup-cw-agent-config)。 CloudWatch 您可以使用 Logs Insights 查询嵌入式指标格式 CloudWatch 日志。
+ 如果您不打算 CloudWatch 用于监控和指标捕获，则应将适用于 Prometheus 的亚马逊托管服务与 Prometheus 服务器和 Grafana 等可视化解决方案一起使用。[您需要将 Prometheus 服务器配置为从 Prometheus 目标中获取指标，并将服务器配置为远程写入适用于 Prometheus 的亚马逊托管服务工作空间。](https://docs.aws.amazon.com//prometheus/latest/userguide/AMP-onboard-ingest-metrics-existing-Prometheus.html)如果您使用亚马逊托管 Grafana，则可以使用随附的插件[将亚马逊托管 Grafana 与适用于 Prometheus 的亚马逊托管服务数据源直接集成](https://docs.aws.amazon.com//grafana/latest/userguide/prometheus-data-source.html)。由于指标数据存储在适用于 Prometheus 的 Amazon 托管服务中，因此无需部署 CloudWatch 代理，也不需要将数据采集到其中。 CloudWatchPrometheus 的 Container Insights 监控需要该 CloudWatch 代理。

您还可以使用 ADOT 收集器从装有 Prometheus 工具的应用程序中提取指标，然后将指标发送到适用于 Prometheus 的亚马逊托管服务。有关 ADOT Collector 的更多信息，请参阅[AWS 发行版中的文档。 OpenTelemetry](https://aws.amazon.com/otel/)