Udostępnij za pośrednictwem


Smart Detector Alert Rules - Create Or Update

Utwórz lub zaktualizuj regułę alertu inteligentnego narzędzia do wykrywania.

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

Parametry identyfikatora URI

Nazwa W Wymagane Typ Opis
alertRuleName
path True

string

Nazwa reguły alertu.

resourceGroupName
path True

string

Nazwa grupy zasobów.

subscriptionId
path True

string

Identyfikator subskrypcji docelowej.

api-version
query True

string

Wersja interfejsu API klienta.

Treść żądania

Nazwa Wymagane Typ Opis
properties.actionGroups True

ActionGroupsInformation

Akcje reguły alertu.

properties.detector True

Detector

Detektor reguły alertu.

properties.frequency True

string

Częstotliwość reguł alertów w formacie ISO8601. Stopień szczegółowości czasu musi być wyrażony w minutach, a minimalna wartość to 5 minut.

properties.scope True

string[]

Zakres zasobów reguły alertu.

properties.severity True

Severity

Ważność reguły alertu.

properties.state True

AlertRuleState

Stan reguły alertu.

location

string

Lokalizacja zasobu.

properties.description

string

Opis reguły alertu.

properties.throttling

ThrottlingInformation

Informacje o ograniczaniu reguły alertu.

tags

object

Tagi zasobów.

Odpowiedzi

Nazwa Typ Opis
200 OK

AlertRule

Pomyślne żądanie zaktualizowania reguły alertu inteligentnego narzędzia do wykrywania.

201 Created

AlertRule

Pomyślne żądanie utworzenia reguły alertu inteligentnego narzędzia do wykrywania.

Other Status Codes

SmartDetectorErrorResponse

Odpowiedź na błąd opisująca, dlaczego operacja nie powiodła się.

Zabezpieczenia

azure_auth

Przepływ OAuth2 usługi Azure Active Directory

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

Scopes

Nazwa Opis
user_impersonation personifikacja konta użytkownika

Przykłady

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"
    }
  }
}

Definicje

Nazwa Opis
ActionGroupsInformation

Informacje o grupach akcji używane przez regułę alertu.

AlertRule

Informacje o regule alertu

AlertRuleState

Stan reguły alertu.

Detector

Informacje o detektorze. Domyślnie ta wartość nie jest wypełniana, chyba że jest określona w obiekcie expandDetector

Severity

Ważność reguły alertu.

SmartDetectorErrorResponse

Opis formatu odpowiedzi na błąd.

ThrottlingInformation

Opcjonalne informacje o ograniczaniu przepływności dla reguły alertu.

ActionGroupsInformation

Informacje o grupach akcji używane przez regułę alertu.

Nazwa Typ Opis
customEmailSubject

string

Opcjonalny niestandardowy temat wiadomości e-mail, który ma być używany w powiadomieniach e-mail.

customWebhookPayload

string

Opcjonalny niestandardowy ładunek elementu web-hook do użycia w powiadomieniach web-hook.

groupIds

string[]

Identyfikatory zasobów grupy akcji.

AlertRule

Informacje o regule alertu

Nazwa Typ Wartość domyślna Opis
id

string

Identyfikator zasobu.

location

string

global

Lokalizacja zasobu.

name

string

Nazwa zasobu.

properties.actionGroups

ActionGroupsInformation

Akcje reguły alertu.

properties.description

string

Opis reguły alertu.

properties.detector

Detector

Detektor reguły alertu.

properties.frequency

string

Częstotliwość reguł alertów w formacie ISO8601. Stopień szczegółowości czasu musi być wyrażony w minutach, a minimalna wartość to 5 minut.

properties.scope

string[]

Zakres zasobów reguły alertu.

properties.severity

Severity

Ważność reguły alertu.

properties.state

AlertRuleState

Stan reguły alertu.

properties.throttling

ThrottlingInformation

Informacje o ograniczaniu reguły alertu.

tags

object

Tagi zasobów.

type

string

Typ zasobu.

AlertRuleState

Stan reguły alertu.

Nazwa Typ Opis
Disabled

string

Enabled

string

Detector

Informacje o detektorze. Domyślnie ta wartość nie jest wypełniana, chyba że jest określona w obiekcie expandDetector

Nazwa Typ Opis
description

string

Opis inteligentnego detektora. Domyślnie ta wartość nie jest wypełniana, chyba że jest określona w obiekcie expandDetector

id

string

Identyfikator detektora.

imagePaths

string[]

Ścieżka obrazu inteligentnego narzędzia do wykrywania. Domyślnie ta wartość nie jest wypełniana, chyba że jest określona w obiekcie expandDetector

name

string

Nazwa inteligentnego detektora. Domyślnie ta wartość nie jest wypełniana, chyba że jest określona w obiekcie expandDetector

parameters

object

Parametry detektora.

supportedResourceTypes

string[]

Obsługiwane typy zasobów inteligentnego narzędzia do wykrywania. Domyślnie ta wartość nie jest wypełniana, chyba że jest określona w obiekcie expandDetector

Severity

Ważność reguły alertu.

Nazwa Typ Opis
Sev0

string

Sev1

string

Sev2

string

Sev3

string

Sev4

string

SmartDetectorErrorResponse

Opis formatu odpowiedzi na błąd.

Nazwa Typ Opis
code

string

Kod błędu

message

string

Komunikat o błędzie wskazujący, dlaczego operacja nie powiodła się.

ThrottlingInformation

Opcjonalne informacje o ograniczaniu przepływności dla reguły alertu.

Nazwa Typ Opis
duration

string

Wymagany czas trwania (w formacie ISO8601) oczekiwania przed ponownym powiadomieniem reguły alertu. Stopień szczegółowości czasu musi być wyrażony w minutach, a minimalna wartość to 0 minut