

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

# 接收偵測到問題的通知
<a name="appinsights-problem-notifications"></a>

可以使用 Amazon SNS 通知、Systems Manager OpsCenter 或 CloudWatch Events 來接收應用程式中偵測到問題的通知。

**已偵測到的問題的 CloudWatch Application Insights Amazon SNS 通知**  
您可以使用 AWS 管理主控台 或 設定 Amazon SNS 通知 AWS CLI。若要使用 設定通知 AWS 管理主控台，您必須擁有必要的 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 接收問題通知**  
**透過 執行動作 AWS Systems Manager。**CloudWatch Application Insights 提供與 Systems Manager OpsCenter 的內建整合。如果您選擇針對應用程式使用此整合，OpsCenter 主控台就會針對應用程式偵測到的每個問題建立 OpsItem。您可以從 OpsCenter 主控台檢視由 CloudWatch Application Insights 偵測到的問題的摘要資訊，並挑選一個 Systems Manager Automation Runbook 以採取修復動作，或進一步識別造成應用程式資源問題的 Windows 程序。

**如何使用 CloudWatch Events 接收問題通知**  
從 CloudWatch 主控台，在左側的導覽窗格，選取 **Events** (事件) 下的 **Rules** (規則)。從 **Rules (規則)** 頁面中選取 **Create rule (建立規則)**。從 **Service Name** (服務名稱) 下拉式清單中選擇 **Amazon CloudWatch Application Insights**，然後選擇 **Event Type** (事件類型)。接著，選擇 **Add target (新增目標)**，並選取目標和參數，例如 **SNS topic (SNS 主題)** 或 **Lambda function (Lambda 函數)**。