使用 Azure 入口網站建立 Azure SQL Database 和資料倉儲警示Create alerts for Azure SQL Database and Data Warehouse using Azure portal

概觀Overview

本文說明如何使用 Azure 入口網站設定 Azure SQL Database 和資料倉儲警示。This article shows you how to set up Azure SQL Database and Data Warehouse alerts using the Azure portal. 當某些計量 (例如,資料庫大小或 CPU 使用量) 閾值時,警示可傳送電子郵件給您或呼叫 Webhook。Alerts can send you an email or call a web hook when some metric (for example database size or CPU usage) reaches the threshold. 本文也提供設定警示期間的最佳做法。This article also provides best practices for setting alert periods.

重要

此功能還無法在受控執行個體中取得。This feature is not yet available in Managed Instance. 或者,您可以根據動態管理檢視 (機器翻譯),針對某些計量使用 SQL 代理程式傳送電子郵件警示。As an alternative, you can use SQL Agent to send email alerts for some metrics based on Dynamic Management Views.

您可以收到以您 Azure 服務的監視計量或事件為基礎的警示。You can receive an alert based on monitoring metrics for, or events on, your Azure services.

  • 計量值 - 當指定的計量值超出您在任一方向指派的臨界值時會觸發警示。Metric values - The alert triggers when the value of a specified metric crosses a threshold you assign in either direction. 也就是說,當先符合條件而之後該條件不再符合時,兩方面皆會觸發。That is, it triggers both when the condition is first met and then afterwards when that condition is no longer being met.
  • 活動記錄檔事件 - 警示可觸發每一個事件,或是僅在發生特定事件數目時才觸發。Activity log events - An alert can trigger on every event, or, only when a certain number of events occur.

可以配置警报以在其触发时执行以下操作:You can configure an alert to do the following when it triggers:

  • 向服务管理员和共同管理员发送电子邮件通知send email notifications to the service administrator and co-administrators
  • 傳送電子郵件至您指定的其他電子郵件send email to additional emails that you specify.
  • 调用 Webhookcall a webhook

您可以透過下列方式設定和取得有關警示規則的資訊You can configure and get information about alert rules using

使用 Azure 入口網站建立計量的警示規則Create an alert rule on a metric with the Azure portal

  1. 入口網站中,找到您要監視的資源並選取。In the portal, locate the resource you are interested in monitoring and select it.

  2. 選取 [監視] 區段底下的 [警示 (傳統)]。Select Alerts (Classic) under the MONITORING section. 不同資源的文字和圖示會有些許不同。The text and icon may vary slightly for different resources.

    監視

    • 僅限 SQL DW:按一下 [DWU 使用量] 圖表。SQL DW ONLY: Click the DWU Usage graph. 選取 [檢視傳統警示]Select View classic alerts
  3. 選取 [新增計量警示 (傳統)] 按鈕,並填寫各欄位。Select the Add metric alert (classic) button and fill in the fields.

    新增警示

  4. 為您的警示規則命名 ([名稱]),選擇將會顯示在電子郵件通知中的 [描述]。Name your alert rule, and choose a Description, which also shows in notification emails.

  5. 選取您要監視的 [計量],然後為計量選擇 [條件] 和 [臨界值]。Select the Metric you want to monitor, then choose a Condition and Threshold value for the metric. 同時選擇警示觸發程序之前,計量規則必須滿足的 [期間]。Also choose the Period of time that the metric rule must be satisfied before the alert triggers. 例如,如果您使用「PT5M」期間,且您的警示會尋找高於 80% 的 CPU,當平均 CPU 已高於 80% 5 分鐘,就會觸發警示。So for example, if you use the period "PT5M" and your alert looks for CPU above 80%, the alert triggers when the average CPU has been above 80% for 5 minutes. 一旦發生第一次觸發,它會在平均 CPU 低於 80 % 5 分鐘時再次觸發。Once the first trigger occurs, it again triggers when the average CPU is below 80% over 5 minutes. CPU 度量每隔 1 分鐘發生一次。The CPU measurement occurs every 1 minute. 支援的時間範圍,請參閱下方的資料表,並彙總輸入每個警示會使用 not 所有警示都使用的平均值。Consult the table below for supported time windows and the aggregation type that each alert uses- not all alerts use the average value.

  6. 如果您想要在警示引發時傳送電子郵件給系統管理員和共同管理員,請勾選 [電子郵件的擁有者...] 。Check Email owners... if you want administrators and co-administrators to be emailed when the alert fires.

  7. 如果您想要讓其他電子郵件信箱在警示引發時收到通知,在 [其他系統管理員電子郵件] 欄位新增它們。If you want additional emails to receive a notification when the alert fires, add them in the Additional Administrator email(s) field. 用分号隔开多个电子邮件 - email@contoso.com;email2@contoso.comSeparate multiple emails with semi-colons - email@contoso.com;email2@contoso.com

  8. 如果您想在警示引發時呼叫webhook,在[webhook] 欄位中放入有效的 URI。Put in a valid URI in the Webhook field if you want it called when the alert fires.

  9. 完成後選取 [確定] 建立警示。Select OK when done to create the alert.

在幾分鐘之內,警示會開始作用,且先前所述觸發。Within a few minutes, the alert is active and triggers as previously described.

管理警报Managing your alerts

一旦建立警示,您可以選取警示,並且︰Once you have created an alert, you can select it and:

  • 檢視圖表,其中顯示計量臨界值與前一天的實際值。View a graph showing the metric threshold and the actual values from the previous day.
  • 编辑或删除其。Edit or delete it.
  • 如果您想要暫時停止或恢復接收警示的通知,可以停用啟用警示。Disable or Enable it if you want to temporarily stop or resume receiving notifications for that alert.

