

支援終止通知：2025 年 9 月 15 日， AWS 將停止對 Amazon Lex V1 的支援。2025 年 9 月 15 日之後，您將無法再存取 Amazon Lex V1 主控台或 Amazon Lex V1 資源。如果您使用的是 Amazon Lex V2，請改參閱 [Amazon Lex V2 指南](https://docs.aws.amazon.com/lexv2/latest/dg/what-is.html)。

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

# 使用 Amazon CloudWatch 監控 Amazon Lex
<a name="monitoring-aws-lex-cloudwatch"></a>

若要追蹤 Amazon Lex 機器人的運作狀態，請使用 Amazon CloudWatch。使用 CloudWatch，您可以取得個別 Amazon Lex 操作或 帳戶全域 Amazon Lex 操作的指標。您也可以設定 CloudWatch 警示，以便在一或多個指標超過您定義的閾值時收到通知。例如，您可以監控在特定期間內對機器人提出的請求數量、檢視成功請求的延遲，或在錯誤超過閾值時發出警示。

## Amazon Lex 的 CloudWatch 指標
<a name="aws-lex-cloudwatch-using"></a>

若要取得 Amazon Lex 操作 的指標，您必須指定下列資訊：
+ 指標維度。*維度*是一組用來識別指標的名稱與數值對。Amazon Lex 有三個維度：
  + `BotAlias, BotName, Operation`
  + `BotAlias, BotName, InputMode, Operation`
  + `BotName, BotVersion, InputMode, Operation`
+ 指標名稱，例如 `MissedUtteranceCount` 或 `RuntimeRequestCount`。

您可以使用 AWS 管理主控台、 AWS CLI或 CloudWatch API 取得 Amazon Lex 的指標。您可以透過其中一個 Amazon AWS 軟體開發套件 (SDKs) 或 CloudWatch API 工具來使用 CloudWatch API。Amazon Lex 主控台會根據來自 CloudWatch API 的原始資料顯示圖形。

您必須擁有適當的 CloudWatch 許可，才能使用 CloudWatch 監控 Amazon Lex。如需詳細資訊，請參閱《[Amazon CloudWatch 使用者指南》中的 Amazon CloudWatch 的身分驗證和存取控制](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/auth-and-access-control-cw.html)。 *Amazon CloudWatch *

## 檢視 Amazon Lex 指標
<a name="aws-lex-cloudwatch-metrics"></a>

使用 Amazon Lex 主控台或 CloudWatch 主控台檢視 Amazon Lex 指標。

**檢視指標 (Amazon Lex 主控台）**

1. 登入 AWS 管理主控台 ，並在 [https://console.aws.amazon.com/lex/](https://console.aws.amazon.com/lex/)：// 開啟 Amazon Lex 主控台。

1. 從機器人清單選擇您要查看指標的機器人。

1. 選擇 **Monitoring** (監控)。指標會顯示在圖形中。

**若要檢視指標 (CloudWatch 主控台)**

1. 登入 AWS 管理主控台 ，並在 https：//[https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/) 開啟 CloudWatch 主控台。

1. 選擇**指標**，選擇**所有指標**，然後選擇 **AWS/Lex**。

1. 選擇維度、選擇指標名稱，再選擇 **Add to graph (新增至圖形)**。

1. 選擇日期範圍的值。所選日期範圍的指標計數會顯示在圖形中。

## 建立警示
<a name="aws-lex-cloudwatch-alarms"></a>

CloudWatch 警示會監看指定期間內的單一指標，並執行一或多個動作：傳送通知至 Amazon Simple Notification Service (Amazon SNS) 主題或 Auto Scaling 政策。動作是根據指標在您指定的數個期間內相對於指定閾值的值。當警示變更狀態時，CloudWatch 也可以傳送 Amazon SNS 訊息給您。

CloudWatch 警示只有在狀態變更且在您指定的期間持續存在時，才會叫用動作。

**設定警示**

1. 登入 AWS 管理主控台 ，並在 https：//[https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/) 開啟 CloudWatch 主控台。

1. 選擇 **Alarms** (警示)，然後選擇 **Create Alarm** (建立警示)。

1. 選擇 **AWS/Lex Metrics指標**，然後選擇一個指標。

1. 對於 **Time Range (時間範圍)**，選擇要監控的時間範圍，然後選擇 **Next (下一步)**。

1. 輸入 **Name (名稱)** 和 **Description (描述)**。

1.  對於 **Whenever (每當)**，選擇 **>=** 並輸入最大值。

1. 如果您希望 CloudWatch 在達到警示狀態時傳送電子郵件，請在**動作**區段中，針對**每當此警示**，選擇**狀態為 ALARM**。對於 **Send notification to (傳送通知至)**，選擇郵件清單或選擇 **New list (新清單)** 並建立新的郵件清單。

1. 在 **Alarm Preview** (警示預覽) 區段中預覽警示。如果警示符合您的要求，選擇 **Create Alarm (建立警示)**。

## Amazon Lex 執行期的 CloudWatch 指標
<a name="cloudwatch-dimensions-for-aws-lex-runtime"></a>

下表說明 Amazon Lex 執行時間指標。


| 指標 | Description | 
| --- | --- | 
| KendraIndexAccessError | Amazon Lex 無法存取 Amazon Kendra 索引的次數。 使用 `Text` 或 `Speech` `InputMode` 進行 `PostContent` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) 單位：計數  | 
| KendraLatency | Amazon Kendra 回應來自 的請求所需的時間`AMAZON.KendraSearchIntent`。使用 `Text` 或 `Speech` `InputMode` 進行 `PostContent` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) 單位：毫秒 | 
| KendraSuccess | 從 `AMAZON.KendraSearchIntent`到 Amazon Kendra 索引的成功請求數量。使用 `Text` 或 `Speech` `InputMode` 進行 `PostContent` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) 單位：計數 | 
| KendraSystemErrors | Amazon Lex 無法查詢 Amazon Kendra 索引的次數。 使用 `Text` 或 `Speech` `InputMode` 進行 `PostContent` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) 單位：計數  | 
| KendraThrottledEvents | Amazon Kendra 調節來自 請求的次數`AMAZON.KendraSearchIntent`。 使用 `Text` 或 `Speech` `InputMode` 進行 `PostContent` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) 單位：計數  | 
| MissedUtteranceCount |  指定期間內無法辨識的表達用語數量。 使用 `Text ` 或 `Speech` `InputMode` 進行 `PostContent` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html)  | 
|  `RuntimeConcurrency`  |  指定期間內並行連線的數量。 `RuntimeConcurrency` 會以 的形式報告`StatisticSet`。 使用 `Text` 或 `Speech` `InputMode` 進行 `PostContent` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) 其他操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) 單位：計數  | 
| RuntimeInvalidLambdaResponses |  指定期間內的 invalid AWS Lambda (Lambda) 回應數目。 使用 `Text` 或 `Speech` `InputMode` 進行 `PostContent` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html)  | 
| RuntimeLambdaErrors | 指定期間內的 Lambda 執行時間錯誤數目。使用 `Text ` 或 `Speech` ` InputMode` 進行 `PostContent` 操作的有效維度：[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html)`PostText` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html)  | 
| RuntimePollyErrors |  指定期間內無效的 Amazon Polly 回應數目。 使用 `Text` 或 `Speech` `InputMode` 進行 `PostContent` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html)  | 
| RuntimeRequestCount |  指定期間內的執行時間請求數量。 使用 `Text` 或 `Speech` `InputMode` 進行 `PostContent` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) 單位：計數  | 
| RuntimeSucessfulRequestLatency  此指標是 `RuntimeSucessfulRequestLatency`，而不是 `RuntimeSuccessfulRequestLatency`。  |  提出請求與傳回回應期間的成功請求延遲。 使用 `Text` 或 `Speech` `InputMode` 進行 `PostContent` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) 單位：毫秒  | 
| RuntimeSystemErrors |  指定期間內的系統錯誤數量。系統錯誤的回應碼範圍是 500 到 599。 使用 `Text` 或 `Speech` `InputMode` 進行 `PostContent` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) 單位：計數  | 
| RuntimeThrottledEvents |  已調節的請求數目。Amazon Lex 會在收到超過您帳戶每秒交易限制的請求時調節請求。如果經常超過為您的帳戶所設的限制，您可以請求提高上限。若要請求提高，請參閱 [AWS 服務限制](https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html)。 使用 `Text` 或 `Speech` `InputMode` 進行 `PostContent` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) 單位：計數  | 
| RuntimeUserErrors |  指定期間內的使用者錯誤數量。使用者錯誤的回應碼範圍是 400 到 499。 使用 `Text` 或 `Speech` `InputMode` 進行 `PostContent` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效維度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) 單位：計數  | 

