diff --git a/docs/layouts/partials/activityAlertProperties.html b/docs/layouts/partials/activityAlertProperties.html index cd4d6d468..d22850aea 100644 --- a/docs/layouts/partials/activityAlertProperties.html +++ b/docs/layouts/partials/activityAlertProperties.html @@ -1,29 +1,27 @@ - - {{ if eq .category "Administrative" }} - - - {{ else if eq .category "ResourceHealth" }} - - - {{ else if eq .category "ServiceHealth" }} - - {{ end }} - - - + - {{ if eq .category "Administrative" }} + + {{ if eq .category "Administrative" }} + + + + + - {{ else if eq .category "ResourceHealth" }} + {{ end }} + + + {{ else if eq .category "ResourceHealth" }} + + - + + + - {{ else if eq .category "ServiceHealth" }} + + {{ else if eq .category "ServiceHealth" }} + + - {{ end }} - + + {{ end }}
CategoryOperation NameStatusCausesHealth StatusIncident Type
Category {{ .category }}
Operation Name {{ .operationName }}
Status {{ if or (reflect.IsMap .status) (reflect.IsSlice .status) }} {{ transform.Highlight (encoding.Jsonify (dict "indent" " ") .status) "json" }} {{ else }} {{ .status }} - {{ end }}
Causes {{ if or (reflect.IsMap .causes) (reflect.IsSlice .causes) }} {{ transform.Highlight (encoding.Jsonify (dict "indent" " ") .causes) "json" }} @@ -31,15 +29,21 @@ {{ .causes }} {{ end }} +
Health Status {{ if or (reflect.IsMap .currentHealthStatus) (reflect.IsSlice .currentHealthStatus) }} {{ transform.Highlight (encoding.Jsonify (dict "indent" " ") .currentHealthStatus) "json" }} {{ else }} {{ .currentHealthStatus }} {{ end }}
Incident Type {{ .incidentType }}
diff --git a/docs/layouts/partials/logAlertProperties.html b/docs/layouts/partials/logAlertProperties.html index 5817e9021..3ea363a82 100644 --- a/docs/layouts/partials/logAlertProperties.html +++ b/docs/layouts/partials/logAlertProperties.html @@ -1,22 +1,8 @@
- - {{ if isset . "dimensions" }} - - {{ end }} - - - - - - - - - - - - - {{ if isset . "dimensions" }} + {{ if isset . "dimensions" }} + + - {{ end }} + + {{ end }} + + + + + + + + + + + + + + + + + + + + + + + + + +
DimensionsFailing PeriodsAggregationOperatorThresholdWindowFrequencySeverityMetric Measure ColumnResource ID Column
Dimensions {{ if or (reflect.IsMap .dimensions) (reflect.IsSlice .dimensions) }} {{ transform.Highlight (encoding.Jsonify (dict "indent" " ") .dimensions) "json" }} @@ -24,7 +10,10 @@ {{ .dimensions }} {{ end }}
Failing Periods {{ if or (reflect.IsMap .failingPeriods) (reflect.IsSlice .failingPeriods) }} {{ transform.Highlight (encoding.Jsonify (dict "indent" " ") .failingPeriods) "json" }} @@ -32,13 +21,37 @@ {{ .failingPeriods }} {{ end }}
Aggregation {{ .timeAggregation }}
Operator {{ .operator }}
Threshold {{ .threshold }}
Window {{ .windowSize }}
Frequency {{ .evaluationFrequency }}
Severity {{ .severity }}
Metric Measure Column {{ .metricMeasureColumn }}
Resource ID Column {{ .resouceIdColumn }}
diff --git a/docs/layouts/partials/metricAlertProperties.html b/docs/layouts/partials/metricAlertProperties.html index cbfbbd42a..61709d092 100644 --- a/docs/layouts/partials/metricAlertProperties.html +++ b/docs/layouts/partials/metricAlertProperties.html @@ -1,28 +1,20 @@
- - - {{ if eq .criterionType "DynamicThresholdCriterion" }} - - - {{ else }} - - {{ end }} - - - - {{ if isset . "dimensions" }} - - {{ end }} - + + - - + - {{ if eq .criterionType "DynamicThresholdCriterion" }} + + {{ if eq .criterionType "DynamicThresholdCriterion" }} + + + + + - {{ else }} + + {{ else }} + + - {{ end }} + + {{ end }} + + + + + + + + - {{ if isset . "dimensions" }} + + {{ if isset . "dimensions" }} + + - {{ end }} + {{ if or (reflect.IsMap .dimensions) (reflect.IsSlice .dimensions) }} + {{ transform.Highlight (encoding.Jsonify (dict "indent" " ") .dimensions) "json" }} + {{ else }} + {{ .dimensions }} + {{ end }} + + + {{ end }} + +
OperatorAggregationAlert SensitivityFailing PeriodsThresholdWindowFrequencySeverityDimensionsCriterion TypeOperator{{ .operator }}
{{ .operator }}Aggregation {{ .timeAggregation }}
Alert Sensitivity {{ .alertSensitivity }}
Failing Periods {{ if or (reflect.IsMap .failingPeriods) (reflect.IsSlice .failingPeriods) }} {{ transform.Highlight (encoding.Jsonify (dict "indent" " ") .failingPeriods) "json" }} @@ -30,21 +22,39 @@ {{ .failingPeriods }} {{ end }}
Threshold {{ cast.ToString .threshold }}
Window {{ .windowSize }}
Frequency {{ .evaluationFrequency }}
Severity {{ .severity }}
Dimensions - {{ if or (reflect.IsMap .dimensions) (reflect.IsSlice .dimensions) }} - {{ transform.Highlight (encoding.Jsonify (dict "indent" " ") .dimensions) "json" }} - {{ else }} - {{ .dimensions }} - {{ end }} -
Criterion Type {{ .criterionType }}
diff --git a/docs/layouts/partials/templates/arm/activity-administrative.html b/docs/layouts/partials/templates/arm/activity-administrative.html new file mode 100644 index 000000000..74b3e2e7e --- /dev/null +++ b/docs/layouts/partials/templates/arm/activity-administrative.html @@ -0,0 +1,74 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "activityLogAlertName": { + "type": "string", + "metadata": { + "description": "Unique name (within the Resource Group) for the Activity log alert." + } + }, + "alertDescription": { + "type": "string", + "defaultValue": "{{ .description }}", + "metadata": { + "description": "Description of alert" + } + }, + "activityLogAlertEnabled": { + "type": "bool", + "defaultValue": true, + "metadata": { + "description": "Indicates whether or not the alert is enabled." + } + }, + "actionGroupResourceId": { + "type": "string", + "metadata": { + "description": "Resource Id for the Action group." + } + } + }, + "resources": [ + { + "type": "Microsoft.Insights/activityLogAlerts", + "apiVersion": "2017-04-01", + "name": "[parameters('activityLogAlertName')]", + "location": "Global", + "tags": { + "_deployed_by_amba": true + }, + "properties": { + "description": "[parameters('alertDescription')]", + "scopes": [ + "[subscription().id]" + ], + "enabled": "[parameters('activityLogAlertEnabled')]", + "condition": { + "allOf": [ + { + "field": "category", + "equals": "Administrative" + }, + { + "field": "operationName", + "equals": "{{ .properties.operationName }}" + }, + { + "field": "status", + "containsAny": [{{ range $idx1, $value1 := .properties.status }}{{ if ne $idx1 0}},{{ end }}"{{ $value1 }}"{{ end }}] + } + ] + }, + "actions": { + "actionGroups": + [ + { + "actionGroupId": "[parameters('actionGroupResourceId')]" + } + ] + } + } + } + ] +} diff --git a/docs/layouts/partials/templates/arm/activity-resourcehealth.html b/docs/layouts/partials/templates/arm/activity-resourcehealth.html new file mode 100644 index 000000000..fb6992528 --- /dev/null +++ b/docs/layouts/partials/templates/arm/activity-resourcehealth.html @@ -0,0 +1,82 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "activityLogAlertName": { + "type": "string", + "metadata": { + "description": "Unique name (within the Resource Group) for the Activity log alert." + } + }, + "alertDescription": { + "type": "string", + "defaultValue": "{{ .description }}", + "metadata": { + "description": "Description of alert" + } + }, + "activityLogAlertEnabled": { + "type": "bool", + "defaultValue": true, + "metadata": { + "description": "Indicates whether or not the alert is enabled." + } + }, + "actionGroupResourceId": { + "type": "string", + "metadata": { + "description": "Resource Id for the Action group." + } + } + }, + "resources": [ + { + "type": "Microsoft.Insights/activityLogAlerts", + "apiVersion": "2017-04-01", + "name": "[parameters('activityLogAlertName')]", + "location": "Global", + "tags": { + "_deployed_by_amba": true + }, + "properties": { + "description": "[parameters('alertDescription')]", + "scopes": [ + "[subscription().id]" + ], + "enabled": "[parameters('activityLogAlertEnabled')]", + "condition": { + "allOf": [ + { + "field": "category", + "equals": "ResourceHealth" + }, + { + "anyOf": [{{ range $idx, $value := .properties.causes }}{{ if ne $idx 0}},{{ end }} + { + "field": "properties.cause", + "equals": "{{ $value }}" + }{{ end }} + ] + }, + { + "anyOf": [{{ range $idx, $value := .properties.currentHealthStatus }}{{ if ne $idx 0}},{{ end }} + { + "field": "properties.currentHealthStatus", + "equals": "{{ $value }}" + }{{ end }} + ] + } + ] + }, + "actions": { + "actionGroups": + [ + { + "actionGroupId": "[parameters('actionGroupResourceId')]" + } + ] + } + } + } + ] +} diff --git a/docs/layouts/partials/templates/arm/activity-servicehealth.html b/docs/layouts/partials/templates/arm/activity-servicehealth.html new file mode 100644 index 000000000..ce3e000c3 --- /dev/null +++ b/docs/layouts/partials/templates/arm/activity-servicehealth.html @@ -0,0 +1,70 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "activityLogAlertName": { + "type": "string", + "metadata": { + "description": "Unique name (within the Resource Group) for the Activity log alert." + } + }, + "alertDescription": { + "type": "string", + "defaultValue": "{{ .description }}", + "metadata": { + "description": "Description of alert" + } + }, + "activityLogAlertEnabled": { + "type": "bool", + "defaultValue": true, + "metadata": { + "description": "Indicates whether or not the alert is enabled." + } + }, + "actionGroupResourceId": { + "type": "string", + "metadata": { + "description": "Resource Id for the Action group." + } + } + }, + "resources": [ + { + "type": "Microsoft.Insights/activityLogAlerts", + "apiVersion": "2017-04-01", + "name": "[parameters('activityLogAlertName')]", + "location": "Global", + "tags": { + "_deployed_by_amba": true + }, + "properties": { + "description": "[parameters('alertDescription')]", + "scopes": [ + "[subscription().id]" + ], + "enabled": "[parameters('activityLogAlertEnabled')]", + "condition": { + "allOf": [ + { + "field": "category", + "equals": "ServiceHealth" + }, + { + "field": "properties.incidentType", + "equals": "{{ .properties.incidentType }}" + } + ] + }, + "actions": { + "actionGroups": + [ + { + "actionGroupId": "[parameters('actionGroupResourceId')]" + } + ] + } + } + } + ] +} diff --git a/docs/layouts/partials/templates/arm/log.html b/docs/layouts/partials/templates/arm/log.html new file mode 100644 index 000000000..1110e4653 --- /dev/null +++ b/docs/layouts/partials/templates/arm/log.html @@ -0,0 +1,247 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "alertName": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "Name of the alert" + } + }, + "location": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "Location of the alert" + } + }, + "alertDescription": { + "type": "string", + "defaultValue": "{{ .description }}", + "metadata": { + "description": "Description of alert" + } + }, + "isEnabled": { + "type": "bool", + "defaultValue": true, + "metadata": { + "description": "Specifies whether the alert is enabled" + } + }, + "checkWorkspaceAlertsStorageConfigured": { + "type": "bool", + "defaultValue": false, + "metadata": { + "description": "Specifies whether to check linked storage and fail creation if the storage was not found" + } + }, + "resourceId": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "Full Resource ID of the resource emitting the metric that will be used for the comparison. For example /subscriptions/00000000-0000-0000-0000-0000-00000000/resourceGroups/ResourceGroupName/providers/Microsoft.compute/virtualMachines/VM_xyz" + } + }, + "muteActionsDuration": { + "type": "string", + "allowedValues": [ + "PT1M", + "PT5M", + "PT15M", + "PT30M", + "PT1H", + "PT6H", + "PT12H", + "PT24H" + ], + "metadata": { + "description": "Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired." + } + }, + "actionGroupId": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "The ID of the action group that is triggered when the alert is activated or deactivated" + } + }, + "alertSeverity": { + "type": "int", + "defaultValue": {{ .properties.severity }}, + "allowedValues": [ + 0, + 1, + 2, + 3, + 4 + ], + "metadata": { + "description": "Severity of alert {0,1,2,3,4}" + } + }, + "autoMitigate": { + "type": "bool", + "defaultValue": {{ .properties.autoMitigate }}, + "metadata": { + "description": "Specifies whether the alert will automatically resolve" + } + }, + "query": { + "type": "string", + "minLength": 1, + "defaultValue": {{ jsonify (replace .properties.query "\n" " ") }}, + "metadata": { + "description": "Name of the metric used in the comparison to activate the alert." + } + }, + "metricMeasureColumn": { + "type": "string", + "defaultValue": "{{ .properties.metricMeasureColumn }}" + "metadata": { + "description": "Name of the measure column used in the alert evaluation." + } + }, + "resourceIdColumn": { + "type": "string", + "defaultValue": "{{ .properties.resouceIdColumn }}" + "metadata": { + "description": "Name of the resource ID column used in the alert targeting the alerts." + } + }, + "operator": { + "type": "string", + "defaultValue": "{{ .properties.operator }}", + "allowedValues": [ + "Equals", + "GreaterThan", + "GreaterThanOrEqual", + "LessThan", + "LessThanOrEqual" + ], + "metadata": { + "description": "Operator comparing the current value with the threshold value." + } + }, + "threshold": { + "type": "string", + "defaultValue": "{{ .properties.threshold }}", + "metadata": { + "description": "The threshold value at which the alert is activated." + } + }, + "numberOfEvaluationPeriods": { + "type": "int", + "defaultValue": {{ .properties.failingPeriods.numberOfEvaluationPeriods }}, + "metadata": { + "description": "The number of periods to check in the alert evaluation." + } + }, + "minFailingPeriodsToAlert": { + "type": "int", + "defaultValue": {{ .properties.failingPeriods.minFailingPeriodsToAlert }}, + "metadata": { + "description": "The number of unhealthy periods to alert on (must be lower or equal to numberOfEvaluationPeriods)." + } + }, + "timeAggregation": { + "type": "string", + "defaultValue": "{{ .properties.timeAggregation }}", + "allowedValues": [ + "Average", + "Minimum", + "Maximum", + "Total", + "Count" + ], + "metadata": { + "description": "How the data that is collected should be combined over time." + } + }, + "windowSize": { + "type": "string", + "defaultValue": "{{ .properties.windowSize }}", + "allowedValues": [ + "PT1M", + "PT5M", + "PT15M", + "PT30M", + "PT1H", + "PT6H", + "PT12H", + "PT24H" + ], + "metadata": { + "description": "Period of time used to monitor alert activity based on the threshold. Must be between one minute and one day. ISO 8601 duration format." + } + }, + "evaluationFrequency": { + "type": "string", + "defaultValue": "{{ .properties.evaluationFrequency }}", + "allowedValues": [ + "PT5M", + "PT15M", + "PT30M", + "PT1H" + ], + "metadata": { + "description": "how often the metric alert is evaluated represented in ISO 8601 duration format" + } + } + }, + "resources": [ + { + "type": "Microsoft.Insights/scheduledQueryRules", + "apiVersion": "2021-08-01", + "name": "[parameters('alertName')]", + "location": "[parameters('location')]", + "tags": { + "_deployed_by_amba": true + }, + "properties": { + "description": "[parameters('alertDescription')]", + "severity": "[parameters('alertSeverity')]", + "enabled": "[parameters('isEnabled')]", + "scopes": [ + "[parameters('resourceId')]" + ], + "evaluationFrequency": "[parameters('evaluationFrequency')]", + "windowSize": "[parameters('windowSize')]", + "criteria": { + "allOf": [ + { + "query": "[parameters('query')]", + "metricMeasureColumn": "[parameters('metricMeasureColumn')]", + "resourceIdColumn": "[parameters('resourceIdColumn')]", + "dimensions": [{{ range $idx1, $value1 := .properties.dimensions }}{{ if ne $idx1 0}},{{ end }} + { + "name": "{{ $idx1 }}", + "operator": "{{ $value1.operator }}", + "values": [{{ range $idx2, $value2 := $value1.values }}{{ if ne $idx2 0}},{{ end }}"{{ $value2 }}"{{ end }}] + }{{ end }} + ], + "operator": "[parameters('operator')]", + "threshold": "[parameters('threshold')]", + "timeAggregation": "[parameters('timeAggregation')]", + "failingPeriods": { + "numberOfEvaluationPeriods": "[parameters('numberOfEvaluationPeriods')]", + "minFailingPeriodsToAlert": "[parameters('minFailingPeriodsToAlert')]" + } + } + ] + }, + "muteActionsDuration": "[parameters('muteActionsDuration')]", + "autoMitigate": "[parameters('autoMitigate')]", + "checkWorkspaceAlertsStorageConfigured": "[parameters('checkWorkspaceAlertsStorageConfigured')]", + "actions": { + "actionGroups": [ + "[parameters('actionGroupId')]" + ], + "customProperties": { + } + } + } + } + ] +} diff --git a/docs/layouts/partials/templates/arm/metric-dynamic.html b/docs/layouts/partials/templates/arm/metric-dynamic.html new file mode 100644 index 000000000..deba29665 --- /dev/null +++ b/docs/layouts/partials/templates/arm/metric-dynamic.html @@ -0,0 +1,196 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "alertName": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "Name of the alert" + } + }, + "alertDescription": { + "type": "string", + "defaultValue": "{{ .description }}", + "metadata": { + "description": "Description of alert" + } + }, + "targetResourceId": { + "type": "array", + "minLength": 1, + "metadata": { + "description": "array of Azure resource Ids. For example - /subscriptions/00000000-0000-0000-0000-0000-00000000/resourceGroup/resource-group-name/Microsoft.compute/virtualMachines/vm-name" + } + }, + "targetResourceRegion": { + "type": "string", + "metadata": { + "description": "Azure region in which target resources to be monitored are in (without spaces). For example: EastUS" + } + }, + "targetResourceType": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "Resource type of target resources to be monitored." + } + }, + "actionGroupId": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "The ID of the action group that is triggered when the alert is activated or deactivated" + } + }, + "isEnabled": { + "type": "bool", + "defaultValue": true, + "metadata": { + "description": "Specifies whether the alert is enabled" + } + }, + "alertSeverity": { + "type": "int", + "defaultValue": {{ .properties.severity }}, + "allowedValues": [ + 0, + 1, + 2, + 3, + 4 + ], + "metadata": { + "description": "Severity of alert {0,1,2,3,4}" + } + }, + "operator": { + "type": "string", + "defaultValue": "{{ .properties.operator }}", + "allowedValues": [ + "GreaterThan", + "LessThan", + "GreaterOrLessThan" + ], + "metadata": { + "description": "Operator comparing the current value with the threshold value." + } + }, + "alertSensitivity": { + "type": "string", + "defaultValue": "{{ .properties.alertSensitivity }}", + "allowedValues": [ + "High", + "Medium", + "Low" + ], + "metadata": { + "description": "Tunes how 'noisy' the Dynamic Thresholds alerts will be: 'High' will result in more alerts while 'Low' will result in fewer alerts." + } + }, + "numberOfEvaluationPeriods": { + "type": "int", + "defaultValue": {{ .properties.failingPeriods.numberOfEvaluationPeriods }}, + "metadata": { + "description": "The number of periods to check in the alert evaluation." + } + }, + "minFailingPeriodsToAlert": { + "type": "int", + "defaultValue": {{ .properties.failingPeriods.minFailingPeriodsToAlert }}, + "metadata": { + "description": "The number of unhealthy periods to alert on (must be lower or equal to numberOfEvaluationPeriods)." + } + }, + "timeAggregation": { + "type": "string", + "defaultValue": "{{ .properties.timeAggregation }}", + "allowedValues": [ + "Average", + "Minimum", + "Maximum", + "Total", + "Count" + ], + "metadata": { + "description": "How the data that is collected should be combined over time." + } + }, + "windowSize": { + "type": "string", + "defaultValue": "{{ .properties.windowSize }}", + "allowedValues": [ + "PT5M", + "PT15M", + "PT30M", + "PT1H" + ], + "metadata": { + "description": "Period of time used to monitor alert activity based on the threshold. Must be between five minutes and one hour. ISO 8601 duration format." + } + }, + "evaluationFrequency": { + "type": "string", + "defaultValue": "{{ .properties.evaluationFrequency }}", + "allowedValues": [ + "PT5M", + "PT15M", + "PT30M", + "PT1H" + ], + "metadata": { + "description": "how often the metric alert is evaluated represented in ISO 8601 duration format" + } + } + }, + "resources": [ + { + "type": "Microsoft.Insights/metricAlerts", + "apiVersion": "2018-03-01", + "name": "[parameters('alertName')]", + "location": "global", + "tags": { + "_deployed_by_amba": true + }, + "properties": { + "description": "[parameters('alertDescription')]", + "scopes": "[parameters('targetResourceId')]", + "targetResourceType": "[parameters('targetResourceType')]", + "targetResourceRegion": "[parameters('targetResourceRegion')]", + "severity": "[parameters('alertSeverity')]", + "enabled": "[parameters('isEnabled')]", + "evaluationFrequency": "[parameters('evaluationFrequency')]", + "windowSize": "[parameters('windowSize')]", + "criteria": { + "odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", + "allOf": [ + { + "criterionType": "DynamicThresholdCriterion", + "name": "1st criterion", + "metricName": "{{ .properties.metricName }}", + "dimensions": [{{ range $idx1, $value1 := .properties.dimensions }}{{ if ne $idx1 0}},{{ end }} + { + "name": "{{ $idx1 }}", + "operator": "{{ $value1.operator }}", + "values": [{{ range $idx2, $value2 := $value1.values }}{{ if ne $idx2 0}},{{ end }}"{{ $value2 }}"{{ end }}] + }{{ end }} + ], + "operator": "[parameters('operator')]", + "alertSensitivity": "[parameters('alertSensitivity')]", + "failingPeriods": { + "numberOfEvaluationPeriods": "[parameters('numberOfEvaluationPeriods')]", + "minFailingPeriodsToAlert": "[parameters('minFailingPeriodsToAlert')]" + }, + "timeAggregation": "[parameters('timeAggregation')]" + } + ] + }, + "actions": [ + { + "actionGroupId": "[parameters('actionGroupId')]" + } + ] + } + } + ] +} diff --git a/docs/layouts/partials/templates/arm/metric-static.html b/docs/layouts/partials/templates/arm/metric-static.html new file mode 100644 index 000000000..e0c9d76e6 --- /dev/null +++ b/docs/layouts/partials/templates/arm/metric-static.html @@ -0,0 +1,180 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "alertName": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "Name of the alert" + } + }, + "alertDescription": { + "type": "string", + "defaultValue": "{{ .description }}", + "metadata": { + "description": "Description of alert" + }, + }, + "targetResourceId": { + "type": "array", + "minLength": 1, + "metadata": { + "description": "Array of Azure resource Ids. For example - /subscriptions/00000000-0000-0000-0000-0000-00000000/resourceGroup/resource-group-name/Microsoft.compute/virtualMachines/vm-name" + } + }, + "targetResourceRegion": { + "type": "string", + "metadata": { + "description": "Azure region in which target resources to be monitored are in (without spaces). For example: EastUS" + } + }, + "targetResourceType": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "Resource type of target resources to be monitored." + } + }, + "actionGroupId": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "The ID of the action group that is triggered when the alert is activated or deactivated" + } + }, + "isEnabled": { + "type": "bool", + "defaultValue": true, + "metadata": { + "description": "Specifies whether the alert is enabled" + } + }, + "alertSeverity": { + "type": "int", + "defaultValue": {{ .properties.severity }}, + "allowedValues": [ + 0, + 1, + 2, + 3, + 4 + ], + "metadata": { + "description": "Severity of alert {0,1,2,3,4}" + } + }, + "operator": { + "type": "string", + "defaultValue": "{{ .properties.operator }}", + "allowedValues": [ + "Equals", + "GreaterThan", + "GreaterThanOrEqual", + "LessThan", + "LessThanOrEqual" + ], + "metadata": { + "description": "Operator comparing the current value with the threshold value." + } + }, + "threshold": { + "type": "string", + "defaultValue": "{{ .properties.threshold }}", + "metadata": { + "description": "The threshold value at which the alert is activated." + } + }, + "timeAggregation": { + "type": "string", + "defaultValue": "{{ .properties.timeAggregation }}", + "allowedValues": [ + "Average", + "Minimum", + "Maximum", + "Total", + "Count" + ], + "metadata": { + "description": "How the data that is collected should be combined over time." + } + }, + "windowSize": { + "type": "string", + "defaultValue": "{{ .properties.windowSize }}", + "allowedValues": [ + "PT1M", + "PT5M", + "PT15M", + "PT30M", + "PT1H", + "PT6H", + "PT12H", + "PT24H" + ], + "metadata": { + "description": "Period of time used to monitor alert activity based on the threshold. Must be between one minute and one day. ISO 8601 duration format." + } + }, + "evaluationFrequency": { + "type": "string", + "defaultValue": "{{ .properties.evaluationFrequency }}", + "allowedValues": [ + "PT1M", + "PT5M", + "PT15M", + "PT30M", + "PT1H" + ], + "metadata": { + "description": "how often the metric alert is evaluated represented in ISO 8601 duration format" + } + } + }, + "resources": [ + { + "type": "Microsoft.Insights/metricAlerts", + "apiVersion": "2018-03-01", + "name": "[parameters('alertName')]", + "location": "global", + "tags": { + "_deployed_by_amba": true + }, + "properties": { + "description": "[parameters('alertDescription')]", + "scopes": "[parameters('targetResourceId')]", + "targetResourceType": "[parameters('targetResourceType')]", + "targetResourceRegion": "[parameters('targetResourceRegion')]", + "severity": "[parameters('alertSeverity')]", + "enabled": "[parameters('isEnabled')]", + "evaluationFrequency": "[parameters('evaluationFrequency')]", + "windowSize": "[parameters('windowSize')]", + "criteria": { + "odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", + "allOf": [ + { + "name": "1st criterion", + "metricName": "{{ .properties.metricName }}", + "dimensions": [{{ range $idx1, $value1 := .properties.dimensions }}{{ if ne $idx1 0}},{{ end }} + { + "name": "{{ $idx1 }}", + "operator": "{{ $value1.operator }}", + "values": [{{ range $idx2, $value2 := $value1.values }}{{ if ne $idx2 0}},{{ end }}"{{ $value2 }}"{{ end }}] + }{{ end }} + ], + "operator": "[parameters('operator')]", + "threshold": "[parameters('threshold')]", + "timeAggregation": "[parameters('timeAggregation')]", + "criterionType": "StaticThresholdCriterion" + } + ] + }, + "actions": [ + { + "actionGroupId": "[parameters('actionGroupId')]" + } + ] + } + } + ] +} diff --git a/docs/layouts/partials/templates/bicep/activity-administrative.html b/docs/layouts/partials/templates/bicep/activity-administrative.html new file mode 100644 index 000000000..c128173b7 --- /dev/null +++ b/docs/layouts/partials/templates/bicep/activity-administrative.html @@ -0,0 +1,52 @@ +@description('Unique name (within the Resource Group) for the Activity log alert.') +@minLength(1) +param activityLogAlertName string + +@description('Description of alert') +param alertDescription string = '{{ .description }}' + +@description('Indicates whether or not the alert is enabled.') +param activityLogAlertEnabled bool = true + +@description('The ID of the action group that is triggered when the alert is activated or deactivated') +param actionGroupId string = '' + +resource symbolicname 'Microsoft.Insights/activityLogAlerts@2023-01-01-preview' = { + name: activityLogAlertName + location: 'Global' + tags: { + '_deployed_by_amba': true + } + properties: { + description: alertDescription + scopes: [ + subscription().id + ] + enabled: bool + condition: { + allOf: [ + { + { + field: 'category' + equals: 'Administrative' + } + { + field: 'operationName' + equals: '{{ .properties.operationName }}' + } + { + field: 'status' + containsAny: [{{ range $idx1, $value1 := .properties.status }}'{{ $value1 }}'{{ end }}] + } + } + ] + } + actions: { + actionGroups: [ + { + actionGroupId: actionGroupId + } + ] + } + } +} diff --git a/docs/layouts/partials/templates/bicep/activity-resourcehealth.html b/docs/layouts/partials/templates/bicep/activity-resourcehealth.html new file mode 100644 index 000000000..6ae16a826 --- /dev/null +++ b/docs/layouts/partials/templates/bicep/activity-resourcehealth.html @@ -0,0 +1,62 @@ +@description('Unique name (within the Resource Group) for the Activity log alert.') +@minLength(1) +param activityLogAlertName string + +@description('Description of alert') +param alertDescription string = '{{ .description }}' + +@description('Indicates whether or not the alert is enabled.') +param activityLogAlertEnabled bool = true + +@description('The ID of the action group that is triggered when the alert is activated or deactivated') +param actionGroupId string = '' + +resource symbolicname 'Microsoft.Insights/activityLogAlerts@2023-01-01-preview' = { + name: activityLogAlertName + location: 'Global' + tags: { + '_deployed_by_amba': true + } + properties: { + description: alertDescription + scopes: [ + subscription().id + ] + enabled: bool + condition: { + allOf: [ + { + field: 'category' + equals: 'ResourceHealth' + } + { + anyOf: [ + {{ range $idx, $value := .properties.causes }} + { + field: 'properties.cause' + equals: '{{ $value }}' + } + {{ end }} + ] + } + { + anyOf: [ + {{ range $idx, $value := .properties.currentHealthStatus }} + { + field: 'properties.currentHealthStatus' + equals: '{{ $value }}' + } + {{ end }} + ] + } + ] + } + actions: { + actionGroups: [ + { + actionGroupId: actionGroupId + } + ] + } + } +} diff --git a/docs/layouts/partials/templates/bicep/activity-servicehealth.html b/docs/layouts/partials/templates/bicep/activity-servicehealth.html new file mode 100644 index 000000000..50b5e81a2 --- /dev/null +++ b/docs/layouts/partials/templates/bicep/activity-servicehealth.html @@ -0,0 +1,48 @@ +@description('Unique name (within the Resource Group) for the Activity log alert.') +@minLength(1) +param activityLogAlertName string + +@description('Description of alert') +param alertDescription string = '{{ .description }}' + +@description('Indicates whether or not the alert is enabled.') +param activityLogAlertEnabled bool = true + +@description('The ID of the action group that is triggered when the alert is activated or deactivated') +param actionGroupId string = '' + +resource symbolicname 'Microsoft.Insights/activityLogAlerts@2023-01-01-preview' = { + name: activityLogAlertName + location: 'Global' + tags: { + '_deployed_by_amba': true + } + properties: { + description: alertDescription + scopes: [ + subscription().id + ] + enabled: bool + condition: { + allOf: [ + { + { + field: 'category' + equals: 'ServiceHealth' + } + { + field: 'properties.incidentType' + equals: '{{ .properties.incidentType }}' + } + } + ] + } + actions: { + actionGroups: [ + { + actionGroupId: actionGroupId + } + ] + } + } +} diff --git a/docs/layouts/partials/templates/bicep/log.html b/docs/layouts/partials/templates/bicep/log.html new file mode 100644 index 000000000..eaded5818 --- /dev/null +++ b/docs/layouts/partials/templates/bicep/log.html @@ -0,0 +1,166 @@ +@description('Name of the alert') +@minLength(1) +param alertName string + +@description('Location of the alert') +@minLength(1) +param location string + +@description('Description of alert') +param alertDescription string = '{{ .description }}' + +@description('Specifies whether the alert is enabled') +param isEnabled bool = true + +@description('Specifies whether to check linked storage and fail creation if the storage was not found') +param checkWorkspaceAlertsStorageConfigured bool = false + +@description('Full Resource ID of the resource emitting the metric that will be used for the comparison. For example /subscriptions/00000000-0000-0000-0000-0000-00000000/resourceGroups/ResourceGroupName/providers/Microsoft.compute/virtualMachines/VM_xyz') +@minLength(1) +param resourceId string + +@description('Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired.') +@allowed([ + 'PT1M' + 'PT5M' + 'PT15M' + 'PT30M' + 'PT1H' + 'PT6H' + 'PT12H' + 'PT24H' +]) +param muteActionsDuration string + +@description('The ID of the action group that is triggered when the alert is activated or deactivated') +param actionGroupId string = '' + +@description('Severity of alert {0,1,2,3,4}') +@allowed([ + 0 + 1 + 2 + 3 + 4 +]) +param alertSeverity int = {{ .properties.severity }} + +@description('Specifies whether the alert will automatically resolve') +param autoMitigate bool = {{ .properties.autoMitigate }} + +@description('Name of the metric used in the comparison to activate the alert.') +@minLength(1) +param query string = '{{ safeHTML (replace .properties.query "\n" " ") }}' + +@description('Name of the measure column used in the alert evaluation.') +param metricMeasureColumn string = '{{ .properties.metricMeasureColumn }}' + +@description('Name of the resource ID column used in the alert targeting the alerts.') +param resourceIdColumn string = '{{ .properties.resouceIdColumn }}' + +@description('Operator comparing the current value with the threshold value.') +@allowed([ + 'Equals' + 'GreaterThan' + 'GreaterThanOrEqual' + 'LessThan' + 'LessThanOrEqual' +]) +param operator string = '{{ .properties.operator }}' + +@description('The threshold value at which the alert is activated.') +param threshold string = '{{ .properties.threshold }}' + +@description('The number of periods to check in the alert evaluation.') +param numberOfEvaluationPeriods int = {{ .properties.failingPeriods.numberOfEvaluationPeriods }} + +@description('The number of unhealthy periods to alert on (must be lower or equal to numberOfEvaluationPeriods).') +param minFailingPeriodsToAlert int = {{ .properties.failingPeriods.minFailingPeriodsToAlert }} + +@description('How the data that is collected should be combined over time.') +@allowed([ + 'Average' + 'Minimum' + 'Maximum' + 'Total' + 'Count' +]) +param timeAggregation string = '{{ .properties.timeAggregation }}' + +@description('Period of time used to monitor alert activity based on the threshold. Must be between one minute and one day. ISO 8601 duration format.') +@allowed([ + 'PT1M' + 'PT5M' + 'PT15M' + 'PT30M' + 'PT1H' + 'PT6H' + 'PT12H' + 'PT24H' +]) +param windowSize string = '{{ .properties.windowSize }}' + +@description('how often the metric alert is evaluated represented in ISO 8601 duration format') +@allowed([ + 'PT5M' + 'PT15M' + 'PT30M' + 'PT1H' +]) +param evaluationFrequency string = '{{ .properties.evaluationFrequency }}' + + +resource alert 'Microsoft.Insights/scheduledQueryRules@2021-08-01' = { + name: alertName + location: location + tags: { + '_deployed_by_amba': true + } + properties: { + description: alertDescription + severity: alertSeverity + enabled: isEnabled + scopes: [ + resourceId + ] + evaluationFrequency: evaluationFrequency + windowSize: windowSize + criteria: { + allOf: [ + { + query: query + metricMeasureColumn: metricMeasureColumn + resourceIdColumn: resourceIdColumn + if eq (len .properties.dimensions) 0 { + dimensions: [] + } else { + dimensions: [{{ range $idx1, $value1 := .properties.dimensions }} + { + name: '{{ $idx1 }}' + operator: '{{ $value1.operator }}' + values: [{{ range $idx2, $value2 := $value1.values }}'{{ $value2 }}'{{ end }}] + }{{ end }} + ] + } + operator: operator + threshold: threshold + timeAggregation: timeAggregation + failingPeriods: { + numberOfEvaluationPeriods: numberOfEvaluationPeriods + minFailingPeriodsToAlert: minFailingPeriodsToAlert + } + } + ] + } + muteActionsDuration: muteActionsDuration + autoMitigate: autoMitigate + checkWorkspaceAlertsStorageConfigured: checkWorkspaceAlertsStorageConfigured + actions: { + actionGroups: [ + actionGroupId + ] + customProperties: { + } + } + } +} diff --git a/docs/layouts/partials/templates/bicep/metric-dynamic.html b/docs/layouts/partials/templates/bicep/metric-dynamic.html new file mode 100644 index 000000000..832d427a5 --- /dev/null +++ b/docs/layouts/partials/templates/bicep/metric-dynamic.html @@ -0,0 +1,134 @@ +@description('Name of the alert') +@minLength(1) +param alertName string + +@description('Description of alert') +param alertDescription string = '{{ .description }}' + +@description('array of Azure resource Ids. For example - /subscriptions/00000000-0000-0000-0000-0000-00000000/resourceGroup/resource-group-name/Microsoft.compute/virtualMachines/vm-name') +@minLength(1) +param targetResourceId array + +@description('Azure region in which target resources to be monitored are in (without spaces). For example: EastUS') +param targetResourceRegion string + +@description('Resource type of target resources to be monitored.') +@minLength(1) +param targetResourceType string + +@description('The ID of the action group that is triggered when the alert is activated or deactivated') +param actionGroupId string = '' + +@description('Specifies whether the alert is enabled') +param isEnabled bool = true + +@description('Severity of alert {0,1,2,3,4}') +@allowed([ + 0 + 1 + 2 + 3 + 4 +]) +param alertSeverity int = {{ .properties.severity }} + +@description('Operator comparing the current value with the threshold value.') +@allowed([ + 'GreaterThan' + 'LessThan' + 'GreaterOrLessThan' +]) +param operator string = '{{ .properties.operator }}' + +@description('Tunes how \'noisy\' the Dynamic Thresholds alerts will be: \'High\' will result in more alerts while \'Low\' will result in fewer alerts.') +@allowed([ + 'High' + 'Medium' + 'Low' +]) +param alertSensitivity string = '{{ .properties.alertSensitivity }}' + +@description('The number of periods to check in the alert evaluation.') +param numberOfEvaluationPeriods int = {{ .properties.failingPeriods.numberOfEvaluationPeriods }} + +@description('The number of unhealthy periods to alert on (must be lower or equal to numberOfEvaluationPeriods).') +param minFailingPeriodsToAlert int = {{ .properties.failingPeriods.minFailingPeriodsToAlert }} + +@description('How the data that is collected should be combined over time.') +@allowed([ + 'Average' + 'Minimum' + 'Maximum' + 'Total' + 'Count' +]) +param timeAggregation string = '{{ .properties.timeAggregation }}' + +@description('Period of time used to monitor alert activity based on the threshold. Must be between five minutes and one hour. ISO 8601 duration format.') +@allowed([ + 'PT5M' + 'PT15M' + 'PT30M' + 'PT1H' +]) +param windowSize string = '{{ .properties.windowSize }}' + +@description('how often the metric alert is evaluated represented in ISO 8601 duration format') +@allowed([ + 'PT5M' + 'PT15M' + 'PT30M' + 'PT1H' +]) +param evaluationFrequency string = '{{ .properties.evaluationFrequency }}' + +resource metricAlert 'Microsoft.Insights/metricAlerts@2018-03-01' = { + name: alertName + location: 'global' + tags: { + '_deployed_by_amba': true + } + properties: { + description: alertDescription + scopes: targetResourceId + targetResourceType: targetResourceType + targetResourceRegion: targetResourceRegion + severity: alertSeverity + enabled: isEnabled + evaluationFrequency: evaluationFrequency + windowSize: windowSize + criteria: { + 'odata.type': 'Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria' + allOf: [ + { + criterionType: 'DynamicThresholdCriterion' + name: '1st criterion' + metricName: '{{ .properties.metricName }}' + if eq (len .properties.dimensions) 0 { + dimensions: [] + } else { + dimensions: [{{ range $idx1, $value1 := .properties.dimensions }} + { + name: '{{ $idx1 }}' + operator: '{{ $value1.operator }}' + values: [{{ range $idx2, $value2 := $value1.values }}'{{ $value2 }}'{{ end }}] + }{{ end }} + ] + } + operator: operator + alertSensitivity: alertSensitivity + failingPeriods: { + numberOfEvaluationPeriods: numberOfEvaluationPeriods + minFailingPeriodsToAlert: minFailingPeriodsToAlert + } + timeAggregation: timeAggregation + } + ] + } + actions: [ + { + actionGroupId: actionGroupId + } + ] + } +} diff --git a/docs/layouts/partials/templates/bicep/metric-static.html b/docs/layouts/partials/templates/bicep/metric-static.html new file mode 100644 index 000000000..821c6dc11 --- /dev/null +++ b/docs/layouts/partials/templates/bicep/metric-static.html @@ -0,0 +1,126 @@ +@description('Name of the alert') +@minLength(1) +param alertName string + +@description('Description of alert') +param alertDescription string = '{{ .description }}' + +@description('Array of Azure resource Ids. For example - /subscriptions/00000000-0000-0000-0000-0000-00000000/resourceGroup/resource-group-name/Microsoft.compute/virtualMachines/vm-name') +@minLength(1) +param targetResourceId array + +@description('Azure region in which target resources to be monitored are in (without spaces). For example: EastUS') +param targetResourceRegion string + +@description('Resource type of target resources to be monitored.') +@minLength(1) +param targetResourceType string + +@description('The ID of the action group that is triggered when the alert is activated or deactivated') +param actionGroupId string = '' + +@description('Specifies whether the alert is enabled') +param isEnabled bool = true + +@description('Severity of alert {0,1,2,3,4}') +@allowed([ + 0 + 1 + 2 + 3 + 4 +]) +param alertSeverity int = {{ .properties.severity }} + +@description('Operator comparing the current value with the threshold value.') +@allowed([ + 'Equals' + 'GreaterThan' + 'GreaterThanOrEqual' + 'LessThan' + 'LessThanOrEqual' +]) +param operator string = '{{ .properties.operator }}' + +@description('The threshold value at which the alert is activated.') +param threshold string = '{{ .properties.threshold }}' + +@description('How the data that is collected should be combined over time.') +@allowed([ + 'Average' + 'Minimum' + 'Maximum' + 'Total' + 'Count' +]) +param timeAggregation string = '{{ .properties.timeAggregation }}' + +@description('Period of time used to monitor alert activity based on the threshold. Must be between one minute and one day. ISO 8601 duration format.') +@allowed([ + 'PT1M' + 'PT5M' + 'PT15M' + 'PT30M' + 'PT1H' + 'PT6H' + 'PT12H' + 'PT24H' +]) +param windowSize string = '{{ .properties.windowSize }}' + +@description('how often the metric alert is evaluated represented in ISO 8601 duration format') +@allowed([ + 'PT1M' + 'PT5M' + 'PT15M' + 'PT30M' + 'PT1H' +]) +param evaluationFrequency string = '{{ .properties.evaluationFrequency }}' + +resource metricAlert 'Microsoft.Insights/metricAlerts@2018-03-01' = { + name: alertName + location: 'global' + tags: { + '_deployed_by_amba': true + } + properties: { + description: alertDescription + scopes: targetResourceId + targetResourceType: targetResourceType + targetResourceRegion: targetResourceRegion + severity: alertSeverity + enabled: isEnabled + evaluationFrequency: evaluationFrequency + windowSize: windowSize + criteria: { + 'odata.type': 'Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria' + allOf: [ + { + name: '1st criterion' + metricName: '{{ .properties.metricName }}' + if eq (len .properties.dimensions) 0 { + dimensions: [] + } else { + dimensions: [{{ range $idx1, $value1 := .properties.dimensions }} + { + name: '{{ $idx1 }}' + operator: '{{ $value1.operator }}' + values: [{{ range $idx2, $value2 := $value1.values }}'{{ $value2 }}'{{ end }}] + }{{ end }} + ] + } + operator: operator + threshold: threshold + timeAggregation: timeAggregation + criterionType: 'StaticThresholdCriterion' + } + ] + } + actions: [ + { + actionGroupId: actionGroupId + } + ] + } +} diff --git a/docs/layouts/partials/templates/template-tabs.html b/docs/layouts/partials/templates/template-tabs.html new file mode 100644 index 000000000..776888dae --- /dev/null +++ b/docs/layouts/partials/templates/template-tabs.html @@ -0,0 +1,100 @@ +
+ + +
+

