Metric Alerts - List By Resource Group

擷取資源群組中的警示規則定義。

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts?api-version=2018-03-01

URI 參數

名稱 位於 必要 類型 Description
resourceGroupName
path True

string

資源群組的名稱。 名稱不區分大小寫。

subscriptionId
path True

string

目標訂用帳戶的標識碼。

api-version
query True

string

用於此作業的 API 版本。

回應

名稱 類型 Description
200 OK

MetricAlertResourceCollection

計量警示清單的成功要求

Other Status Codes

ErrorResponse

BadRequest

安全性

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名稱 Description
user_impersonation 模擬您的用戶帳戶

範例

List metric alert rules

Sample Request

GET https://management.azure.com/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts?api-version=2018-03-01

Sample Response

{
  "value": [
    {
      "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/highcpu",
      "type": "Microsoft.Insights/metricAlerts",
      "location": "global",
      "tags": {
        "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
      },
      "properties": {
        "description": "This is the description of the rule1",
        "severity": 3,
        "enabled": true,
        "scopes": [
          "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"
        ],
        "evaluationFrequency": "Pt1m",
        "windowSize": "Pt15m",
        "criteria": {
          "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria",
          "allOf": [
            {
              "criterionType": "StaticThresholdCriterion",
              "name": "High_CPU_80",
              "metricName": "CustomMetric_\\Processor(_Total)\\% Processor Time",
              "dimensions": [],
              "operator": "GreaterThan",
              "threshold": 80.5,
              "timeAggregation": "Average"
            }
          ]
        },
        "actions": [
          {
            "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
            "webHookProperties": {
              "key11": "value11",
              "key12": "value12"
            }
          }
        ]
      }
    },
    {
      "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/mediumcpu",
      "type": "Microsoft.Insights/metricAlerts",
      "location": "global",
      "tags": {
        "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
      },
      "properties": {
        "description": "Med cpu alert",
        "severity": 4,
        "enabled": true,
        "scopes": [
          "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"
        ],
        "evaluationFrequency": "Pt1m",
        "windowSize": "Pt15m",
        "criteria": {
          "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria",
          "allOf": [
            {
              "criterionType": "StaticThresholdCriterion",
              "name": "Medium_CPU_50",
              "metricName": "CustomMetric_\\Processor(_Total)\\% Processor Time",
              "dimensions": [],
              "operator": "GreaterThan",
              "threshold": 50.5,
              "timeAggregation": "Average"
            }
          ]
        },
        "actions": [
          {
            "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
            "webHookProperties": {
              "key11": "value11",
              "key12": "value12"
            }
          }
        ]
      }
    }
  ]
}

定義

名稱 Description
AggregationTypeEnum

準則時間匯總類型。

DynamicMetricCriteria

動態閾值的準則。

DynamicThresholdFailingPeriods

在引發警示所需的所選回溯時間範圍內,所需的違規次數下限。

DynamicThresholdOperator

用來比較計量值與閾值的運算符。

DynamicThresholdSensitivity

觸發警示所需的偏差範圍。 這會影響臨界值與計量系列模式的緊密程度。

ErrorResponse

描述錯誤回應的格式。

MetricAlertAction

警示動作。

MetricAlertMultipleResourceMultipleMetricCriteria

針對具有多個計量準則的多個資源,指定計量警示準則。

MetricAlertResource

計量警示資源。

MetricAlertResourceCollection

表示警示規則資源的集合。

MetricAlertSingleResourceMultipleMetricCriteria

指定具有多個計量準則之單一資源的計量警示準則。

MetricCriteria

篩選計量的準則。

MetricDimension

指定計量維度。

Operator

criteria 運算子。

WebtestLocationAvailabilityCriteria

指定 Web 測試資源的計量警示規則準則。

AggregationTypeEnum

準則時間匯總類型。

名稱 類型 Description
Average

string

Count

string

Maximum

string

Minimum

string

Total

string

DynamicMetricCriteria

動態閾值的準則。

名稱 類型 Description
alertSensitivity

DynamicThresholdSensitivity

觸發警示所需的偏差範圍。 這會影響臨界值與計量系列模式的緊密程度。

criterionType string:

DynamicThresholdCriterion

指定臨界值準則的類型

dimensions

MetricDimension[]

維度條件的清單。

failingPeriods

DynamicThresholdFailingPeriods

在引發警示所需的所選回溯時間範圍內,所需的違規次數下限。

ignoreDataBefore

string

使用此選項可設定開始學習計量歷程記錄數據的日期,並以ISO8601格式計算動態閾值 ()

metricName

string

計量的名稱。

metricNamespace

string

計量的命名空間。

name

string

準則的名稱。

operator

DynamicThresholdOperator

用來比較計量值與閾值的運算符。

skipMetricValidation

boolean

藉由導致略過計量驗證,允許針對尚未發出的自訂計量建立警示規則。

