Freigeben über


Smart Detector Alert Rules - Create Or Update

Erstellen oder Aktualisieren einer Smart Detector-Warnungsregel

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.alertsManagement/smartDetectorAlertRules/{alertRuleName}?api-version=2019-06-01

URI-Parameter

Name In Erforderlich Typ Beschreibung
alertRuleName
path True

string

Der Name der Warnungsregel.

resourceGroupName
path True

string

Der Name der Ressourcengruppe.

subscriptionId
path True

string

Hierbei handelt es sich um die ID des Zielabonnements.

api-version
query True

string

Client-API-Version.

Anforderungstext

Name Erforderlich Typ Beschreibung
properties.actionGroups True

ActionGroupsInformation

Die Aktionen der Warnungsregel.

properties.detector True

Detector

Die Erkennung der Warnungsregel.

properties.frequency True

string

Die Häufigkeit der Warnungsregel in ISO8601 Format. Die Zeitgranularität muss in Minuten und der Mindestwert 5 Minuten betragen.

properties.scope True

string[]

Der Ressourcenbereich der Warnungsregel.

properties.severity True

Severity

Der Schweregrad der Warnungsregel.

properties.state True

AlertRuleState

Der Status der Warnungsregel.

location

string

Der Ressourcenspeicherort.

properties.description

string

Die Beschreibung der Warnungsregel.

properties.throttling

ThrottlingInformation

Informationen zur Drosselung der Warnungsregel.

tags

object

Die Ressourcentags.

Antworten

Name Typ Beschreibung
200 OK

AlertRule

Erfolgreiche Anforderung zum Aktualisieren einer Smart Detector-Warnungsregel.

201 Created

AlertRule

Erfolgreiche Anforderung zum Erstellen einer Smart Detector-Warnungsregel.

Other Status Codes

SmartDetectorErrorResponse

Fehlerantwort mit Beschreibung des Grunds für den Fehler.

Sicherheit

azure_auth

Azure Active Directory-OAuth2-Flow

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

Scopes

Name Beschreibung
user_impersonation Identitätswechsel Ihres Benutzerkontos

Beispiele

Create or update a Smart Detector alert rule

Sample Request

PUT https://management.azure.com/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/MyAlertRules/providers/microsoft.alertsManagement/smartDetectorAlertRules/MyAlertRule?api-version=2019-06-01

{
  "properties": {
    "description": "Sample smart detector alert rule description",
    "state": "Enabled",
    "severity": "Sev3",
    "frequency": "PT5M",
    "detector": {
      "id": "VMMemoryLeak"
    },
    "scope": [
      "/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/MyVms/providers/Microsoft.Compute/virtualMachines/vm1"
    ],
    "actionGroups": {
      "customEmailSubject": "My custom email subject",
      "customWebhookPayload": "{\"AlertRuleName\":\"#alertrulename\"}",
      "groupIds": [
        "/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourcegroups/actionGroups/providers/microsoft.insights/actiongroups/MyActionGroup"
      ]
    },
    "throttling": {
      "duration": "PT20M"
    }
  }
}

Sample Response

{
  "id": "/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/MyAlertRules/providers/microsoft.alertsManagement/smartDetectorAlertRules/MyAlertRule",
  "type": "Microsoft.AlertsManagement/smartDetectorAlertRules",
  "name": "MyAlertRule",
  "location": "global",
  "tags": {},
  "properties": {
    "description": "Sample smart detector alert rule description",
    "state": "Enabled",
    "severity": "Sev3",
    "frequency": "PT5M",
    "detector": {
      "id": "VMMemoryLeak"
    },
    "scope": [
      "/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/MyVms/providers/Microsoft.Compute/virtualMachines/vm1"
    ],
    "actionGroups": [
      {
        "actionGroupId": "/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourcegroups/actionGroups/providers/microsoft.insights/actiongroups/MyActionGroup"
      }
    ],
    "throttling": {
      "duration": "PT20M"
    }
  }
}
{
  "id": "/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/MyAlertRules/providers/microsoft.alertsManagement/smartDetectorAlertRules/MyAlertRule",
  "type": "Microsoft.AlertsManagement/smartDetectorAlertRules",
  "name": "MyAlertRule",
  "location": "global",
  "tags": {},
  "properties": {
    "description": "Sample smart detector alert rule description",
    "state": "Enabled",
    "severity": "Sev3",
    "frequency": "PT5M",
    "detector": {
      "id": "VMMemoryLeak"
    },
    "scope": [
      "/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/MyVms/providers/Microsoft.Compute/virtualMachines/vm1"
    ],
    "actionGroups": [
      {
        "actionGroupId": "/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourcegroups/actionGroups/providers/microsoft.insights/actiongroups/MyActionGroup"
      }
    ],
    "throttling": {
      "duration": "PT20M"
    }
  }
}

