

# 在警示來源隱藏警示
<a name="suppress-alarms-at-source"></a>

藉由在警示來源隱藏警示的方式，指定哪些警示與事件偵測與回應互動，以及何時進行互動。

**Topics**
+ [使用指標數學函數來隱藏 CloudWatch 警示](#suppress-alarms-at-source-cw)
+ [移除指標數學函數以取消隱藏 CloudWatch 警示](#suppress-alarms-metric-math-unsuppress)
+ [指標數學函數範例和相關聯的使用案例](#suppress-alarms-example-functions)
+ [隱藏來自第三方 APM 的警示](#suppress-alarms-third-party-apm)

## 使用指標數學函數來隱藏 CloudWatch 警示
<a name="suppress-alarms-at-source-cw"></a>

若要抑制 Amazon CloudWatch 警示的事件偵測與回應監控，請使用[指標數學函數](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/using-metric-math.html)來停止 CloudWatch 警示在指定時段進入 `ALARM` 狀態。

**注意**  
停用 CloudWatch 警示的**警示動作**並不會抑制事件偵測與回應監控您的警示。警示狀態變更會透過 Amazon EventBridge 擷取，而不是透過 CloudWatch 警示動作擷取。

若要使用指標數學函數來隱藏 CloudWatch 警示，請完成下列步驟：

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

1. 選擇**警示**，然後尋找您要新增指標數學函數的警示。

1. 依序選擇**動作**和**編輯**以變更警示。

1. 選擇**編輯指標**以修改警示的指標。

1. 選擇**新增數學**、**以空白運算式開始**。

1. 輸入您的數學運算式，然後選擇**套用**。

1. 取消選取警示監控的現有指標。

1. 選取您剛才建立的運算式，然後選擇**選取指標**。

1. 選擇**跳至預覽並建立**。

1. 檢閱您的變更，以確保依預期套用您的指標數學函數，然後選擇**更新警示**。

如需使用指標數學函數隱藏 CloudWatch 警示的逐步範例，請參閱 [教學課程：使用指標數學函數來隱藏警示](suppress-alarms-tutorial-suppress.md)。

如需語法和可用函數的詳細資訊，請參閱《Amazon CloudWatch 使用者指南》**中的[指標數學語法和函數](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/using-metric-math.html#metric-math-syntax)。

## 移除指標數學函數以取消隱藏 CloudWatch 警示
<a name="suppress-alarms-metric-math-unsuppress"></a>

透過移除指標數學函數來取消隱藏 CloudWatch 警示。若要移除警示的指標數學函數，請完成下列步驟：

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

1. 選擇**警示**，然後尋找您要移除其指標數學運算式的警示。

1. 在指標數學區段中，選擇**編輯**。

1. 若要移除警示的指標，請選擇指標上的**編輯**，然後選擇指標數學運算式旁的 **x** 按鈕。

1. 選取原始指標，然後選擇**選取指標**。

1. 選擇**跳至預覽並建立**。

1. 檢閱您的變更，以確保依預期套用您的指標數學函數，然後選擇**更新警示**。

## 指標數學函數範例和相關聯的使用案例
<a name="suppress-alarms-example-functions"></a>

下表包含指標數學函數範例，以及相關聯的使用案例和每個指標元件的說明。


| 指標數學函數 | 使用案例 | 說明 | 
| --- | --- | --- | 
| `IF((DAY(m1) == 2 && HOUR(m1) >= 1 && HOUR(m1) < 3), 0, m1)` | 在每星期二 1:00 到 3:00 AM UTC 之間隱藏警示，方法是在此時段將實際資料點取代為 0。 |  [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/IDR/latest/userguide/suppress-alarms-at-source.html)  | 
| `IF((HOUR(m1) >= 23 \|\| HOUR(m1) < 4), 0, m1)` | 在每天 11:00 PM 到 4:00 AM UTC 之間隱藏警示，方法是在此時段將實際資料點取代為 0。 |  [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/IDR/latest/userguide/suppress-alarms-at-source.html)  | 
| `IF((HOUR(m1) >= 11 && HOUR(m1) < 13), 0, m1) ` | 在每天 11:00 AM 到 1:00 PM UTC 之間隱藏警示，方法是在此時段將實際資料點取代為 0。 |  [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/IDR/latest/userguide/suppress-alarms-at-source.html)  | 
| `IF((DAY(m1) == 2 && HOUR(m1) >= 1 && HOUR(m1) < 3), 99, m1)` | 在每星期二 1:00 到 3:00 AM UTC 之間隱藏警示，方法是在此時段將實際資料點取代為 99。 |  [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/IDR/latest/userguide/suppress-alarms-at-source.html)  | 
| `IF((HOUR(m1) >= 23 \|\| HOUR(m1) < 4), 100, m1)` | 在每天 11:00 PM 到 4:00 AM UTC 之間隱藏警示，方法是在此時段將實際資料點取代為 100。 |  [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/IDR/latest/userguide/suppress-alarms-at-source.html)  | 
| `IF((HOUR(m1) >= 11 && HOUR(m1) < 13), 99, m1) ` | 在每天 11:00 AM 到 1:00 PM UTC 之間隱藏警示，方法是在此時段將實際資料點取代為 99。 |  [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/IDR/latest/userguide/suppress-alarms-at-source.html)  | 

## 隱藏來自第三方 APM 的警示
<a name="suppress-alarms-third-party-apm"></a>

請參閱第三方 APM 廠商的文件，以取得如何隱藏警示的指示。第三方 APM 廠商的範例包括 New Relic、Splunk、Dynatrace、Datadog 和 SumoLogic。