Amazon Lex 執行期指標使用 `AWS/Lex` 命名空間，並在下列維度中提供指標。您可以在 CloudWatch 主控台中依維度分組指標：


| 維度 | Description | 
| --- | --- | 
| BotName, BotAlias, Operation, InputMode | 依照機器人別名、機器人名稱、操作 (PostContent) 及文字或語音輸入，為指標進行分組。 | 
| BotName, BotVersion, Operation, InputMode | 依照機器人名稱、機器人版本、操作 (PostContent) 及文字或語音輸入，為指標進行分組。 | 
| BotName, BotVersion, Operation | 依照機器人名稱、機器人版本和操作 (PostText)，為指標進行分組。 | 
| BotName, BotAlias, Operation | 依照機器人名稱、機器人別名和操作 (PostText)，為指標進行分組。 | 

## Amazon Lex 頻道關聯的 CloudWatch 指標
<a name="cloudwatch-dimensions-for-aws-lex-channels"></a>

頻道關聯是 Amazon Lex 與 Facebook 等簡訊頻道之間的關聯。下表說明 Amazon Lex 頻道關聯指標。


| 指標 | Description | 
| --- | --- | 
| BotChannelAuthErrors | 簡訊管道在指定期間內傳回的身分驗證錯誤數量。身分驗證錯誤表示在管道建立期間所提供的秘密字符無效或已過期。  | 
| BotChannelConfigurationErrors | 指定期間內的組態錯誤數量。組態錯誤表示管道有一或多個組態項目無效。  | 
| BotChannelInboundThrottledEvents | Amazon Lex 在指定期間內由簡訊管道傳送的訊息受到限流的次數。  | 
| BotChannelOutboundThrottledEvents | 從 Amazon Lex 到訊息管道的傳出事件在指定期間內受到限流的次數。  | 
| BotChannelRequestCount | 指定期間內在管道上提出的請求數量。  | 
| BotChannelResponseCardErrors | Amazon Lex 無法在指定期間內張貼回應卡的次數。  | 
| BotChannelSystemErrors | 在指定期間內，頻道在 Amazon Lex 中發生的內部錯誤數目。  | 

