{ "swagger": "2.0", "info": { "title": "MonitorManagementClient", "x-ms-code-generation-settings": { "name": "MonitorManagementClient" }, "version": "2016-03-01" }, "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}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}": { "put": { "description": "Creates or updates a classic metric alert rule.", "tags": [ "AlertRules" ], "operationId": "AlertRules_CreateOrUpdate", "parameters": [ { "$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/AlertRuleResource" }, "description": "The parameters of the rule to create or update." }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter" } ], "responses": { "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } }, "200": { "description": "Successful request to update an alert rule", "schema": { "$ref": "#/definitions/AlertRuleResource" } }, "201": { "description": "Created alert rule", "schema": { "$ref": "#/definitions/AlertRuleResource" } } }, "x-ms-examples": { "Create or update an alert rule": { "$ref": "./examples/createOrUpdateAlertRule.json" } } }, "delete": { "description": "Deletes a classic metric alert rule", "tags": [ "AlertRules" ], "operationId": "AlertRules_Delete", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "#/parameters/RuleNameParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "No content: the request was successful, but the response is empty" }, "200": { "description": "Successful request to delete an alert rule" }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Delete an alert rule": { "$ref": "./examples/deleteAlertRule.json" } } }, "get": { "description": "Gets a classic metric alert rule", "tags": [ "AlertRules" ], "operationId": "AlertRules_Get", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "#/parameters/RuleNameParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Successful request to get an alert rule", "schema": { "$ref": "#/definitions/AlertRuleResource" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Get an alert rule": { "$ref": "./examples/getAlertRule.json" } } }, "patch": { "description": "Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method.", "operationId": "AlertRules_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": "alertRulesResource", "in": "body", "required": true, "schema": { "$ref": "#/definitions/AlertRuleResourcePatch" }, "description": "Parameters supplied to the operation." } ], "responses": { "200": { "description": "Successful request to update an alert rule", "schema": { "$ref": "#/definitions/AlertRuleResource" } }, "201": { "description": "Successful request to update an alert rule that resulted in a creation of the alert rule", "schema": { "$ref": "#/definitions/AlertRuleResource" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-examples": { "Patch an alert rule": { "$ref": "./examples/patchAlertRule.json" } } } }, "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules": { "get": { "tags": [ "AlertRules" ], "operationId": "AlertRules_ListByResourceGroup", "description": "List the classic metric alert rules within a resource group.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Successful request for a list of alert rules", "schema": { "$ref": "#/definitions/AlertRuleResourceCollection" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-pageable": { "nextLinkName": null }, "x-ms-examples": { "List alert rules": { "$ref": "./examples/listAlertRule.json" } } } }, "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules": { "get": { "tags": [ "AlertRules" ], "operationId": "AlertRules_ListBySubscription", "description": "List the classic metric alert rules within a subscription.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/ApiVersionParameter" }, { "$ref": "../../../../../common-types/resource-management/v2/types.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "Successful request for a list of alert rules", "schema": { "$ref": "#/definitions/AlertRuleResourceCollection" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "x-ms-pageable": { "nextLinkName": null }, "x-ms-examples": { "List alert rules": { "$ref": "./examples/listAlertRuleBySubscription.json" } } } } }, "definitions": { "RuleCondition": { "type": "object", "discriminator": "odata.type", "properties": { "odata.type": { "type": "string", "description": "specifies the type of condition. This can be one of three types: ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition (based on the number of failures of a web test), and ThresholdRuleCondition (based on the threshold of a metric)." }, "dataSource": { "$ref": "#/definitions/RuleDataSource", "description": "the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource." } }, "required": [ "odata.type" ], "description": "The condition that results in the alert rule being activated." }, "RuleDataSource": { "type": "object", "discriminator": "odata.type", "properties": { "odata.type": { "type": "string", "description": "specifies the type of data source. There are two types of rule data sources: RuleMetricDataSource and RuleManagementEventDataSource" }, "resourceUri": { "type": "string", "description": "the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule." }, "legacyResourceId": { "type": "string", "description": "the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule." }, "resourceLocation": { "type": "string", "description": "the location of the resource." }, "metricNamespace": { "type": "string", "description": "the namespace of the metric." } }, "required": [ "odata.type" ], "description": "The resource from which the rule collects its data." }, "RuleMetricDataSource": { "x-ms-discriminator-value": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", "type": "object", "allOf": [ { "$ref": "#/definitions/RuleDataSource" } ], "properties": { "metricName": { "type": "string", "description": "the name of the metric that defines what the rule monitors." } }, "description": "A rule metric data source. The discriminator value is always RuleMetricDataSource in this case." }, "RuleManagementEventClaimsDataSource": { "properties": { "emailAddress": { "type": "string", "description": "the email address." } }, "description": "The claims for a rule management event data source." }, "RuleManagementEventDataSource": { "x-ms-discriminator-value": "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource", "type": "object", "allOf": [ { "$ref": "#/definitions/RuleDataSource" } ], "properties": { "eventName": { "type": "string", "description": "the event name." }, "eventSource": { "type": "string", "description": "the event source." }, "level": { "type": "string", "description": "the level." }, "operationName": { "type": "string", "description": "The name of the operation that should be checked for. If no name is provided, any operation will match." }, "resourceGroupName": { "type": "string", "description": "the resource group name." }, "resourceProviderName": { "type": "string", "description": "the resource provider name." }, "status": { "type": "string", "description": "The status of the operation that should be checked for. If no status is provided, any status will match." }, "subStatus": { "type": "string", "description": "the substatus." }, "claims": { "$ref": "#/definitions/RuleManagementEventClaimsDataSource", "description": "the claims." } }, "description": "A rule management event data source. The discriminator fields is always RuleManagementEventDataSource in this case." }, "ConditionOperator": { "type": "string", "enum": [ "GreaterThan", "GreaterThanOrEqual", "LessThan", "LessThanOrEqual" ], "x-ms-enum": { "name": "ConditionOperator", "modelAsString": false }, "description": "Operators allowed in the rule condition." }, "TimeAggregationOperator": { "type": "string", "enum": [ "Average", "Minimum", "Maximum", "Total", "Last" ], "x-ms-enum": { "name": "TimeAggregationOperator", "modelAsString": false }, "description": "Aggregation operators allowed in a rule." }, "ThresholdRuleCondition": { "x-ms-discriminator-value": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", "type": "object", "allOf": [ { "$ref": "#/definitions/RuleCondition" } ], "required": [ "threshold", "operator" ], "properties": { "operator": { "$ref": "#/definitions/ConditionOperator", "description": "the operator used to compare the data and the threshold." }, "threshold": { "type": "number", "format": "double", "description": "the threshold value that activates the alert." }, "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. If specified then it must be between 5 minutes and 1 day." }, "timeAggregation": { "$ref": "#/definitions/TimeAggregationOperator", "description": "the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric." } }, "description": "A rule condition based on a metric crossing a threshold.", "example": "\"condition\": {\r\n\t\"odata.type\": \"Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition\",\r\n\t\"dataSource\": {\r\n\t\"odata.type\": \"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource\",\r\n\t\"resourceUri\":\r\n\t\"/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/Default-Storage-NorthCentralUS/providers/Microsoft.Web/serverfarms/Plan\",\r\n\t\"metricName\": \"CpuPercentage\",\r\n\t\"operator\": \"GreaterThan\"\r\n\t},\r\n\t\"threshold\": 90,\r\n\t\"windowSize\": \"PT15M\",\r\n\t\"timeAggregation\": \"Average\"}" }, "LocationThresholdRuleCondition": { "x-ms-discriminator-value": "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition", "type": "object", "allOf": [ { "$ref": "#/definitions/RuleCondition" } ], "properties": { "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. If specified then it must be between 5 minutes and 1 day." }, "failedLocationCount": { "type": "integer", "format": "int32", "minimum": 0, "description": "the number of locations that must fail to activate the alert." } }, "required": [ "failedLocationCount" ], "description": "A rule condition based on a certain number of locations failing.", "example": "{\r\n\t\"odata.type\": \"Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition\",\r\n\t\"dataSource\": {\r\n\t\t\"odata.type\": \"Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource\",\r\n\t\t\"resourceUri\": \"/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourcegroups/Default-Web-CentralUS/providers/microsoft.insights/webtests/homepagetest-newrelapp2\",r\n\t\t\"metricName\": \"GSMT_AvRaW\"\r\n\t},\r\n\t\"windowSize\": \"PT5M\",\r\n\t\"failedLocationCount\": 1\r\n}" }, "ManagementEventAggregationCondition": { "properties": { "operator": { "$ref": "#/definitions/ConditionOperator", "description": "the condition operator." }, "threshold": { "type": "number", "format": "double", "description": "The threshold value that activates the alert." }, "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. If specified then it must be between 5 minutes and 1 day." } }, "description": "How the data that is collected should be combined over time." }, "ManagementEventRuleCondition": { "x-ms-discriminator-value": "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition", "type": "object", "allOf": [ { "$ref": "#/definitions/RuleCondition" } ], "properties": { "aggregation": { "$ref": "#/definitions/ManagementEventAggregationCondition", "description": "How the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate." } }, "description": "A management event rule condition.", "example": "{\r\n\t\"odata.type\": \"Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition\",\r\n\t\"dataSource\": {\r\n\t\t\"odata.type\": \"Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource\",\r\n\t\t\"operationName\": \"\",\r\n\t\t\"resourceUri\": \"/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/Default-Web-CentralUS/providers/Microsoft.Web/sites/TestLatestWebsite\",\r\n\t\t\"status\": \"failed\",\r\n\t\t\"claims\": { }\r\n\t},\r\n\t\"aggregation\": {\r\n\t\t\"threshold\": 1,\r\n\t\t\"windowSize\": \"PT5M\"\r\n\t}\r\n}" }, "RuleAction": { "type": "object", "discriminator": "odata.type", "properties": { "odata.type": { "type": "string", "description": "specifies the type of the action. There are two types of actions: RuleEmailAction and RuleWebhookAction." } }, "required": [ "odata.type" ], "description": "The action that is performed when the alert rule becomes active, and when an alert condition is resolved." }, "RuleEmailAction": { "x-ms-discriminator-value": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", "type": "object", "allOf": [ { "$ref": "#/definitions/RuleAction" } ], "properties": { "sendToServiceOwners": { "type": "boolean", "description": "Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated." }, "customEmails": { "type": "array", "items": { "type": "string" }, "description": "the list of administrator's custom email addresses to notify of the activation of the alert." } }, "description": "Specifies the action to send email when the rule condition is evaluated. The discriminator is always RuleEmailAction in this case.", "example": "{\r\n\t\"odata.type\": \"Microsoft.Azure.Management.Insights.Models.RuleEmailAction\",\r\n\t\"sendToServiceOwners\": true,\r\n\t\"customEmails\": [\"email1@contoso.com\",\"email2@contoso.com\" ]\r\n}" }, "RuleWebhookAction": { "x-ms-discriminator-value": "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction", "type": "object", "allOf": [ { "$ref": "#/definitions/RuleAction" } ], "properties": { "serviceUri": { "type": "string", "description": "the service uri to Post the notification when the alert activates or resolves." }, "properties": { "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": "Specifies the action to post to service when the rule condition is evaluated. The discriminator is always RuleWebhookAction in this case.", "example": "{\r\n\t\"odata.type\": \"Microsoft.Azure.Management.Insights.Models.RuleWebhookAction\",\r\n\t\"serviceUri\": \"http://contoso.com/\",\r\n\t\"properties\": { }\r\n}" }, "AlertRule": { "required": [ "name", "isEnabled", "condition" ], "properties": { "name": { "type": "string", "description": "the name of the alert rule." }, "description": { "type": "string", "description": "the description of the alert rule that will be included in the alert email." }, "provisioningState": { "type": "string", "description": "the provisioning state." }, "isEnabled": { "type": "boolean", "description": "the flag that indicates whether the alert rule is enabled." }, "condition": { "$ref": "#/definitions/RuleCondition", "description": "the condition that results in the alert rule being activated." }, "action": { "$ref": "#/definitions/RuleAction", "description": "action that is performed when the alert rule becomes active, and when an alert condition is resolved." }, "actions": { "type": "array", "items": { "$ref": "#/definitions/RuleAction" }, "x-ms-identifiers": [], "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." } }, "description": "An alert rule." }, "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" }, "AlertRuleResource": { "type": "object", "allOf": [ { "$ref": "#/definitions/Resource" } ], "required": [ "properties" ], "properties": { "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/AlertRule", "description": "The alert rule properties of the resource." } }, "description": "The alert rule resource." }, "AlertRuleResourcePatch": { "description": "The alert rule object for patch operations.", "properties": { "tags": { "additionalProperties": { "type": "string" }, "description": "Resource tags" }, "properties": { "x-ms-client-flatten": true, "$ref": "#/definitions/AlertRule", "description": "The properties of an alert rule." } } }, "AlertRuleResourceCollection": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/AlertRuleResource" }, "description": "the values for the alert rule resources." } }, "description": "Represents a collection of alert rule resources." }, "ErrorResponse": { "description": "Describes the format of Error response.", "type": "object", "properties": { "code": { "description": "Error code", "type": "string" }, "message": { "description": "Error message indicating why the operation failed.", "type": "string" } } } }, "parameters": { "RuleNameParameter": { "name": "ruleName", "in": "path", "required": true, "type": "string", "description": "The name of the rule.", "x-ms-parameter-location": "method" } } }