Definitionen

Name Beschreibung
ActionGroupsInformation

Die Informationen zu Aktionsgruppen, die von der Warnungsregel verwendet werden.

AlertRule

Informationen zur Warnungsregel

AlertRuleState

Der Status der Warnungsregel.

Detector

Die Detektorinformationen. Standardmäßig wird dies nicht aufgefüllt, es sei denn, es ist in expandDetector angegeben.

Severity

Der Schweregrad der Warnungsregel.

SmartDetectorErrorResponse

Beschreiben sie das Format einer Fehlerantwort.

ThrottlingInformation

Optionale Drosselungsinformationen für die Warnungsregel.

ActionGroupsInformation

Die Informationen zu Aktionsgruppen, die von der Warnungsregel verwendet werden.

Name Typ Beschreibung
customEmailSubject

string

Ein optionaler benutzerdefinierter E-Mail-Betreff, der in E-Mail-Benachrichtigungen verwendet werden kann.

customWebhookPayload

string

Eine optionale benutzerdefinierte Webhooknutzlast, die in Webhookbenachrichtigungen verwendet werden soll.

groupIds

string[]

Die Ressourcen-IDs der Aktionsgruppe.

AlertRule

Informationen zur Warnungsregel

Name Typ Standardwert Beschreibung
id

string

Die Ressourcen-ID.

location

string

global

Der Ressourcenspeicherort.

name

string

Der Name der Ressource.

properties.actionGroups

ActionGroupsInformation

Die Aktionen der Warnungsregel.

properties.description

string

Die Beschreibung der Warnungsregel.

properties.detector

Detector

Die Erkennung der Warnungsregel.

properties.frequency

string

Die Häufigkeit der Warnungsregel in ISO8601 Format. Die Zeitgranularität muss in Minuten und der Mindestwert 5 Minuten betragen.

properties.scope

string[]

Der Ressourcenbereich der Warnungsregel.

properties.severity

Severity

Der Schweregrad der Warnungsregel.

properties.state

AlertRuleState

Der Status der Warnungsregel.

properties.throttling

ThrottlingInformation

Informationen zur Drosselung der Warnungsregel.

tags

object

Die Ressourcentags.

type

string

Der Ressourcentyp.

AlertRuleState

Der Status der Warnungsregel.

Name Typ Beschreibung
Disabled

string

Enabled

string

Detector

Die Detektorinformationen. Standardmäßig wird dies nicht aufgefüllt, es sei denn, es ist in expandDetector angegeben.

Name Typ Beschreibung
description

string

Die Beschreibung der intelligenten Erkennung. Standardmäßig wird dies nicht aufgefüllt, es sei denn, es ist in expandDetector angegeben.

id

string

Die Detektor-ID.

imagePaths

string[]

Der Smart Detector-Bildpfad. Standardmäßig wird dies nicht aufgefüllt, es sei denn, es ist in expandDetector angegeben.

name

string

Der Name der intelligenten Erkennung. Standardmäßig wird dies nicht aufgefüllt, es sei denn, es ist in expandDetector angegeben.

parameters

object

Die Parameter des Detektors."

supportedResourceTypes

string[]

Die smarte Erkennung unterstützt Ressourcentypen. Standardmäßig wird dies nicht aufgefüllt, es sei denn, es ist in expandDetector angegeben.

Severity

Der Schweregrad der Warnungsregel.

Name Typ Beschreibung
Sev0

string

Sev1

string

Sev2

string

Sev3

string

Sev4

string

SmartDetectorErrorResponse

Beschreiben sie das Format einer Fehlerantwort.

Name Typ Beschreibung
code

string

Fehlercode

message

string

Eine Fehlermeldung, die angibt, warum der Vorgang fehlgeschlagen ist.

ThrottlingInformation

Optionale Drosselungsinformationen für die Warnungsregel.

Name Typ Beschreibung
duration

string

Die erforderliche Dauer (im ISO8601 Format), um zu warten, bevor die Warnungsregel erneut benachrichtigt wird. Die Zeitgranularität muss in Minuten und der Mindestwert 0 Minuten betragen.