Aracılığıyla paylaş


Metric Alerts - Create Or Update

Ölçüm uyarısı tanımı oluşturma veya güncelleştirme.

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

URI Parametreleri

Name İçinde Gerekli Tür Description
resourceGroupName
path True

string

minLength: 1
maxLength: 90

Kaynak grubunun adı. Ad büyük/küçük harfe duyarsız.

ruleName
path True

string

Kuralın adı.

subscriptionId
path True

string

minLength: 1

Hedef aboneliğin kimliği.

api-version
query True

string

minLength: 1

Bu işlem için kullanılacak API sürümü.

İstek Gövdesi

Name Gerekli Tür Description
location True

string

Kaynak konumu

properties.criteria True MetricAlertCriteria:

belirli uyarı ölçüt bilgilerini tanımlar.

properties.enabled True

boolean

ölçüm uyarısının etkinleştirilip etkinleştirilmediğini gösteren bayrak.

properties.evaluationFrequency True

string (duration)

ölçüm uyarısının ISO 8601 süre biçiminde ne sıklıkta değerlendirildiğinden.

properties.scopes True

string[]

bu ölçüm uyarısının kapsamına alınan kaynak kimliklerinin listesi. Günlükleri temel alan bir ölçüm kuralının kapsamını değiştiremezsiniz.

properties.severity True

integer (int32)

Uyarı önem derecesi {0, 1, 2, 3, 4}

properties.windowSize True

string (duration)

eşik temelinde uyarı etkinliğini izlemek için kullanılan süre (ISO 8601 süre biçiminde).

properties.actions

MetricAlertAction[]

uyarı kuralı etkin olduğunda ve bir uyarı koşulu çözümlendiğinde gerçekleştirilen eylemler dizisi.

properties.autoMitigate

boolean

uyarının otomatik olarak çözümlenip çözümlenmeyeceğini gösteren bayrak. Varsayılan değer true'dur.

properties.description

string

uyarı e-postasında yer alacak ölçüm uyarısının açıklaması.

properties.targetResourceRegion

string

uyarının oluşturulduğu/güncelleştirildiği hedef kaynakların bölgesi. Kapsam bir abonelik, kaynak grubu veya birden fazla kaynak içeriyorsa zorunlu.

properties.targetResourceType

string

uyarının oluşturulduğu/güncelleştirildiği hedef kaynakların kaynak türü. Kapsam bir abonelik, kaynak grubu veya birden fazla kaynak içeriyorsa zorunlu.

tags

object

Kaynak etiketleri

Yanıtlar

Name Tür Description
200 OK

MetricAlertResource

TAMAM

Other Status Codes

ErrorResponse

BadRequest

Güvenlik

azure_auth

Azure Active Directory OAuth2 Akışı

Tür: oauth2
Akış: implicit
Yetkilendirme URL’si: https://login.microsoftonline.com/common/oauth2/authorize

Kapsamlar

Name Description
user_impersonation kullanıcı hesabınızın kimliğine bürünme

Örnekler

Create or update a dynamic alert rule for Multiple Resources
Create or update a dynamic alert rule for Single Resource
Create or update a web test alert rule
Create or update an alert rule for Multiple Resource
Create or update an alert rule for Single Resource
Create or update an alert rule on Resource group(s)
Create or update an alert rule on Subscription
Create or update an alert rules with dimensions

Create or update a dynamic alert rule for Multiple Resources

Örnek isteği

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/MetricAlertOnMultipleResources?api-version=2018-03-01

