diff --git a/specification/monitor/resource-manager/microsoft.insights/stable/2018-04-16/examples/createOrUpdateScheduledQueryRule-LogToMetricAction.json b/specification/monitor/resource-manager/microsoft.insights/stable/2018-04-16/examples/createOrUpdateScheduledQueryRule-LogToMetricAction.json new file mode 100644 index 000000000000..3adc47b8bfcf --- /dev/null +++ b/specification/monitor/resource-manager/microsoft.insights/stable/2018-04-16/examples/createOrUpdateScheduledQueryRule-LogToMetricAction.json @@ -0,0 +1,97 @@ +{ + "parameters": { + "subscriptionId": "af52d502-a447-4bc6-8cb7-4780fbb00490", + "resourceGroupName": "alertsweu", + "ruleName": "logtometricfoo", + "api-version": "2018-04-16", + "parameters": { + "location": "West Europe", + "tags": { + "hidden-link:/subscriptions/af52d502-a447-4bc6-8cb7-4780fbb00490/resourceGroups/alertsweu/providers/Microsoft.OperationalInsights/workspaces/alertsweu": "Resource" + }, + "properties": { + "description": "log to metric description", + "enabled": "true", + "source": { + "dataSourceId": "/subscriptions/af52d502-a447-4bc6-8cb7-4780fbb00490/resourceGroups/alertsweu/providers/Microsoft.OperationalInsights/workspaces/alertsweu" + }, + "action": { + "criteria": [ + { + "metricName": "Average_% Idle Time", + "dimensions": [] + } + ], + "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" + } + } + } + }, + "responses": { + "200": { + "headers": {}, + "body": { + "id": "/subscriptions/af52d502-a447-4bc6-8cb7-4780fbb00490/resourceGroups/alertsweu/providers/microsoft.insights/scheduledqueryrules/logtometricfoo", + "name": "logtometricfoo", + "type": "microsoft.insights/scheduledqueryrules", + "location": "westeurope", + "tags": { + "hidden-link:/subscriptions/af52d502-a447-4bc6-8cb7-4780fbb00490/resourceGroups/alertsweu/providers/Microsoft.OperationalInsights/workspaces/alertsweu": "Resource" + }, + "properties": { + "description": "log to metric description", + "displayName": "logtometricfoo", + "enabled": "true", + "lastUpdatedTime": "2018-09-04T06:31:56.3737792Z", + "provisioningState": "Succeeded", + "source": { + "query": null, + "dataSourceId": "/subscriptions/af52d502-a447-4bc6-8cb7-4780fbb00490/resourceGroups/alertsweu/providers/Microsoft.OperationalInsights/workspaces/alertsweu" + }, + "schedule": null, + "action": { + "criteria": [ + { + "metricName": "Average_% Idle Time", + "dimensions": [] + } + ], + "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" + } + } + } + }, + "201": { + "headers": {}, + "body": { + "id": "/subscriptions/af52d502-a447-4bc6-8cb7-4780fbb00490/resourceGroups/alertsweu/providers/microsoft.insights/scheduledqueryrules/logtometricfoo", + "name": "logtometricfoo", + "type": "microsoft.insights/scheduledqueryrules", + "location": "westeurope", + "tags": { + "hidden-link:/subscriptions/af52d502-a447-4bc6-8cb7-4780fbb00490/resourceGroups/alertsweu/providers/Microsoft.OperationalInsights/workspaces/alertsweu": "Resource" + }, + "properties": { + "description": "log to metric description", + "enabled": "true", + "lastUpdatedTime": "2018-09-04T06:27:58.3892575Z", + "provisioningState": "Succeeded", + "source": { + "query": null, + "dataSourceId": "/subscriptions/af52d502-a447-4bc6-8cb7-4780fbb00490/resourceGroups/alertsweu/providers/Microsoft.OperationalInsights/workspaces/alertsweu" + }, + "schedule": null, + "action": { + "criteria": [ + { + "metricName": "Average_% Idle Time", + "dimensions": [] + } + ], + "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction" + } + } + } + } + } +} \ No newline at end of file diff --git a/specification/monitor/resource-manager/microsoft.insights/stable/2018-04-16/scheduledQueryRule_API.json b/specification/monitor/resource-manager/microsoft.insights/stable/2018-04-16/scheduledQueryRule_API.json index d92f0c77b3db..5d3fe723ca8b 100644 --- a/specification/monitor/resource-manager/microsoft.insights/stable/2018-04-16/scheduledQueryRule_API.json +++ b/specification/monitor/resource-manager/microsoft.insights/stable/2018-04-16/scheduledQueryRule_API.json @@ -85,7 +85,8 @@ } }, "x-ms-examples": { - "Create or Update rule": { "$ref": "./examples/createOrUpdateScheduledQueryRules.json" } + "Create or Update rule - AletringAction": { "$ref": "./examples/createOrUpdateScheduledQueryRules.json" }, + "Create or Update rule - LogToMetricAction": { "$ref": "./examples/createOrUpdateScheduledQueryRule-LogToMetricAction.json" } } }, "get": { @@ -380,7 +381,7 @@ "properties": { "query": { "type": "string", - "description": "Log search query." + "description": "Log search query. Required for action type - AlertingAction" }, "authorizedResources": { "type": "array", @@ -399,7 +400,6 @@ } }, "required": [ - "query", "dataSourceId" ] }, @@ -587,7 +587,7 @@ }, "schedule": { "$ref": "#/definitions/Schedule", - "description": "Schedule (Frequnecy, Time Window) for rule." + "description": "Schedule (Frequnecy, Time Window) for rule. Required for action type - AlertingAction" }, "action": { "$ref": "#/definitions/Action", @@ -595,7 +595,6 @@ } }, "required": [ - "schedule", "source", "action" ] @@ -623,7 +622,7 @@ "properties": { "odata.type": { "type": "string", - "description": "Specifies the action. Only supported value - AlertingAction " + "description": "Specifies the action. Supported values - AlertingAction, LogToMetricAction" } }, "required": [ @@ -665,6 +664,78 @@ "severity" ] }, + "Dimension": { + "type": "object", + "description": "Specifies the criteria for converting log to metric.", + "properties": { + "name": { + "type": "string", + "description": "Name of the dimension" + }, + "operator": { + "type": "string", + "description": "Operator for dimension values", + "enum": [ + "Include" + ], + "x-ms-enum": { + "name": "operator", + "modelAsString": true + } + }, + "values": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of dimension values" + } + }, + "required": [ + "name", + "operator", + "values" + ] + }, + "Criteria": { + "type": "object", + "description": "Specifies the criteria for converting log to metric.", + "properties": { + "metricName": { + "type": "string", + "description": "Name of the metric" + }, + "dimensions": { + "type": "array", + "items": { + "$ref": "#/definitions/Dimension" + }, + "description": "List of Dimensions for creating metric" + } + }, + "required": [ + "metricName" + ] + }, + "LogToMetricAction": { + "description": "Specifiy action need to be taken when rule type is converting log to metric", + "x-ms-discriminator-value": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/Action" + } + ], + "properties": { + "criteria": { + "$ref": "#/definitions/Criteria", + "description": "Severity of the alert" + } + }, + "required": [ + "criteria" + ] + }, "ErrorResponse": { "description": "Describes the format of Error response.", "type": "object",