

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

# 使用適用於 Amazon RDS 的 Performance Insights API 來擷取指標
<a name="USER_PerfInsights.API"></a>

在啟用 Performance Insights 時，API 會提供對執行個體效能的可見性。Amazon CloudWatch Logs 提供用於 AWS 服務之販售監控指標的授權來源。

績效詳情提供以平均作用中工作階段 (AAS) 評估的資料庫負載特定網域檢視。此指標在 API 消費者看來是二維時間序列資料集。資料的時間維度提供查詢的時間範圍內各時間點的資料庫負載資料。每個時間點會根據請求的維度來分解整體負載，例如 `SQL`、`Wait-event`、`User`、或者 `Host`，在該時間點所測得。

Amazon RDS 績效詳情會監控您的 Amazon RDS 資料庫執行個體，讓您可分析資料庫效能並對其進行故障診斷。檢視績效詳情資料的一個方法就是使用 AWS 管理主控台。績效詳情也提供公有 API，讓您可以查詢自己的資料。您可以使用 API 執行下列動作：
+ 將資料卸載至資料庫
+ 將績效詳情資料新增至現有監控儀表板
+ 建置監控工具

若要使用績效詳情 API，請在其中一個 Amazon RDS 資料庫執行個體上啟用績效詳情。如需啟用績效詳情的相關資訊，請參閱 [開啟和關閉 Amazon RDS 的 Performance Insights](USER_PerfInsights.Enabling.md)。如需績效詳情 API 的相關詳細資訊，請參閱 [Amazon RDS 績效詳情 API 參考](https://docs.aws.amazon.com/performance-insights/latest/APIReference/Welcome.html)。

績效詳情 API 提供下列操作。


****  

|  績效詳情動作  |  AWS CLI 命令  |  Description  | 
| --- | --- | --- | 
| [https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_CreatePerformanceAnalysisReport.html](https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_CreatePerformanceAnalysisReport.html) | [https://docs.aws.amazon.com/cli/latest/reference/pi/CreatePerformanceAnalysisReport.html](https://docs.aws.amazon.com/cli/latest/reference/pi/CreatePerformanceAnalysisReport.html) | 針對資料庫執行個體的特定時間區間建立績效分析報告。結果是 `AnalysisReportId`，也是報告的唯一識別符。 | 
| [https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_DeletePerformanceAnalysisReport.html](https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_DeletePerformanceAnalysisReport.html) | [https://docs.aws.amazon.com/cli/latest/reference/pi/DeletePerformanceAnalysisReport.html](https://docs.aws.amazon.com/cli/latest/reference/pi/DeletePerformanceAnalysisReport.html) | 刪除績效分析報告。 | 
| [https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_DescribeDimensionKeys.html](https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_DescribeDimensionKeys.html) | [https://docs.aws.amazon.com/cli/latest/reference/pi/describe-dimension-keys.html](https://docs.aws.amazon.com/cli/latest/reference/pi/describe-dimension-keys.html) | 針對特定時段，擷取其指標的前 N 個維度金鑰。 | 
| [https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_GetDimensionKeyDetails.html](https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_GetDimensionKeyDetails.html) | [https://docs.aws.amazon.com/cli/latest/reference/pi/get-dimension-key-details.html](https://docs.aws.amazon.com/cli/latest/reference/pi/get-dimension-key-details.html) | 擷取資料庫執行個體或資料來源之指定維度群組的屬性。比方說，如果指定 SQL ID，且有維度詳細資訊可用，則 `GetDimensionKeyDetails` 會擷取與此 ID `db.sql.statement` 相關聯之維度的完整文字。這項操作很有用，因為 `GetResourceMetrics` 和 `DescribeDimensionKeys` 不支援擷取大量的 SQL 陳述式文字。 | 
| [https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_GetPerformanceAnalysisReport.html](https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_GetPerformanceAnalysisReport.html) | [https://docs.aws.amazon.com/cli/latest/reference/pi/GetPerformanceAnalysisReport.html](https://docs.aws.amazon.com/cli/latest/reference/pi/GetPerformanceAnalysisReport.html) | 擷取報告，包括報告洞見。結果包括報告狀態、報告 ID、報告時間詳細資訊、洞見和建議。 | 
| [GetResourceMetadata](https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_GetResourceMetadata.html) | [https://docs.aws.amazon.com/cli/latest/reference/pi/get-resource-metadata.html](https://docs.aws.amazon.com/cli/latest/reference/pi/get-resource-metadata.html) | 檢索不同功能的中繼資料。例如，中繼資料可能指出特定資料庫執行個體上某項功能已開啟或關閉。 | 
| [https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_GetResourceMetrics.html](https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_GetResourceMetrics.html) | [https://docs.aws.amazon.com/cli/latest/reference/pi/get-resource-metrics.html](https://docs.aws.amazon.com/cli/latest/reference/pi/get-resource-metrics.html) | 擷取一組資料來源某個時段的績效詳情指標。您可以提供特定維度群組和維度，以及為每個群組提供彙總和篩選條件。 | 
| [ListAvailableResourceDimensions](https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_ListAvailableResourceDimensions.html) | [https://docs.aws.amazon.com/cli/latest/reference/pi/list-available-resource-dimensions.html](https://docs.aws.amazon.com/cli/latest/reference/pi/list-available-resource-dimensions.html) | 檢索指定執行個體上每個指定指標類型可查詢的維度。 | 
| [ListAvailableResourceMetrics](https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_ListAvailableResourceMetrics.html) | [https://docs.aws.amazon.com/cli/latest/reference/pi/list-available-resource-metrics.html](https://docs.aws.amazon.com/cli/latest/reference/pi/list-available-resource-metrics.html) | 檢索可為指定資料庫執行個體查詢的指定指標類型中所有可用的指標。 | 
| `[ListPerformanceAnalysisReports](https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_ListPerformanceAnalysisReports.html)` | [https://docs.aws.amazon.com/cli/latest/reference/pi/list-performance-analysis-reports.html](https://docs.aws.amazon.com/cli/latest/reference/pi/list-performance-analysis-reports.html) | 擷取資料庫執行個體可用的所有分析報告。報告會根據每個報告的開始時間列出。 | 
| `[ListTagsForResource](https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_ListTagsForResource.html)` | [https://docs.aws.amazon.com/cli/latest/reference/pi/list-tags-for-resource.html](https://docs.aws.amazon.com/cli/latest/reference/pi/list-tags-for-resource.html) | 列出所有新增至資源的中繼資料標籤。清單包括標籤的名稱和值。 | 
| `[TagResource](https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_TagResource.html)` | [https://docs.aws.amazon.com/cli/latest/reference/pi/tag-resource.html](https://docs.aws.amazon.com/cli/latest/reference/pi/tag-resource.html) | 將中繼資料標籤新增到 Amazon RDS 資源。標籤包括一個名稱和一個值。 | 
| `[UntagResource](https://docs.aws.amazon.com/performance-insights/latest/APIReference/API_UntagResource.html)` | [https://docs.aws.amazon.com/cli/latest/reference/pi/untag-resource.html](https://docs.aws.amazon.com/cli/latest/reference/pi/untag-resource.html) | 從資源移除中繼資料標籤。 | 

如需擷取 Performance Insights 時間序列指標和 AWS CLI 範例的詳細資訊，請參閱下列主題。

**Topics**
+ [擷取 Performance Insights 的時間序列指標](USER_PerfInsights.API.TimeSeries.md)
+ [AWS CLI 績效詳情的範例](USER_PerfInsights.API.Examples.md)