Amazon Lex 頻道關聯指標使用 `AWS/Lex` 命名空間，並提供下列維度的指標。您可以在 CloudWatch 主控台中依維度分組指標：


| 維度 | Description | 
| --- | --- | 
| BotAlias, BotChannelName, BotName, Source | 依照機器人別名、管道名稱、機器人名稱和流量來源，為指標進行分組。 | 

## 對話日誌的 CloudWatch 指標
<a name="cloudwatch-metrics-for-logging"></a>

Amazon Lex 使用下列指標進行對話記錄：


| 指標 | Description | 
| --- | --- | 
| ConversationLogsAudioDeliverySuccess | 在指定時段成功遞送至 S3 儲存貯體的音訊日誌數目。 單位：Count | 
| ConversationLogsAudioDeliveryFailure | 在指定時段無法遞送至 S3 儲存貯體的音訊日誌數目。遞送失敗表示針對對話日誌設定的資源發生錯誤。錯誤可能包括 IAM 許可不足、無法存取的 AWS KMS 金鑰或無法存取的 S3 儲存貯體。單位：Count | 
| ConversationLogsTextDeliverySuccess | 在指定期間內成功交付至 CloudWatch Logs 的文字日誌數量。 單位：Count | 
| ConversationLogsTextDeliveryFailure | 在指定期間內無法交付至 CloudWatch Logs 的文字日誌數量。遞送失敗表示針對對話日誌設定的資源發生錯誤。錯誤可能包括 IAM 許可不足、無法存取的 AWS KMS 金鑰或無法存取的 CloudWatch Logs 日誌群組。 單位：Count | 

Amazon Lex 對話日誌指標使用 `AWS/Lex` 命名空間，並提供下列維度的指標。您可以在 CloudWatch 主控台中依維度分組指標。


| 維度 | Description | 
| --- | --- | 
| `BotAlias` | 依機器人別名將指標分組。 | 
| `BotName` | 依機器人名稱將指標分組。 | 
| `BotVersion` | 依機器人版本將指標分組。 | 