View a markdown version of this page

整合 Amazon OpenSearch Service - Amazon CloudWatch

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

整合 Amazon OpenSearch Service

使用 Amazon CloudWatch 受管 Prometheus 收集器,您可以從 Amazon OpenSearch Service 網域自動收集Prometheus與 相容的指標。受管收集器會連線至您的 VPC、從網域收集叢集、節點和索引指標,並將這些指標直接交付至 CloudWatch。透過此整合,您可以監控 CloudWatch 中網域的運作狀態和效能,而無需部署任何代理程式或匯出程式。

注意

當 Amazon CloudWatch 受管 Prometheus 收集器將您的 Amazon OpenSearch Service 指標交付至 CloudWatch 時,它會自動使用識別其原始伺服器的屬性來充實每個指標。每個指標都攜帶收集器的檢測範圍、記錄 AWS 帳戶和區域的雲端屬性,以及收集器從指標名稱推斷的單位。當您使用 PromQL 查詢指標時,可以篩選和分組這些屬性。

先決條件

此程序假設您熟悉 Amazon OpenSearch Service 網域管理和 Amazon VPC 聯網概念。

  • 具有 VPC 存取的 Amazon OpenSearch Service 網域。受管收集器僅支援具有 VPC 存取權的網域。不支援具有公有存取權的網域。

  • 不同可用區域中至少有兩個子網路

  • 允許收集器透過 HTTPS (連接埠 443) 到達網域端點的安全群組規則。將傳入規則新增至網域的安全群組,以允許來自您為收集器提供之安全群組的 HTTPS 流量。

步驟 1:設定湊集組態

以下是 Amazon OpenSearch Service 的抓取組態範例。受管收集器會連線至您指定的網域,並自動收集其指標,因此您不會在組態中指定湊集目標。組態必須包含任務剛好job_name為 的scrape_configs區段opensearch-exporter。在下一個步驟中建立抓取器時,您會參考此組態。如需組態選項的詳細資訊,請參閱 湊集器組態

global: external_labels: domain_name: my-opensearch-domain scrape_configs: - job_name: opensearch-exporter scrape_interval: 60s

步驟 2:建立抓取器

使用 CloudWatch 目的地建立抓取器。您可以在 exporters 欄位中指定要從 收集的網域,並在 source 欄位中提供聯網 (子網路和安全群組)。

AWS API

使用 CreateScraper API 操作建立具有 CloudWatch 目的地的抓取器。將子網路、安全群組、網域和資料集資訊取代為您自己的值。

POST /scrapers HTTP/1.1 { "alias": "opensearch-metrics-scraper", "source": { "vpcConfiguration": { "subnetIds": ["subnet-subnet-id-1", "subnet-subnet-id-2"], "securityGroupIds": ["sg-security-group-id"] } }, "exporters": [ { "openSearchConfiguration": { "domainArn": "arn:aws:es:us-west-2:123456789012:domain/my-opensearch-domain" } } ], "destination": { "cloudWatchConfiguration": { "datasetArn": "arn:aws:cloudwatch:us-west-2:123456789012:dataset/default" } }, "scrapeConfiguration": { "configurationBlob": "base64-encoded-blob" } }
AWS CLI

使用 create-scraper命令建立具有 CloudWatch 目的地的抓取器。將子網路、安全群組、網域和資料集資訊取代為您自己的值。

aws amp create-scraper \ --alias "opensearch-metrics-scraper" \ --source '{ "vpcConfiguration": { "subnetIds": ["subnet-subnet-id-1", "subnet-subnet-id-2"], "securityGroupIds": ["sg-security-group-id"] } }' \ --exporters '[ { "openSearchConfiguration": { "domainArn": "arn:aws:es:us-west-2:123456789012:domain/my-opensearch-domain" } } ]' \ --scrape-configuration configurationBlob=$(base64 -w 0 opensearch-config.yaml) \ --destination '{ "cloudWatchConfiguration": { "datasetArn": "arn:aws:cloudwatch:us-west-2:123456789012:dataset/default" } }'

可用的指標

  • 叢集指標 — 叢集運作狀態和狀態、節點和資料節點的數量、作用中和重新放置碎片,以及待定任務。

  • 節點指標 — 每個節點的 CPU 用量、JVM 堆積用量和垃圾回收、作業系統記憶體、磁碟用量和執行緒集區活動。

  • 索引指標 — 索引和搜尋率和延遲、文件計數、合併和重新整理活動,以及快取用量。

如需可用指標的完整清單,請參閱《Amazon Managed Service for Prometheus 使用者指南》中的從 Amazon OpenSearch Service 收集的指標

驗證指標集合

若要確認收集器正在從您的網域交付指標,請使用 Query Studio 在 CloudWatch 中執行下列查詢。 https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-PromQL-QueryStudio.html查詢會傳回網域的叢集運作狀態。如果傳回資料點,則收集器會從網域成功收集指標。

opensearch_cluster_health_status

跨帳戶可觀測性

對於跨帳戶 Amazon OpenSearch Service 監控,我們建議您使用 Amazon CloudWatch 指標集中。如需詳細資訊,請參閱 CloudWatch 指標集中。

如需使用角色鏈結替代跨帳戶湊集器組態的詳細資訊,請參閱《Amazon Managed Service for Prometheus 使用者指南》中的整合 Amazon OpenSearch Service。

目前的限制

  • 受管收集器僅支援具有 VPC 存取的網域。

  • 抓取器會從單一 Amazon OpenSearch Service 網域收集指標。若要從多個網域收集指標,請為每個網域建立個別的抓取器。