timeAggregation

AggregationTypeEnum

準則時間匯總類型。

DynamicThresholdFailingPeriods

在引發警示所需的所選回溯時間範圍內,所需的違規次數下限。

名稱 類型 Description
minFailingPeriodsToAlert

number

觸發警示的違規次數。 應小於或等於 numberOfEvaluationPeriods。

numberOfEvaluationPeriods

number

匯總回溯點的數目。 回溯時間範圍是根據匯總數據粒度計算, (windowSize) 和選取的匯總點數目。

DynamicThresholdOperator

用來比較計量值與閾值的運算符。

名稱 類型 Description
GreaterOrLessThan

string

GreaterThan

string

LessThan

string

DynamicThresholdSensitivity

觸發警示所需的偏差範圍。 這會影響臨界值與計量系列模式的緊密程度。

名稱 類型 Description
High

string

Low

string

Medium

string

ErrorResponse

描述錯誤回應的格式。

名稱 類型 Description
code

string

錯誤碼

message

string

錯誤訊息,指出作業失敗的原因。

MetricAlertAction

警示動作。

名稱 類型 Description
actionGroupId

string

要使用的動作群組標識碼。

webHookProperties

object

此欄位允許指定自定義屬性,這會附加至傳送為 Webhook 輸入的警示承載。

MetricAlertMultipleResourceMultipleMetricCriteria

針對具有多個計量準則的多個資源,指定計量警示準則。

名稱 類型 Description
allOf MultiMetricCriteria[]:

此「全部」作業的多個計量準則清單。

odata.type string:

Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria

會指定警示準則的類型。

MetricAlertResource

計量警示資源。

名稱 類型 Description
id

string

Azure 資源標識碼

location

string

資源位置

name

string

Azure 資源名稱

properties.actions

MetricAlertAction[]

當警示規則變成作用中時,以及解決警示條件時所執行的動作陣列。

properties.autoMitigate

boolean

旗標,指出是否應該自動解決警示。 預設值是 true。

properties.criteria MetricAlertCriteria:

定義特定的警示準則資訊。

properties.description

string

將包含在警示電子郵件中的計量警示描述。

properties.enabled

boolean

旗標,指出是否啟用計量警示。

properties.evaluationFrequency

string

以 ISO 8601 持續時間格式來評估計量警示的頻率。

properties.isMigrated

boolean

值,指出是否已移轉此警示規則。

properties.lastUpdatedTime

string

上次以ISO8601格式更新規則的時間。

properties.scopes

string[]

此計量警示的範圍是資源標識碼的清單。

properties.severity

integer

警示嚴重性 {0, 1, 2, 3, 4}

properties.targetResourceRegion

string

建立/更新警示的目標資源區域 () 。 如果範圍包含訂用帳戶、資源群組或多個資源,則為必要專案。

properties.targetResourceType

string

目標資源的資源類型 (建立/更新警示) 。 如果範圍包含訂用帳戶、資源群組或多個資源,則為必要專案。

properties.windowSize

string

ISO 8601 持續時間格式 (期間) ,用來根據閾值監視警示活動。

tags

object

資源標籤

type

string

Azure 資源類型

MetricAlertResourceCollection

表示警示規則資源的集合。

名稱 類型 Description
value

MetricAlertResource[]

警示規則資源的值。

MetricAlertSingleResourceMultipleMetricCriteria

指定具有多個計量準則之單一資源的計量警示準則。

名稱 類型 Description
allOf

MetricCriteria[]

此「全部」作業的計量準則清單。

odata.type string:

Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria

會指定警示準則的類型。

MetricCriteria

篩選計量的準則。

名稱 類型 Description
criterionType string:

StaticThresholdCriterion

指定臨界值準則的類型

dimensions

MetricDimension[]

維度條件的清單。

metricName

string

計量的名稱。

metricNamespace

string

計量的命名空間。

name

string

準則的名稱。

operator

Operator

criteria 運算子。

skipMetricValidation

boolean

藉由導致略過計量驗證,允許針對尚未發出的自訂計量建立警示規則。

threshold

number

啟動警示的準則閾值。

timeAggregation

AggregationTypeEnum

準則時間匯總類型。

MetricDimension

指定計量維度。

名稱 類型 Description
name

string

維度的名稱。

operator

string

維度運算子。 僅支援 'Include' 和 'Exclude'

values

string[]

維度值的清單。

Operator

criteria 運算子。

名稱 類型 Description
Equals

string

GreaterThan

string

GreaterThanOrEqual

string

LessThan

string

LessThanOrEqual

string

WebtestLocationAvailabilityCriteria

指定 Web 測試資源的計量警示規則準則。

名稱 類型 Description
componentId

string

Application Insights 資源標識符。

failedLocationCount

number

失敗的位置數目。

odata.type string:

Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria

會指定警示準則的類型。

webTestId

string

Application Insights Web 測試標識符。