

# 接收有关检测到的问题的通知
<a name="appinsights-problem-notifications"></a>

您可以使用 Amazon SNS 通知、Systems Manager OpsCenter 或 CloudWatch Events 来接收有关在应用程序中检测到的问题的通知。

**检测到的问题的 CloudWatch Application Insights Amazon SNS 通知**  
您可以使用 Amazon Web Services 管理控制台 或 Amazon CLI 来配置 Amazon SNS 通知。要使用 Amazon Web Services 管理控制台 设置通知，您必须拥有必要的 Amazon SNS 权限，如以下示例所示。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
      {
        "Effect": "Allow",
        "Action": [
          "sns:ListTopics",
          "sns:Subscribe",
          "sns:CreateTopic"
        ],    
        "Resource": [
          "*" 
        ]
      }
    ]    
}
```

------

设置 Amazon SNS 通知后，当问题出现或解决时，您会收到电子邮件通知。当向现有问题添加新的观测结果时，您还会收到通知。

以下示例显示电子邮件通知的内容。

```
    You are receiving this email because Problem "p-1234567" has been CREATED by Amazon CloudWatch Application Insights
    
    Problem Details: 
    Problem URL: https:////console.aws.amazon.com/cloudwatch/home?region=us-east-1#settings:AppInsightsSettings/problemDetails?problemId=p-1234567
    Problem Summary: Title of the problem
    Severity: HIGH
    Insights: Something specific is broken
    Status : RESOLVED
    AffectedResource: arn:aws:ec2:us-east-1:555555555555:host/testResource
    Region: us-east-1
    RecurringCount: 0
    StartTime: 2019-03-23T10:42:57.777Z
    LastUpdatedTime: 2019-03-23T21:49:37.777Z
    LastRecurrenceTime: 
    StopTime: 2019-03-23T21:49:37.777Z
    
    Recent Issues
    - TelemetryArn:alarm1
      StartTime: 2024-08-15T22:12:46.007Z
      StopTime:
    - TelemetryArn:log-group1
      StartTime: 2024-08-15T22:12:46.007Z
      StopTime: 2024-08-15T22:12:46.007Z
```

**如何使用 Systems Manager 接收问题通知**  
**通过 Amazon Systems Manager 执行的操作。**CloudWatch Application Insights 提供与 Systems Manager OpsCenter 的内置集成。如果您选择将此集成用于您的应用程序，则会在 OpsCenter 控制台上为该应用程序检测到的每个问题创建一个 OpsItem。在 OpsCenter 控制台中，您可以查看 CloudWatch Application Insights 检测到的问题的摘要信息，并选择一个 Systems Manager Automation 运行手册来采取补救措施，或者进一步识别导致应用程序中出现资源问题的 Windows 进程。

**如何使用 CloudWatch Events 接收问题通知**  
从 CloudWatch 控制台中，选择 **Events（事件）**下左侧导航窗格中的 **Rule（规则）**。从 **Rules (规则)** 页面中，选择 **Create rule (创建规则)**。选择 **Service Name（服务名称）**下拉列表中的 **Amazon CloudWatch Application Insights**，然后选择 **Event Type（事件类型）**。然后，选择 **Add target (添加目标)**，并选择目标和参数，例如 **SNS topic (SNS 主题)** 或 **Lambda function (Lambda 函数)**。