

终止支持通知：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 Lex CloudWatch
<a name="monitoring-aws-lex-cloudwatch"></a>

要追踪您的 Amazon Lex 机器人的运行状况，请使用亚马逊 CloudWatch。借助 CloudWatch，您可以获取账户中各个 Amazon Lex 操作或全球 Amazon Lex 运营的指标。您还可以设置 CloudWatch 警报，以便在一个或多个指标超过您定义的阈值时收到通知。例如，您可以监控特定时间段内向机器人发出的请求数量，查看成功请求的延迟，或者在错误超过阈值时发出警报。

## CloudWatch Amazon Lex 的指标
<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 管理控制台、或 CloudWatch API 获取 Amazon Lex 的指标。 AWS CLI您可以通过其中一个 Amazon AWS 软件开发套件 (SDKs) 或 CloudWatch API 工具来使用 API。 CloudWatch Amazon Lex 控制台根据来自 CloudWatch API 的原始数据显示图表。

您必须拥有相应的 CloudWatch 权限才能使用监控 Amazon Lex CloudWatch 。有关更多信息，请参阅《亚马逊* CloudWatch 用户指南》 CloudWatch*中的 [Amazon 身份验证和访问控制](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/auth-and-access-control-cw.html)。

## 查看 Amazon Lex 指标
<a name="aws-lex-cloudwatch-metrics"></a>

使用亚马逊 Lex 控制台或控制台查看 Amazon Lex 指标。 CloudWatch

**查看指标（Amazon Lex 控制台）**

1. 登录 AWS 管理控制台 并打开 Amazon Lex 控制台，网址为[https://console.aws.amazon.com/lex/](https://console.aws.amazon.com/lex/)。

1. 从自动程序列表中，选择要查看其指标的自动程序。

1. 选择**监控**。此时指标以图表形式显示。

**查看指标（CloudWatch 控制台）**

1. 登录 AWS 管理控制台 并打开 CloudWatch 控制台，网址为[https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/)。

1. 依次选择**指标**、**所有指标**，然后选择 **AWS/Lex**。

1. 选择维度、指标名称，然后选择 **添加到图表**。

1. 选择日期范围的值。所选日期范围的指标计数将显示在该图表中。

## 创建警报
<a name="aws-lex-cloudwatch-alarms"></a>

 CloudWatch 警报在指定时间段内监视单个指标，并执行一项或多项操作：向亚马逊简单通知服务 (Amazon SNS) Simple Notification Service 主题或 Auto Scaling 策略发送通知。一个或多个操作基于指标在您指定的多个时间段内相对于给定阈值的值。 CloudWatch还可以在警报状态发生变化时向您发送 Amazon SNS 消息。

CloudWatch 警报仅在状态发生变化并且持续到您指定的时间段内时才会调用操作。

**设置警报**

1. 登录 AWS 管理控制台 并打开 CloudWatch 控制台，网址为[https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/)。

1. 依次选择 **Alarms** 和 **Create Alarm**。

1. 选择 **AWS/Lex 指标**，然后选择一个指标。

1. 对于 ** Time Range**，请选择要监控的时间范围，然后选择 **Next**。

1. 输入**名称**和**描述**。

1.  对于 **Whenever**，选择 **>=**，然后键入一个最大值。

1. 如果 CloudWatch 要在达到警报状态时发送电子邮件，请在 “**操作**” 部分的 “**每当此警报**” 中选择 “**状态为警报**”。对于**发送通知到**，选择一个邮件列表，或选择**新建列表**然后创建一个新的邮件列表。

1. 预览**警报预览**部分中的警报。如果对警报满意，请选择 **Create Alarm (创建警报)**。

## CloudWatch Amazon Lex 运行时的指标
<a name="cloudwatch-dimensions-for-aws-lex-runtime"></a>

下表介绍 Amazon Lex 运行时指标。


| 指标 | 说明 | 
| --- | --- | 
| KendraIndexAccessError | Amazon Lex 无法访问您的 Amazon Kendra 索引的次数。 对于 `Text` 或 `Speech` `InputMode` 的 `PostContent` 操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/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_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/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_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/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_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/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_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/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_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/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_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) 其他操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) 单位：个  | 
| RuntimeInvalidLambdaResponses |  指定时间段内无效 AWS Lambda (Lambda) 响应的数量。 对于 `Text` 或 `Speech` `InputMode` 的 `PostContent` 操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/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_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html)`PostText` 操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/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_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/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_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/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_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/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_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/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_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/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_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) `PostText` 操作的有效维度： [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/lex/latest/dg/monitoring-aws-lex-cloudwatch.html) 单位：个  | 