Click a tab to view the template

+
+ + +
+ {{ if eq .alert.type "Metric" }} + {{ if eq .alert.properties.criterionType "StaticThresholdCriterion" }} + {{ highlight (partial "templates/arm/metric-static.html" .alert) "json" }} + {{ else }} + {{ highlight (partial "templates/arm/metric-dynamic.html" .alert) "json" }} + {{ end }} + {{ else if eq .alert.type "Log" }} + {{ highlight (partial "templates/arm/log.html" .alert) "json" }} + {{ else if eq .alert.type "ActivityLog" }} + {{ if eq .alert.properties.category "Administrative" }} + {{ highlight (partial "templates/arm/activity-administrative.html" .alert) "json" }} + {{ else if eq .alert.properties.category "ServiceHealth" }} + {{ highlight (partial "templates/arm/activity-servicehealth.html" .alert) "json" }} + {{ else if eq .alert.properties.category "ResourceHealth" }} + {{ highlight (partial "templates/arm/activity-resourcehealth.html" .alert) "json" }} + {{ end}} + {{ end }} +
+ + +
+ {{ if eq .alert.type "Metric" }} + {{ if eq .alert.properties.criterionType "StaticThresholdCriterion" }} + {{ highlight (partial "templates/bicep/metric-static.html" .alert) "bicep" }} + {{ else }} + {{ highlight (partial "templates/bicep/metric-dynamic.html" .alert) "bicep" }} + {{ end }} + {{ else if eq .alert.type "Log" }} + {{ highlight (partial "templates/bicep/log.html" .alert) "bicep" }} + {{ else if eq .alert.type "ActivityLog" }} + {{ if eq .alert.properties.category "Administrative" }} + {{ highlight (partial "templates/bicep/activity-administrative.html" .alert) "bicep" }} + {{ else if eq .alert.properties.category "ServiceHealth" }} + {{ highlight (partial "templates/bicep/activity-servicehealth.html" .alert) "bicep" }} + {{ else if eq .alert.properties.category "ResourceHealth" }} + {{ highlight (partial "templates/bicep/activity-resourcehealth.html" .alert) "bicep" }} + {{ end}} + {{ end }} +
+ {{ $name := .alert.name }} + {{ $category := .category }} + {{ $type := .type }} + {{ range $idx, $value := .alert.deployments }} + + + {{ $file := path.Join "services/" $category $type $value.template }} +
+ + + + + + + +
Name{{ $value.name }}
Template{{ $value.template }} (Download)
Tags{{ delimit $value.tags "," }}
Properties + {{ range $key, $value := $value.properties }} + {{ $key }}: {{ $value }}
+ {{ end }} +
+ {{ $data := readFile $file }} + {{ highlight $data "json" }} +
+ {{ end }} +
diff --git a/docs/layouts/shortcodes/alertList.html b/docs/layouts/shortcodes/alertList.html index 24dd23aaa..daf844ea0 100644 --- a/docs/layouts/shortcodes/alertList.html +++ b/docs/layouts/shortcodes/alertList.html @@ -19,7 +19,7 @@ Description - {{ range .alerts }} + {{ range sort .alerts }} {{ if or (eq .visible true) (eq $.Site.Params.ambaDevMode true) }} {{ .name }} @@ -34,7 +34,7 @@
- {{ range .alerts }} + {{ range sort .alerts }} {{ if or (eq .visible true) (eq $.Site.Params.ambaDevMode true) }}