SQL Database 警示值SQL Database alert values

資源類型Resource Type 度量名稱Metric Name 易記名稱Friendly Name 彙總類型Aggregation Type 警示時間間隔下限Minimum alert time window
SQL DatabaseSQL database cpu_percentcpu_percent CPU 百分比CPU percentage 平均值Average 5 分鐘5 minutes
SQL DatabaseSQL database physical_data_read_percentphysical_data_read_percent 資料 IO 百分比Data IO percentage 平均值Average 5 分鐘5 minutes
SQL DatabaseSQL database log_write_percentlog_write_percent 記錄 IO 百分比Log IO percentage 平均值Average 5 分鐘5 minutes
SQL DatabaseSQL database dtu_consumption_percentdtu_consumption_percent DTU 百分比DTU percentage 平均值Average 5 分鐘5 minutes
SQL DatabaseSQL database 儲存體storage 数据库总大小Total database size 最大值Maximum 30 分钟30 minutes
SQL DatabaseSQL database connection_successfulconnection_successful 成功的連線Successful Connections 總計Total 10 分鐘10 minutes
SQL 数据库SQL database connection_failedconnection_failed 失败的连接数Failed Connections 總計Total 10 分鐘10 minutes
SQL DatabaseSQL database blocked_by_firewallblocked_by_firewall 遭到防火牆封鎖Blocked by Firewall 總計Total 10 分鐘10 minutes
SQL DatabaseSQL database 死結deadlock 死結Deadlocks 總計Total 10 分鐘10 minutes
SQL DatabaseSQL database storage_percentstorage_percent 資料庫大小百分比Database size percentage 最大值Maximum 30 分钟30 minutes
SQL DatabaseSQL database xtp_storage_percentxtp_storage_percent In-Memory OLTP 存储百分比(预览)In-Memory OLTP storage percent(Preview) 平均值Average 5 分鐘5 minutes
SQL DatabaseSQL database workers_percentworkers_percent 背景工作角色百分比Workers percentage 平均值Average 5 分鐘5 minutes
SQL DatabaseSQL database sessions_percentsessions_percent 工作階段百分比Sessions percent 平均值Average 5 分鐘5 minutes
SQL DatabaseSQL database dtu_limitdtu_limit DTU 限制DTU limit 平均值Average 5 分鐘5 minutes
SQL DatabaseSQL database dtu_useddtu_used 已使用 DTUDTU used 平均值Average 5 分鐘5 minutes
彈性集區Elastic pool cpu_percentcpu_percent CPU 百分比CPU percentage 平均值Average 10 分鐘10 minutes
彈性集區Elastic pool physical_data_read_percentphysical_data_read_percent 資料 IO 百分比Data IO percentage 平均值Average 10 分鐘10 minutes
彈性集區Elastic pool log_write_percentlog_write_percent 記錄 IO 百分比Log IO percentage 平均值Average 10 分鐘10 minutes
彈性集區Elastic pool dtu_consumption_percentdtu_consumption_percent DTU 百分比DTU percentage 平均值Average 10 分鐘10 minutes
彈性集區Elastic pool storage_percentstorage_percent 儲存體百分比Storage percentage 平均值Average 10 分鐘10 minutes
彈性集區Elastic pool workers_percentworkers_percent 背景工作角色百分比Workers percentage 平均值Average 10 分鐘10 minutes
彈性集區Elastic pool eDTU_limiteDTU_limit eDTU 限制eDTU limit 平均值Average 10 分鐘10 minutes
彈性集區Elastic pool storage_limitstorage_limit 儲存體限制Storage limit 平均值Average 10 分鐘10 minutes
彈性集區Elastic pool eDTU_usedeDTU_used 已使用 eDTUeDTU used 平均值Average 10 分鐘10 minutes
彈性集區Elastic pool storage_usedstorage_used 已用的存储量Storage used 平均值Average 10 分鐘10 minutes
SQL 資料倉儲SQL data warehouse cpu_percentcpu_percent CPU 百分比CPU percentage 平均值Average 10 分鐘10 minutes
SQL 資料倉儲SQL data warehouse physical_data_read_percentphysical_data_read_percent 資料 IO 百分比Data IO percentage 平均值Average 10 分鐘10 minutes
SQL 資料倉儲SQL data warehouse connection_successfulconnection_successful 成功的連線Successful Connections 總計Total 10 分鐘10 minutes
SQL 資料倉儲SQL data warehouse connection_failedconnection_failed 失败的连接数Failed Connections 總計Total 10 分鐘10 minutes
SQL 資料倉儲SQL data warehouse blocked_by_firewallblocked_by_firewall 遭到防火牆封鎖Blocked by Firewall 總計Total 10 分鐘10 minutes
SQL 資料倉儲SQL data warehouse service_level_objectiveservice_level_objective 資料庫的服務層Service tier of the database 總計Total 10 分鐘10 minutes
SQL 資料倉儲SQL data warehouse dwu_limitdwu_limit dwu 限制dwu limit 最大值Maximum 10 分鐘10 minutes
SQL 資料倉儲SQL data warehouse dwu_consumption_percentdwu_consumption_percent DWU 百分比DWU percentage 平均值Average 10 分鐘10 minutes
SQL 資料倉儲SQL data warehouse dwu_useddwu_used 已用的 DWUDWU used 平均值Average 10 分鐘10 minutes

後續步驟Next steps