Amazon Lex 运行时指标使用 `AWS/Lex` 命名空间并以下面的维度提供指标。您可以在 CloudWatch 控制台中按维度对指标进行分组：


| 维度 | 说明 | 
| --- | --- | 
| BotName, BotAlias, Operation, InputMode | 按自动程序的别名、自动程序的名称、操作 (PostContent) 以及输入是文本还是语音形式，对指标进行分组。 | 
| BotName, BotVersion, Operation, InputMode | 按自动程序的名称、自动程序的版本、操作 (PostContent) 以及输入是文本还是语音形式，对指标进行分组。 | 
| BotName, BotVersion, Operation | 按自动程序的名称、自动程序版本以及操作 PostText 对指标进行分组。 | 
| BotName, BotAlias, Operation | 按自动程序的名称、自动程序的别名以及操作 PostText 对指标进行分组。 | 

## CloudWatch Amazon Lex 渠道关联指标
<a name="cloudwatch-dimensions-for-aws-lex-channels"></a>

通道关联是 Amazon Lex 与消息收发通道（如 Facebook）之间的关联。下表介绍 Amazon Lex 通道关联指标。


| 指标 | 说明 | 
| --- | --- | 
| BotChannelAuthErrors | 指定时间内消息收发通道返回的身份验证错误的数量。身份验证错误表示在创建通道期间提供的秘密令牌无效或者已过期。  | 
| BotChannelConfigurationErrors | 指定时间段内的配置错误的数量。配置错误指示通道的一个或多个配置条目无效。  | 
| BotChannelInboundThrottledEvents | 在指定时间段内 Amazon Lex 限制消息收发通道发送消息的次数。  | 
| BotChannelOutboundThrottledEvents | 在指定时间段内从 Amazon Lex 到消息收发通道的出站事件被限制的次数。  | 
| BotChannelRequestCount | 指定时间段内对通道发出的请求的数量  | 
| BotChannelResponseCardErrors | 在指定时间段内 Amazon Lex 无法发布响应卡的次数。  | 
| BotChannelSystemErrors | 在指定时间段内对于一个通道在 Amazon Lex 中发生的内部错误的数量。  | 

Amazon Lex 通道关联指标使用 `AWS/Lex` 命名空间，并为以下维度提供指标。您可以在 CloudWatch 控制台中按维度对指标进行分组：


| 维度 | 说明 | 
| --- | --- | 
| BotAlias, BotChannelName, BotName, Source | 按自动程序的别名、通道名称、自动程序的名称以及流量来源对指标进行分组。 | 

## CloudWatch 对话日志的指标
<a name="cloudwatch-metrics-for-logging"></a>

Amazon Lex 为对话日志记录使用以下指标：


| 指标 | 说明 | 
| --- | --- | 
| ConversationLogsAudioDeliverySuccess | 在指定时间段内成功传输到 S3 存储桶的音频日志数量。 单位：计数 | 
| ConversationLogsAudioDeliveryFailure | 在指定时间段内未能传输到 S3 存储桶的音频日志数量。传输失败表示为对话日志配置的资源出现错误。错误可能包括 IAM 权限不足、 AWS KMS 密钥无法访问或 S3 存储桶无法访问。单位：计数 | 
| ConversationLogsTextDeliverySuccess | 在指定时间段内成功传送到 CloudWatch Logs 的文本日志的数量。 单位：计数 | 
| ConversationLogsTextDeliveryFailure | 在指定时间段内未能传送到 CloudWatch Logs 的文本日志的数量。传输失败表示为对话日志配置的资源出现错误。错误可能包括 IAM 权限不足、 AWS KMS 密钥无法访问或 CloudWatch 日志日志组无法访问。 单位：计数 | 

Amazon Lex 对话日志指标使用 `AWS/Lex` 命名空间并为以下维度提供指标。您可以在 CloudWatch 控制台中按维度对指标进行分组。


| 维度 | 说明 | 
| --- | --- | 
| `BotAlias` | 按自动程序的别名对指标进行分组。 | 
| `BotName` | 按自动程序的名称对指标进行分组。 | 
| `BotVersion` | 按自动程序的版本对指标进行分组。 | 