{ "swagger": "2.0", "info": { "version": "2018-03-01", "title": "MonitorManagementClient", "x-ms-code-generation-settings": { "name": "MonitorManagementClient" }, "description": "Azure Monitor client to create/update/delete metric based alerts." }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts": { "get": { "tags": [ "MetricAlerts" ], "description": "Retrieve alert rule definitions in a subscription.", "operationId": "MetricAlerts_ListBySubscription", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "Successful request for a list of metric alerts", "schema": { "$ref": "#/definitions/MetricAlertResourceCollection" } }, "default": { "description": "BadRequest", "schema": { "$ref": "../../stable/2016-03-01/alertRules_API.json#/definitions/ErrorResponse" } } }, "x-ms-pageable": { "nextLinkName": null }, "x-ms-examples": { "List metric alert rules": { "$ref": "./examples/listMetricAlert.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts": { "get": { "tags": [ "MetricAlerts" ], "description": "Retrieve alert rule definitions in a resource group.", "operationId": "MetricAlerts_ListByResourceGroup", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "Successful request for a list of metric alerts", "schema": { "$ref": "#/definitions/MetricAlertResourceCollection" } }, "default": { "description": "BadRequest", "schema": { "$ref": "../../stable/2016-03-01/alertRules_API.json#/definitions/ErrorResponse" } } }, "x-ms-pageable": { "nextLinkName": null }, "x-ms-examples": { "List metric alert rules": { "$ref": "./examples/listMetricAlert.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}": { "get": { "tags": [ "MetricAlerts" ], "description": "Retrieve an alert rule definition.", "operationId": "MetricAlerts_Get", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "#/parameters/RuleNameParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "Successful request for a list of metric alerts", "schema": { "$ref": "#/definitions/MetricAlertResource" } }, "default": { "description": "BadRequest", "schema": { "$ref": "../../stable/2016-03-01/alertRules_API.json#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Get an alert rule for single resource": { "$ref": "./examples/getMetricAlertSingleResource.json" }, "Get an alert rule for multiple resources": { "$ref": "./examples/getMetricAlertMultipleResource.json" }, "Get an alert rule on resource group(s)": { "$ref": "./examples/getMetricAlertResourceGroup.json" }, "Get an alert rule on subscription": { "$ref": "./examples/getMetricAlertSubscription.json" }, "Get a dynamic alert rule for single resource": { "$ref": "./examples/getDynamicMetricAlertSingleResource.json" }, "Get a dynamic alert rule for multiple resources": { "$ref": "./examples/getDynamicMetricAlertMultipleResource.json" }, "Get a web test alert rule": { "$ref": "./examples/getWebTestMetricAlert.json" } } }, "put": { "tags": [ "MetricAlerts" ], "description": "Create or update an metric alert definition.", "operationId": "MetricAlerts_CreateOrUpdate", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "#/parameters/RuleNameParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter" }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/MetricAlertResource" }, "description": "The parameters of the rule to create or update." } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/MetricAlertResource" } }, "default": { "description": "BadRequest", "schema": { "$ref": "../../stable/2016-03-01/alertRules_API.json#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Create or update an alert rule for Single Resource": { "$ref": "./examples/createOrUpdateMetricAlertSingleResource.json" }, "Create or update an alert rule for Multiple Resource": { "$ref": "./examples/createOrUpdateMetricAlertMultipleResource.json" }, "Create or update an alert rule on Resource group(s)": { "$ref": "./examples/createOrUpdateMetricAlertResourceGroup.json" }, "Create or update an alert rule on Subscription ": { "$ref": "./examples/createOrUpdateMetricAlertSubscription.json" }, "Create or update a dynamic alert rule for Single Resource": { "$ref": "./examples/createOrUpdateDynamicMetricAlertSingleResource.json" }, "Create or update a dynamic alert rule for Multiple Resources": { "$ref": "./examples/createOrUpdateDynamicMetricAlertMultipleResource.json" }, "Create or update a web test alert rule": { "$ref": "./examples/createOrUpdateWebTestMetricAlert.json" }, "Create or update an alert rules with dimensions": { "$ref": "./examples/createOrUpdateMetricAlertWithDimensions.json" } } }, "patch": { "tags": [ "MetricAlerts" ], "description": "Update an metric alert definition.", "operationId": "MetricAlerts_Update", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "#/parameters/RuleNameParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter" }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/MetricAlertResourcePatch" }, "description": "The parameters of the rule to update." } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/MetricAlertResource" } }, "default": { "description": "BadRequest", "schema": { "$ref": "../../stable/2016-03-01/alertRules_API.json#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Create or update an alert rule": { "$ref": "./examples/UpdateMetricAlert.json" } } }, "delete": { "tags": [ "MetricAlerts" ], "description": "Delete an alert rule definition.", "operationId": "MetricAlerts_Delete", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "#/parameters/RuleNameParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "Successful request to delete an metric alert rule" }, "204": { "description": "No content: the request was successful, but the response is empty" }, "default": { "description": "BadRequest", "schema": { "$ref": "../../stable/2016-03-01/alertRules_API.json#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Delete an alert rule": { "$ref": "./examples/deleteMetricAlert.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status": { "get": { "tags": [ "MetricAlertsStatus" ], "description": "Retrieve an alert rule status.", "operationId": "MetricAlertsStatus_List", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "#/parameters/RuleNameParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "Successful request for a list of metric alerts", "schema": { "$ref": "#/definitions/MetricAlertStatusCollection" } }, "default": { "description": "BadRequest", "schema": { "$ref": "../../stable/2016-03-01/alertRules_API.json#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Get an alert rule status": { "$ref": "./examples/getMetricAlertStatus.json" } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}": { "get": { "tags": [ "MetricAlertsStatus" ], "description": "Retrieve an alert rule status.", "operationId": "MetricAlertsStatus_ListByName", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "#/parameters/RuleNameParameter" }, { "$ref": "#/parameters/StatusNameParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter" } ], "responses": { "200": { "description": "Successful request for a list of metric alerts", "schema": { "$ref": "#/definitions/MetricAlertStatusCollection" } }, "default": { "description": "BadRequest", "schema": { "$ref": "../../stable/2016-03-01/alertRules_API.json#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Get an alert rule status": { "$ref": "./examples/getMetricAlertStatusByName.json" } } } } }, "definitions": { "Resource": { "properties": { "id": { "type": "string", "readOnly": true, "description": "Azure resource Id" }, "name": { "type": "string", "readOnly": true, "description": "Azure resource name" }, "type": { "type": "string", "readOnly": true, "description": "Azure resource type" }, "location": { "type": "string", "description": "Resource location", "x-ms-mutability": [ "create", "read" ] }, "tags": { "additionalProperties": { "type": "string" }, "description": "Resource tags" } }, "required": [ "location" ], "x-ms-azure-resource": true, "description": "An azure resource object" }, "MetricAlertAction": { "description": "An alert action.", "properties": { "actionGroupId": { "type": "string", "description": "the id of the action group to use." }, "webHookProperties": { "type": "object", "additionalProperties": { "type": "string", "description": "the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload." }, "description": "This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook." } } }, "MetricAlertProperties": { "required": [ "enabled", "severity", "evaluationFrequency", "windowSize", "criteria", "scopes" ], "properties": { "description": { "type": "string", "description": "the description of the metric alert that will be included in the alert email." }, "severity": { "type": "integer", "format": "int32", "description": "Alert severity {0, 1, 2, 3, 4}" }, "enabled": { "type": "boolean", "description": "the flag that indicates whether the metric alert is enabled." }, "scopes": { "type": "array", "items": { "type": "string" }, "description": "the list of resource id's that this metric alert is scoped to." }, "evaluationFrequency": { "type": "string", "format": "duration", "description": "how often the metric alert is evaluated represented in ISO 8601 duration format." }, "windowSize": { "type": "string", "format": "duration", "description": "the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold." }, "targetResourceType": { "type": "string", "description": "the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource." }, "targetResourceRegion": { "type": "string", "description": "the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource." }, "criteria": { "$ref": "#/definitions/MetricAlertCriteria", "description": "defines the specific alert criteria information." }, "autoMitigate": { "type": "boolean", "description": "the flag that indicates whether the alert should be auto resolved or not. The default is true." }, "actions": { "type": "array", "items": { "$ref": "#/definitions/MetricAlertAction" }, "x-ms-identifiers": [ "actionGroupId" ], "description": "the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved." }, "lastUpdatedTime": { "readOnly": true, "type": "string", "format": "date-time", "description": "Last time the rule was updated in ISO8601 format." }, "isMigrated": { "type": "boolean", "description": "the value indicating whether this alert rule is migrated.", "readOnly": true } }, "description": "An alert rule." }, "MetricAlertPropertiesPatch": { "properties": { "description": { "type": "string", "description": "the description of the metric alert that will be included in the alert email." }, "severity": { "type": "integer", "format": "int32", "description": "Alert severity {0, 1, 2, 3, 4}" }, "enabled": { "type": "boolean", "description": "the flag that indicates whether the metric alert is enabled." }, "scopes": { "type": "array", "items": { "type": "string" }, "description": "the list of resource id's that this metric alert is scoped to." }, "evaluationFrequency": { "type": "string", "format": "duration", "description": "how often the metric alert is evaluated represented in ISO 8601 duration format." }, "windowSize": { "type": "string", "format": "duration", "description": "the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold." }, "targetResourceType": { "type": "string", "description": "the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria." }, "targetResourceRegion": { "type": "string", "description": "the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria." }, "criteria": { "$ref": "#/definitions/MetricAlertCriteria", "description": "defines the specific alert criteria information." }, "autoMitigate": { "type": "boolean", "description": "the flag that indicates whether the alert should be auto resolved or not. The default is true." }, "actions": { "type": "array", "items": { "$ref": "#/definitions/MetricAlertAction" }, "x-ms-identifiers": [ "actionGroupId" ], "description": "the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved." }, "lastUpdatedTime": { "readOnly": true, "type": "string", "format": "date-time", "description": "Last time the rule was updated in ISO8601 format." }, "isMigrated": { "type": "boolean", "description": "the value indicating whether this alert rule is migrated.", "readOnly": true } }, "description": "An alert rule properties for patch." }, "MetricAlertResource": { "type": "object", "allOf": [ { "$ref": "#/definitions/Resource" } ], "required": [ "properties" ], "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/MetricAlertProperties", "description": "The alert rule properties of the resource." } }, "description": "The metric alert resource." }, "MetricAlertResourcePatch": { "properties": { "tags": { "additionalProperties": { "type": "string" }, "description": "Resource tags" }, "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/MetricAlertPropertiesPatch", "description": "The alert rule properties of the resource." } }, "description": "The metric alert resource for patch operations." }, "MetricAlertResourceCollection": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/MetricAlertResource" }, "description": "the values for the alert rule resources." } }, "description": "Represents a collection of alert rule resources." }, "MetricAlertStatusCollection": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/MetricAlertStatus" }, "description": "the values for the alert rule resources." } }, "description": "Represents a collection of alert rule resources." }, "MetricAlertStatusProperties": { "description": "An alert status properties.", "properties": { "dimensions": { "type": "object", "additionalProperties": { "type": "string" }, "description": "An object describing the type of the dimensions." }, "status": { "type": "string", "description": "status value" }, "timestamp": { "type": "string", "format": "date-time", "description": "UTC time when the status was checked." } } }, "MetricAlertStatus": { "description": "An alert status.", "properties": { "name": { "type": "string", "description": "The status name." }, "id": { "type": "string", "description": "The alert rule arm id." }, "type": { "type": "string", "description": "The extended resource type name." }, "properties": { "x-ms-client-flatten": false, "$ref": "#/definitions/MetricAlertStatusProperties", "description": "The alert status properties of the metric alert status." } } }, "MetricAlertCriteria": { "type": "object", "additionalProperties": { "type": "object" }, "discriminator": "odata.type", "properties": { "odata.type": { "type": "string", "enum": [ "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" ], "x-ms-enum": { "name": "odatatype", "modelAsString": true }, "description": "specifies the type of the alert criteria." } }, "required": [ "odata.type" ], "description": "The rule criteria that defines the conditions of the alert rule." }, "MetricAlertSingleResourceMultipleMetricCriteria": { "x-ms-discriminator-value": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", "type": "object", "allOf": [ { "$ref": "#/definitions/MetricAlertCriteria" } ], "properties": { "allOf": { "type": "array", "items": { "$ref": "#/definitions/MetricCriteria" }, "x-ms-identifiers": [ "name" ], "description": "The list of metric criteria for this 'all of' operation. " } }, "description": "Specifies the metric alert criteria for a single resource that has multiple metric criteria." }, "WebtestLocationAvailabilityCriteria": { "x-ms-discriminator-value": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria", "type": "object", "allOf": [ { "$ref": "#/definitions/MetricAlertCriteria" } ], "properties": { "webTestId": { "type": "string", "description": "The Application Insights web test Id." }, "componentId": { "type": "string", "description": "The Application Insights resource Id." }, "failedLocationCount": { "type": "number", "description": "The number of failed locations." } }, "required": [ "webTestId", "componentId", "failedLocationCount" ], "description": "Specifies the metric alert rule criteria for a web test resource." }, "MetricCriteria": { "x-ms-discriminator-value": "StaticThresholdCriterion", "type": "object", "allOf": [ { "$ref": "#/definitions/MultiMetricCriteria" } ], "required": [ "operator", "threshold" ], "properties": { "operator": { "type": "string", "enum": [ "Equals", "GreaterThan", "GreaterThanOrEqual", "LessThan", "LessThanOrEqual" ], "x-ms-enum": { "name": "Operator", "modelAsString": true }, "description": "the criteria operator." }, "threshold": { "type": "number", "format": "double", "description": "the criteria threshold value that activates the alert." } }, "description": "Criterion to filter metrics." }, "MetricDimension": { "required": [ "name", "operator", "values" ], "properties": { "name": { "type": "string", "description": "Name of the dimension." }, "operator": { "type": "string", "description": "the dimension operator. Only 'Include' and 'Exclude' are supported" }, "values": { "type": "array", "items": { "type": "string" }, "description": "list of dimension values." } }, "description": "Specifies a metric dimension." }, "MetricAlertMultipleResourceMultipleMetricCriteria": { "x-ms-discriminator-value": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", "type": "object", "allOf": [ { "$ref": "#/definitions/MetricAlertCriteria" } ], "properties": { "allOf": { "type": "array", "items": { "$ref": "#/definitions/MultiMetricCriteria" }, "x-ms-identifiers": [ "name" ], "description": "the list of multiple metric criteria for this 'all of' operation. " } }, "description": "Specifies the metric alert criteria for multiple resource that has multiple metric criteria." }, "MultiMetricCriteria": { "type": "object", "additionalProperties": { "type": "object" }, "discriminator": "criterionType", "properties": { "criterionType": { "type": "string", "enum": [ "StaticThresholdCriterion", "DynamicThresholdCriterion" ], "x-ms-enum": { "name": "criterionType", "modelAsString": true }, "description": "Specifies the type of threshold criteria" }, "name": { "type": "string", "description": "Name of the criteria." }, "metricName": { "type": "string", "description": "Name of the metric." }, "metricNamespace": { "type": "string", "description": "Namespace of the metric." }, "timeAggregation": { "type": "string", "enum": [ "Average", "Count", "Minimum", "Maximum", "Total" ], "x-ms-enum": { "name": "AggregationTypeEnum", "modelAsString": true }, "description": "the criteria time aggregation types." }, "dimensions": { "type": "array", "items": { "$ref": "#/definitions/MetricDimension" }, "x-ms-identifiers": [ "name" ], "description": "List of dimension conditions." }, "skipMetricValidation": { "type": "boolean", "description": "Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped." } }, "required": [ "criterionType", "name", "metricName", "timeAggregation" ], "description": "The types of conditions for a multi resource alert." }, "DynamicMetricCriteria": { "x-ms-discriminator-value": "DynamicThresholdCriterion", "type": "object", "allOf": [ { "$ref": "#/definitions/MultiMetricCriteria" } ], "required": [ "operator", "alertSensitivity", "failingPeriods" ], "properties": { "operator": { "type": "string", "enum": [ "GreaterThan", "LessThan", "GreaterOrLessThan" ], "x-ms-enum": { "name": "DynamicThresholdOperator", "modelAsString": true }, "description": "The operator used to compare the metric value against the threshold." }, "alertSensitivity": { "type": "string", "enum": [ "Low", "Medium", "High" ], "x-ms-enum": { "name": "DynamicThresholdSensitivity", "modelAsString": true }, "description": "The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern." }, "failingPeriods": { "type": "object", "$ref": "#/definitions/DynamicThresholdFailingPeriods", "description": "The minimum number of violations required within the selected lookback time window required to raise an alert." }, "ignoreDataBefore": { "type": "string", "format": "date-time", "description": "Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format)" } }, "description": "Criterion for dynamic threshold." }, "DynamicThresholdFailingPeriods": { "required": [ "numberOfEvaluationPeriods", "minFailingPeriodsToAlert" ], "properties": { "numberOfEvaluationPeriods": { "type": "number", "description": "The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points." }, "minFailingPeriodsToAlert": { "type": "number", "description": "The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods." } }, "description": "The minimum number of violations required within the selected lookback time window required to raise an alert." } }, "parameters": { "RuleNameParameter": { "name": "ruleName", "in": "path", "required": true, "type": "string", "description": "The name of the rule.", "x-ms-parameter-location": "method" }, "StatusNameParameter": { "name": "statusName", "in": "path", "required": true, "type": "string", "description": "The name of the status.", "x-ms-parameter-location": "method" } } }