{
  "location": "global",
  "tags": {},
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1",
      "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "DynamicThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "operator": "GreaterOrLessThan",
          "timeAggregation": "Average",
          "dimensions": [],
          "alertSensitivity": "Medium",
          "failingPeriods": {
            "numberOfEvaluationPeriods": 4,
            "minFailingPeriodsToAlert": 4
          }
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Örnek yanıt

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources",
  "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/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1",
      "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "DynamicThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "operator": "GreaterOrLessThan",
          "timeAggregation": "Average",
          "dimensions": [],
          "alertSensitivity": "Medium",
          "failingPeriods": {
            "numberOfEvaluationPeriods": 4,
            "minFailingPeriodsToAlert": 4
          }
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Create or update a dynamic alert rule for Single Resource

Örnek isteği

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/chiricutin?api-version=2018-03-01

{
  "location": "global",
  "tags": {},
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "DynamicThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "operator": "GreaterOrLessThan",
          "timeAggregation": "Average",
          "dimensions": [],
          "alertSensitivity": "Medium",
          "failingPeriods": {
            "numberOfEvaluationPeriods": 4,
            "minFailingPeriodsToAlert": 4
          },
          "ignoreDataBefore": "2019-04-04T21:00:00.000Z"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Örnek yanıt

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin",
  "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/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "DynamicThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "operator": "GreaterOrLessThan",
          "timeAggregation": "Average",
          "dimensions": [],
          "alertSensitivity": "Medium",
          "failingPeriods": {
            "numberOfEvaluationPeriods": 4,
            "minFailingPeriodsToAlert": 4
          },
          "ignoreDataBefore": "2019-04-04T21:00:00.000Z"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Create or update a web test alert rule

Örnek isteği

PUT https://management.azure.com/subscriptions/12345678-1234-1234-1234-123456789101/resourceGroups/rg-example/providers/Microsoft.Insights/metricAlerts/webtest-name-example?api-version=2018-03-01

{
  "location": "global",
  "tags": {
    "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example": "Resource",
    "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example": "Resource"
  },
  "properties": {
    "description": "Automatically created alert rule for availability test \"component-example\" a",
    "enabled": true,
    "severity": 4,
    "windowSize": "PT15M",
    "evaluationFrequency": "PT1M",
    "criteria": {
      "failedLocationCount": 2,
      "webTestId": "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example",
      "componentId": "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example",
      "odata.type": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria"
    },
    "actions": [],
    "scopes": [
      "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example",
      "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example"
    ]
  }
}

Örnek yanıt

{
  "location": "global",
  "type": "Microsoft.Insights/metricAlerts",
  "name": "webtest-name-example",
  "id": "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/metricalerts/webtest-name-example",
  "tags": {
    "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example": "Resource",
    "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example": "Resource"
  },
  "properties": {
    "description": "Automatically created alert rule for availability test \"webtest-name-example\" a",
    "severity": 4,
    "enabled": true,
    "scopes": [
      "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example",
      "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "criteria": {
      "webTestId": "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example",
      "componentId": "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example",
      "failedLocationCount": 2,
      "odata.type": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria"
    },
    "actions": []
  }
}

Create or update an alert rule for Multiple Resource

Örnek isteği

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

{
  "location": "global",
  "tags": {},
  "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/gigwadme1",
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "StaticThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 80.5,
          "timeAggregation": "Average"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Örnek yanıt

{
  "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources",
  "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/gigwadme1",
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "StaticThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 80.5,
          "timeAggregation": "Average"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Create or update an alert rule for Single Resource

Örnek isteği

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

{
  "location": "global",
  "tags": {},
  "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": "\\Processor(_Total)\\% Processor Time",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 80.5,
          "timeAggregation": "Average"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Örnek yanıt

{
  "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin",
  "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": "\\Processor(_Total)\\% Processor Time",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 80.5,
          "timeAggregation": "Average"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Create or update an alert rule on Resource group(s)

Örnek isteği

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

{
  "location": "global",
  "tags": {},
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1",
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "StaticThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 80.5,
          "timeAggregation": "Average"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Örnek yanıt

{
  "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1/providers/providers/microsoft.insights/metricalerts/MetricAlertAtResourceGroupLevel",
  "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/gigtest1",
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "StaticThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 80.5,
          "timeAggregation": "Average"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Create or update an alert rule on Subscription

Örnek isteği

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

{
  "location": "global",
  "tags": {},
  "properties": {
    "description": "This is the description of the rule1",
    "severity": 3,
    "enabled": true,
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "StaticThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 80.5,
          "timeAggregation": "Average"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Örnek yanıt

{
  "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertAtSubscriptionLevel",
  "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"
    ],
    "evaluationFrequency": "PT1M",
    "windowSize": "PT15M",
    "targetResourceType": "Microsoft.Compute/virtualMachines",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "criterionType": "StaticThresholdCriterion",
          "name": "High_CPU_80",
          "metricName": "Percentage CPU",
          "metricNamespace": "microsoft.compute/virtualmachines",
          "dimensions": [],
          "operator": "GreaterThan",
          "threshold": 80.5,
          "timeAggregation": "Average"
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Create or update an alert rules with dimensions

Örnek isteği

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

{
  "location": "global",
  "tags": {},
  "properties": {
    "description": "This is the description of the rule1",
    "enabled": true,
    "severity": 3,
    "windowSize": "P1D",
    "evaluationFrequency": "PT1H",
    "scopes": [
      "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource"
    ],
    "criteria": {
      "allOf": [
        {
          "metricName": "Availability",
          "metricNamespace": "Microsoft.KeyVault/vaults",
          "operator": "GreaterThan",
          "timeAggregation": "Average",
          "name": "Metric1",
          "dimensions": [
            {
              "name": "ActivityName",
              "operator": "Include",
              "values": [
                "*"
              ]
            },
            {
              "name": "StatusCode",
              "operator": "Include",
              "values": [
                "200"
              ]
            }
          ],
          "criterionType": "StaticThresholdCriterion",
          "threshold": 55
        }
      ],
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria"
    },
    "actions": [
      {
        "actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ],
    "autoMitigate": true
  }
}

Örnek yanıt

{
  "id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertWithDimensions",
  "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.KeyVault/vaults/keyVaultResource"
    ],
    "evaluationFrequency": "PT1H",
    "windowSize": "P1D",
    "targetResourceType": "Microsoft.KeyVault/vaults",
    "targetResourceRegion": "southcentralus",
    "criteria": {
      "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
      "allOf": [
        {
          "metricName": "Availability",
          "metricNamespace": "Microsoft.KeyVault/vaults",
          "operator": "GreaterThan",
          "timeAggregation": "Average",
          "name": "Metric1",
          "dimensions": [
            {
              "name": "ActivityName",
              "operator": "Include",
              "values": [
                "*"
              ]
            },
            {
              "name": "StatusCode",
              "operator": "Include",
              "values": [
                "200"
              ]
            }
          ],
          "criterionType": "StaticThresholdCriterion",
          "threshold": 55
        }
      ]
    },
    "autoMitigate": true,
    "actions": [
      {
        "actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
        "webHookProperties": {
          "key11": "value11",
          "key12": "value12"
        }
      }
    ]
  }
}

Tanımlar

Name Description
AdditionalInfo

'type' ve 'info' özelliklerine sahip bir nesne dizisi. 'info' şeması hizmete özgüdür ve 'tür' dizesine bağımlıdır.

AggregationTypeEnum

ölçüt zaman toplama türleri.

DynamicMetricCriteria

Dinamik eşik ölçütü.

DynamicThresholdFailingPeriods

Uyarı göndermek için gereken, seçilen geri arama zaman penceresinde gereken en düşük ihlal sayısı.

DynamicThresholdOperator

Ölçüm değerini eşikle karşılaştırmak için kullanılan işleç.

DynamicThresholdSensitivity

Uyarı tetikleme için gereken sapma kapsamı. Bu, eşiğin ölçüm serisi düzenine ne kadar sıkı olduğunu etkiler.

Error
ErrorDetail

Hata yanıtının ayrıntılarını açıklar.

ErrorResponse

Hata yanıtının biçimini açıklar.

MetricAlertAction

Bir uyarı eylemi.

MetricAlertMultipleResourceMultipleMetricCriteria

Birden çok ölçüm ölçütü olan birden çok kaynak için ölçüm uyarısı ölçütlerini belirtir.

MetricAlertResource

Ölçüm uyarısı kaynağı.

MetricAlertSingleResourceMultipleMetricCriteria

Birden çok ölçüm ölçütüne sahip tek bir kaynak için ölçüm uyarısı ölçütlerini belirtir.

MetricCriteria

Ölçümleri filtreleme ölçütü.

MetricDimension

Ölçüm boyutunu belirtir.

Operator

ölçüt işleci.

WebtestLocationAvailabilityCriteria

Web testi kaynağı için ölçüm uyarısı kuralı ölçütlerini belirtir.

AdditionalInfo

'type' ve 'info' özelliklerine sahip bir nesne dizisi. 'info' şeması hizmete özgüdür ve 'tür' dizesine bağımlıdır.

Name Tür Description
info

object

Türüne özgü ek bilgiler.

type

string

Ek bilgi türü.

AggregationTypeEnum

ölçüt zaman toplama türleri.

Değer Description
Average
Count
Maximum
Minimum
Total

DynamicMetricCriteria

Dinamik eşik ölçütü.

Name Tür Description
alertSensitivity

DynamicThresholdSensitivity

Uyarı tetikleme için gereken sapma kapsamı. Bu, eşiğin ölçüm serisi düzenine ne kadar sıkı olduğunu etkiler.

criterionType string:

DynamicThresholdCriterion

Eşik ölçütlerinin türünü belirtir

dimensions

MetricDimension[]

Boyut koşullarının listesi.

failingPeriods

DynamicThresholdFailingPeriods

Uyarı göndermek için gereken, seçilen geri arama zaman penceresinde gereken en düşük ihlal sayısı.

ignoreDataBefore

string (date-time)

Ölçüm geçmiş verilerini öğrenmeye başlayacağınız tarihi ayarlamak ve dinamik eşikleri hesaplamak için bu seçeneği kullanın (ISO8601 biçimde)

metricName

string

Ölçümün adı.

metricNamespace

string

Ölçümün ad alanı.

name

string

Ölçüt adı.

operator

DynamicThresholdOperator

Ölçüm değerini eşikle karşılaştırmak için kullanılan işleç.

skipMetricValidation

boolean

Ölçüm doğrulamasının atlanmasına neden olarak, henüz yayınlanmamış bir özel ölçümde uyarı kuralı oluşturmaya izin verir.

timeAggregation

AggregationTypeEnum

ölçüt zaman toplama türleri.

DynamicThresholdFailingPeriods

Uyarı göndermek için gereken, seçilen geri arama zaman penceresinde gereken en düşük ihlal sayısı.

Name Tür Description
minFailingPeriodsToAlert

number

Uyarı tetikleme ihlallerinin sayısı. NumberOfEvaluationPeriods değerine eşit veya daha küçük olmalıdır.

numberOfEvaluationPeriods

number

Toplanan geri arama noktalarının sayısı. Geri arama zamanı penceresi toplama ayrıntı düzeyi (windowSize) ve seçili toplanan nokta sayısına göre hesaplanır.

DynamicThresholdOperator

Ölçüm değerini eşikle karşılaştırmak için kullanılan işleç.

Değer Description
GreaterOrLessThan
GreaterThan
LessThan

DynamicThresholdSensitivity

Uyarı tetikleme için gereken sapma kapsamı. Bu, eşiğin ölçüm serisi düzenine ne kadar sıkı olduğunu etkiler.

Değer Description
High
Low
Medium

Error

Name Tür Description
additionalInfo

AdditionalInfo[]

'type' ve 'info' özelliklerine sahip bir nesne dizisi. 'info' şeması hizmete özgüdür ve 'tür' dizesine bağımlıdır.

code

string

Hatayı program aracılığıyla tanımlamak için kullanılabilecek, ayrılmamış dize.

details

ErrorDetail[]

Bu sözleşmede açıklandığı gibi ek iç içe hata yanıtı bilgi nesneleri dizisi.

message

string

Hatayı ayrıntılı olarak açıklar ve hata ayıklama bilgileri sağlar. İstekte Accept-Language ayarlandıysa, bu dilde yerelleştirilmelidir.

target

string

Belirli bir hatanın hedefi (örneğin, hatadaki özelliğin adı).

ErrorDetail

Hata yanıtının ayrıntılarını açıklar.

Name Tür Description
additionalInfo

AdditionalInfo[]

'type' ve 'info' özelliklerine sahip bir nesne dizisi. 'info' şeması hizmete özgüdür ve 'tür' dizesine bağımlıdır.

code

string

Hatayı program aracılığıyla tanımlamak için kullanılabilecek, ayrılmamış dize.

message

string

Hatayı ayrıntılı olarak açıklar ve hata ayıklama bilgileri sağlar.

target

string

Belirli bir hatanın hedefi (örneğin, hatadaki özelliğin adı).

ErrorResponse

Hata yanıtının biçimini açıklar.

Name Tür Description
error

Error

MetricAlertAction

Bir uyarı eylemi.

Name Tür Description
actionGroupId

string

kullanılacak eylem grubunun kimliği.

webHookProperties

object

Bu alan, web kancasına giriş olarak gönderilen uyarı yüküne eklenecek özel özelliklerin belirtilmesine olanak tanır.

MetricAlertMultipleResourceMultipleMetricCriteria

Birden çok ölçüm ölçütü olan birden çok kaynak için ölçüm uyarısı ölçütlerini belirtir.

Name Tür Description
allOf MultiMetricCriteria[]:

bu 'tümü' işlemi için birden çok ölçüm ölçütünün listesi.

odata.type string:

Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria

uyarı ölçütlerinin türünü belirtir.

MetricAlertResource

Ölçüm uyarısı kaynağı.

Name Tür Description
id

string

Azure kaynak kimliği

location

string

Kaynak konumu

name

string

Azure kaynak adı

properties.actions

MetricAlertAction[]

uyarı kuralı etkin olduğunda ve bir uyarı koşulu çözümlendiğinde gerçekleştirilen eylemler dizisi.

properties.autoMitigate

boolean

uyarının otomatik olarak çözümlenip çözümlenmeyeceğini gösteren bayrak. Varsayılan değer true'dur.

properties.criteria MetricAlertCriteria:

belirli uyarı ölçüt bilgilerini tanımlar.

properties.description

string

uyarı e-postasında yer alacak ölçüm uyarısının açıklaması.

properties.enabled

boolean

ölçüm uyarısının etkinleştirilip etkinleştirilmediğini gösteren bayrak.

properties.evaluationFrequency

string (duration)

ölçüm uyarısının ISO 8601 süre biçiminde ne sıklıkta değerlendirildiğinden.

properties.isMigrated

boolean

bu uyarı kuralının geçirilip geçirildiğini gösteren değer.

properties.lastUpdatedTime

string (date-time)

Kuralın en son ISO8601 biçimde güncelleştirilişi.

properties.scopes

string[]

bu ölçüm uyarısının kapsamına alınan kaynak kimliklerinin listesi. Günlükleri temel alan bir ölçüm kuralının kapsamını değiştiremezsiniz.

properties.severity

integer (int32)

Uyarı önem derecesi {0, 1, 2, 3, 4}

properties.targetResourceRegion

string

uyarının oluşturulduğu/güncelleştirildiği hedef kaynakların bölgesi. Kapsam bir abonelik, kaynak grubu veya birden fazla kaynak içeriyorsa zorunlu.

properties.targetResourceType

string

uyarının oluşturulduğu/güncelleştirildiği hedef kaynakların kaynak türü. Kapsam bir abonelik, kaynak grubu veya birden fazla kaynak içeriyorsa zorunlu.

properties.windowSize

string (duration)

eşik temelinde uyarı etkinliğini izlemek için kullanılan süre (ISO 8601 süre biçiminde).

tags

object

Kaynak etiketleri

type

string

Azure kaynak türü

MetricAlertSingleResourceMultipleMetricCriteria

Birden çok ölçüm ölçütüne sahip tek bir kaynak için ölçüm uyarısı ölçütlerini belirtir.

Name Tür Description
allOf

MetricCriteria[]

Bu 'tümü' işlemi için ölçüm ölçütlerinin listesi.

odata.type string:

Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria

uyarı ölçütlerinin türünü belirtir.

MetricCriteria

Ölçümleri filtreleme ölçütü.

Name Tür Description
criterionType string:

StaticThresholdCriterion

Eşik ölçütlerinin türünü belirtir

dimensions

MetricDimension[]

Boyut koşullarının listesi.

metricName

string

Ölçümün adı.

metricNamespace

string

Ölçümün ad alanı.

name

string

Ölçüt adı.

operator

Operator

ölçüt işleci.

skipMetricValidation

boolean

Ölçüm doğrulamasının atlanmasına neden olarak, henüz yayınlanmamış bir özel ölçümde uyarı kuralı oluşturmaya izin verir.

threshold

number (double)

uyarıyı etkinleştiren ölçüt eşik değeri.

timeAggregation

AggregationTypeEnum

ölçüt zaman toplama türleri.

MetricDimension

Ölçüm boyutunu belirtir.

Name Tür Description
name

string

Boyutun adı.

operator

string

boyut işleci. Yalnızca 'Dahil Et' ve 'Dışla' desteklenir

values

string[]

boyut değerlerinin listesi.

Operator

ölçüt işleci.

Değer Description
Equals
GreaterThan
GreaterThanOrEqual
LessThan
LessThanOrEqual

WebtestLocationAvailabilityCriteria

Web testi kaynağı için ölçüm uyarısı kuralı ölçütlerini belirtir.

Name Tür Description
componentId

string

Application Insights kaynak kimliği.

failedLocationCount

number

Başarısız konumların sayısı.

odata.type string:

Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria

uyarı ölçütlerinin türünü belirtir.

webTestId

string

Application Insights web testi kimliği.