@@ -66,18 +66,8 @@

References:

{{ end }} -

Deployment Templates:

- - {{ range .deployments }} - - - {{ $url := path.Join $.Page.File.Dir .template }} - - - {{ end }} -
{{ .name }} - View | Download -
+

Templates:

+ {{ partial "templates/template-tabs" (dict "category" $category "type" $type "alert" .) }}
{{ end }} {{ end }} diff --git a/docs/layouts/shortcodes/metricTemplate.html b/docs/layouts/shortcodes/metricTemplate.html new file mode 100644 index 000000000..f14b27578 --- /dev/null +++ b/docs/layouts/shortcodes/metricTemplate.html @@ -0,0 +1,6 @@ + +{{ $category := "Compute" }} +{{ $type := "virtualMachines" }} + +{{ partial "templates/template-tabs" . }} + diff --git a/services/Compute/virtualMachineScaleSets/alerts.yaml b/services/Compute/virtualMachineScaleSets/alerts.yaml index 0971cef0f..372cc4ccc 100644 --- a/services/Compute/virtualMachineScaleSets/alerts.yaml +++ b/services/Compute/virtualMachineScaleSets/alerts.yaml @@ -236,7 +236,7 @@ criterionType: DynamicThresholdCriterion failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: 4 alertSensitivity: Low autoMitigate: false references: @@ -261,7 +261,7 @@ criterionType: DynamicThresholdCriterion failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: 4 alertSensitivity: Low autoMitigate: false references: diff --git a/services/ContainerInstance/containerGroups/alerts.yaml b/services/ContainerInstance/containerGroups/alerts.yaml index 92a879ac1..86575a290 100644 --- a/services/ContainerInstance/containerGroups/alerts.yaml +++ b/services/ContainerInstance/containerGroups/alerts.yaml @@ -41,7 +41,7 @@ - '*' failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Low autoMitigate: false - name: NetworkBytesReceivedPerSecond @@ -63,7 +63,7 @@ criterionType: DynamicThresholdCriterion failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Low autoMitigate: false - name: NetworkBytesTransmittedPerSecond @@ -85,6 +85,6 @@ criterionType: DynamicThresholdCriterion failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Low autoMitigate: false diff --git a/services/EventHub/namespaces/alerts.yaml b/services/EventHub/namespaces/alerts.yaml index c6a975ae9..fb421f48e 100644 --- a/services/EventHub/namespaces/alerts.yaml +++ b/services/EventHub/namespaces/alerts.yaml @@ -17,7 +17,7 @@ criterionType: DynamicThresholdCriterion failingPeriods: numberOfEvaluationPeriods: 6 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Low autoMitigate: false - name: QuotaExceededErrors @@ -39,7 +39,7 @@ criterionType: DynamicThresholdCriterion failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Low autoMitigate: false - name: ServerErrors @@ -61,7 +61,7 @@ criterionType: DynamicThresholdCriterion failingPeriods: numberOfEvaluationPeriods: 6 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Low autoMitigate: false - name: IncomingMessages diff --git a/services/Logic/workflows/alerts.yaml b/services/Logic/workflows/alerts.yaml index 4b526d61a..5c7a597dc 100644 --- a/services/Logic/workflows/alerts.yaml +++ b/services/Logic/workflows/alerts.yaml @@ -150,7 +150,7 @@ criterionType: DynamicThresholdCriterion failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Medium autoMitigate: false - name: ActionLatency diff --git a/services/OperationalInsights/workspaces/alerts.yaml b/services/OperationalInsights/workspaces/alerts.yaml index 03f891111..8994e702c 100644 --- a/services/OperationalInsights/workspaces/alerts.yaml +++ b/services/OperationalInsights/workspaces/alerts.yaml @@ -523,7 +523,7 @@ - '*' failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Medium autoMitigate: false - name: Average_Bytes Received/sec @@ -563,7 +563,7 @@ - '*' failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Medium autoMitigate: false - name: Average_Total Bytes Transmitted @@ -603,7 +603,7 @@ - '*' failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Medium autoMitigate: false - name: Average_Total Bytes Received @@ -643,7 +643,7 @@ - '*' failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Medium autoMitigate: false - name: Average_% IO Wait Time diff --git a/services/RecoveryServices/vaults/_index.md b/services/RecoveryServices/vaults/_index.md index 30124b0aa..015510ee9 100644 --- a/services/RecoveryServices/vaults/_index.md +++ b/services/RecoveryServices/vaults/_index.md @@ -3,4 +3,7 @@ title: Vaults geekdocCollapseSection: true --- -{{< alertList name="alertList" >}} \ No newline at end of file +{{< alertList name="alertList" >}} + + + diff --git a/services/RecoveryServices/vaults/alerts.yaml b/services/RecoveryServices/vaults/alerts.yaml index bd59bf381..d6fdd924c 100644 --- a/services/RecoveryServices/vaults/alerts.yaml +++ b/services/RecoveryServices/vaults/alerts.yaml @@ -16,8 +16,7 @@ - name: Move to Azure Monitor Alerts url: https://learn.microsoft.com/en-us/azure/backup/move-to-azure-monitor-alerts deployments: - - name: Deploy RV Backup Health Monitoring Alerts - monitor alerts + - name: Deploy RV Backup Health Monitoring Alerts monitor alerts template: Modify-RSV-BackupHealth-Alert.json type: Policy tags: diff --git a/services/Sql/servers/alerts.yaml b/services/Sql/servers/alerts.yaml index cc0327c79..9925d410f 100644 --- a/services/Sql/servers/alerts.yaml +++ b/services/Sql/servers/alerts.yaml @@ -93,7 +93,7 @@ criterionType: DynamicThresholdCriterion failingPeriods: numberOfEvaluationPeriods: 5 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Low autoMitigate: false - name: connection_failed_user_error diff --git a/services/Web/serverFarms/alerts.yaml b/services/Web/serverFarms/alerts.yaml index 8de124c81..e42df77d2 100644 --- a/services/Web/serverFarms/alerts.yaml +++ b/services/Web/serverFarms/alerts.yaml @@ -138,7 +138,7 @@ criterionType: DynamicThresholdCriterion failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Low autoMitigate: false - name: BytesSent @@ -160,7 +160,7 @@ criterionType: DynamicThresholdCriterion failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Low autoMitigate: false - name: TcpEstablished diff --git a/services/Web/sites/alerts.yaml b/services/Web/sites/alerts.yaml index 71702ae1c..66874138f 100644 --- a/services/Web/sites/alerts.yaml +++ b/services/Web/sites/alerts.yaml @@ -251,7 +251,7 @@ criterionType: DynamicThresholdCriterion failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Low autoMitigate: false - name: Http406 @@ -334,7 +334,7 @@ criterionType: DynamicThresholdCriterion failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Low autoMitigate: false - name: FunctionExecutionUnits @@ -415,7 +415,7 @@ criterionType: DynamicThresholdCriterion failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Medium autoMitigate: false - name: Gen0Collections @@ -439,7 +439,7 @@ criterionType: DynamicThresholdCriterion failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Medium autoMitigate: false - name: Gen1Collections @@ -463,7 +463,7 @@ criterionType: DynamicThresholdCriterion failingPeriods: numberOfEvaluationPeriods: 4 - minFailingPeroidsToAlert: minFailingPeroidsToAlert + minFailingPeriodsToAlert: minFailingPeriodsToAlert alertSensitivity: Medium autoMitigate: false - name: Http5xx diff --git a/tooling/mass-change/.gitignore b/tooling/mass-change/.gitignore new file mode 100644 index 000000000..1800ba127 --- /dev/null +++ b/tooling/mass-change/.gitignore @@ -0,0 +1,22 @@ +# Local python packages +.python_packages/ + +# Python Environments +.env +.venv/ +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# Visual Studio Code +.vscode + +# output files +*.csv diff --git a/tooling/mass-change/mass-change.py b/tooling/mass-change/mass-change.py new file mode 100644 index 000000000..8dc7765ef --- /dev/null +++ b/tooling/mass-change/mass-change.py @@ -0,0 +1,56 @@ +import yaml +import argparse +import os + + +# Parse command line arguments +def parseArguments(): + parser = argparse.ArgumentParser(description='This script helps make mass changes to AMBA repo.') + parser.add_argument('-a', '--amba-dir', type=str, required=False, metavar='file', help='Path to metric definitions', default="../..") + + args = parser.parse_args() + + return args + + +# Output the query results to a JSON file +def outputToYamlFile(data, filename): + # Write the results to a file + with open(filename, "w+") as f: + yaml.dump(data, f, indent=2, default_flow_style=False, sort_keys=False) + + +def main(): + + args = parseArguments() + + dir = args.amba_dir + + # Walk the directory structure and find all alerts.yaml files + for subdir, dirs, files in os.walk(dir): + for file in files: + if file != "alerts.yaml": + continue + + with open(os.path.join(subdir, file), "r+") as f: + + alerts = [] + try: + alerts = yaml.load(f, Loader=yaml.FullLoader) + except: + continue + + for alert in alerts: + if alert["type"] == "Log" or alert["type"] == "Metric": + alert["properties"]["autoMitigate"] = False + + if alert["type"] == "Log": + alert["properties"]["autoResolve"] = False + alert["properties"]["autoResolveTime"] = "" + + # write yaml file + outputToYamlFile(alerts, os.path.join(subdir, file)) + + +if __name__ == "__main__": + main() diff --git a/tooling/mass-change/requirement.txt b/tooling/mass-change/requirement.txt new file mode 100644 index 000000000..c3726e8bf --- /dev/null +++ b/tooling/mass-change/requirement.txt @@ -0,0 +1 @@ +pyyaml diff --git a/tooling/query-metrics-alerts/analysis_query.kql b/tooling/query-metrics-alerts/analysis_query.kql index 07f3538e1..c6c19e6c5 100644 --- a/tooling/query-metrics-alerts/analysis_query.kql +++ b/tooling/query-metrics-alerts/analysis_query.kql @@ -93,6 +93,6 @@ rulesExpanded ( resourceTypes ) on resourceType -| extend failingPeriods = iif(criterionType =~ "DynamicThresholdCriterion", bag_pack("numberOfEvaluationPeriods", numberOfEvaluationPeriods, "minFailingPeroidsToAlert", "minFailingPeroidsToAlert"), "") +| extend failingPeriods = iif(criterionType =~ "DynamicThresholdCriterion", bag_pack("numberOfEvaluationPeriods", numberOfEvaluationPeriods, "minFailingPeriodsToAlert", "minFailingPeriodsToAlert"), "") | project resourceType, numRulesRt, metricName, numRules, operator, timeAggregation, criterionType, frequency, windowSize, severity, dimensions, threshold, alertSensitivity, failingPeriods | order by resourceType asc, numRules desc