View a markdown version of this page

存取 Prometheus 指標 - Amazon MQ

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

存取 Prometheus 指標

注意

Prometheus 指標僅適用於 RabbitMQ 4.2 和更新版本。ActiveMQ 代理程式不支援 Prometheus 指標。

Amazon MQ 現在支援 Amazon MQ for RabbitMQ 代理程式的 Prometheus 指標。Prometheus 指標可讓您將中介裝置可觀測性整合至現有的監控基礎設施,讓您統一檢視中介裝置效能與其他 服務。使用 Prometheus 指標,您可以設定精細警示和儀表板,以主動偵測和回應簡訊工作負載中的問題。

從 RabbitMQ 4.2 開始,Amazon MQ for RabbitMQ 支援 Prometheus 指標,可讓您使用 Prometheus 監控系統來抓取代理程式指標。支援下列端點:

  • /metrics

  • /metrics/detailed

  • /metrics/memory-breakdown

不支援/metrics/per-object端點。

如需每個端點公開指標的詳細資訊,請參閱 RabbitMQ 文件中的 Prometheus 指標

Prometheus 指標與 CloudWatch 指標

Amazon MQ for RabbitMQ 透過 Prometheus 端點和 CloudWatch 公開指標。雖然兩者都提供代理程式運作狀態的可見性,但範圍和用量不同。

Prometheus 端點公開了一組更豐富的 RabbitMQ 代理程式運作狀態彙總指標,涵蓋更廣泛的代理程式內部,例如連線流失、頻道活動、佇列和交換統計資料,以及 Raft 共識指標。這些適用於與現有的 Prometheus 型監控基礎設施和精細警示整合。

CloudWatch 指標是從 Prometheus 端點取得的精選代理程式指標子集。如需可用 CloudWatch 指標的完整清單,請參閱 Amazon MQ for RabbitMQ 代理程式可用的 CloudWatch 指標

在 CloudWatch 中,指標一律會在視覺化前以至少 60 秒的間隔進行彙總。相反地,Prometheus 公開原始指標資料點,而 Grafana 之類的儀表板解決方案可視覺化個別資料點,預設不會彙總。因此,相同指標的視覺化可能會根據 CloudWatch 中使用的統計資料,在 CloudWatch 和 Prometheus 之間產生差異

注意

建議使用 Prometheus 對 Amazon MQ for RabbitMQ 操作指標進行非彙總監控。

取得和存取 Prometheus 端點

您可以使用 AWS 管理主控台 或 取得 Amazon MQ for RabbitMQ 代理程式的 Prometheus 端點 AWS CLI。

  • AWS 管理主控台 — 導覽至 Amazon MQ 主控台,開啟代理程式的詳細資訊頁面,然後在連線區段下找到 Prometheus 端點。

  • AWS CLI — 使用 describe-broker命令:

    aws mq describe-broker --broker-id <broker-id>

    Prometheus 端點會在 下的回應中傳回BrokerInstances.Endpoints

Amazon MQ for RabbitMQ Prometheus 支援使用與代理程式相同的身分驗證機制。如需支援的身分驗證方法的詳細資訊,請參閱 Amazon MQ for RabbitMQ 身分驗證和授權。若要了解如何在 Prometheus 中設定身分驗證,請參閱 Prometheus 文件中的 http_config

Prometheus 組態最佳實務

  • 設定 60 秒或更長的抓取期間。為了操作安全,建議這麼做。

抓取組態範例

下列各節提供 Amazon MQ for RabbitMQ 的範例 Prometheus 抓取組態。<broker-prometheus-endpoint> 將 取代為代理程式的 Prometheus 端點主機名稱,將 <username> 取代<password>為代理程式登入資料。

對於大多數使用案例,建議使用下列組態。擴展/metrics端點可提供有關整體叢集運作狀態的良好彙總指標,讓您清楚檢視代理程式效能,而無須額外負荷詳細的指標集合。

global: scrape_interval: 60s scrape_configs: - job_name: 'rabbitmq-aws-cluster' scheme: https basic_auth: username: <username> password: <password> metrics_path: '/metrics' static_configs: - targets: - '<broker-prometheus-endpoint>:16001' - '<broker-prometheus-endpoint>:16002' - '<broker-prometheus-endpoint>:16003'

詳細指標組態

下列組態會抓取其他詳細指標系列,以更深入地觀察特定代理程式元件。

global: scrape_interval: 60s scrape_configs: - job_name: 'rabbitmq-connection-churn' scheme: https basic_auth: username: <username> password: <password> metrics_path: '/metrics/detailed' params: family: ['connection_churn_metrics'] static_configs: - targets: - '<broker-prometheus-endpoint>:16001' - '<broker-prometheus-endpoint>:16002' - '<broker-prometheus-endpoint>:16003' - job_name: 'rabbitmq-ra' scheme: https basic_auth: username: <username> password: <password> metrics_path: '/metrics/detailed' params: family: ['ra_metrics'] static_configs: - targets: - '<broker-prometheus-endpoint>:16001' - '<broker-prometheus-endpoint>:16002' - '<broker-prometheus-endpoint>:16003' - job_name: 'rabbitmq-queue' scheme: https basic_auth: username: <username> password: <password> metrics_path: '/metrics/detailed' params: family: ['queue_metrics'] static_configs: - targets: - '<broker-prometheus-endpoint>:16001' - '<broker-prometheus-endpoint>:16002' - '<broker-prometheus-endpoint>:16003' - job_name: 'rabbitmq-exchange' scheme: https basic_auth: username: <username> password: <password> metrics_path: '/metrics/detailed' params: family: ['exchange_metrics'] static_configs: - targets: - '<broker-prometheus-endpoint>:16001' - '<broker-prometheus-endpoint>:16002' - '<broker-prometheus-endpoint>:16003' - job_name: 'rabbitmq-connection' scheme: https basic_auth: username: <username> password: <password> metrics_path: '/metrics/detailed' params: family: ['connection_metrics'] static_configs: - targets: - '<broker-prometheus-endpoint>:16001' - '<broker-prometheus-endpoint>:16002' - '<broker-prometheus-endpoint>:16003' - job_name: 'rabbitmq-channel' scheme: https basic_auth: username: <username> password: <password> metrics_path: '/metrics/detailed' params: family: ['channel_metrics'] static_configs: - targets: - '<broker-prometheus-endpoint>:16001' - '<broker-prometheus-endpoint>:16002' - '<broker-prometheus-endpoint>:16003' - job_name: 'rabbitmq-exchange-count' scheme: https basic_auth: username: <username> password: <password> metrics_path: '/metrics/detailed' params: family: ['exchange_names'] static_configs: - targets: - '<broker-prometheus-endpoint>:16001' - '<broker-prometheus-endpoint>:16002' - '<broker-prometheus-endpoint>:16003'