Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EES-5687 - removed base alert templates for CPU, memory and response times #5489

Draft
wants to merge 1 commit into
base: EES-5687-add-resource-utilisation-metric-alerts
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module postgreSqlServerModule '../../components/postgresqlDatabase.bicep' = {
diskBandwidth: true
diskIops: true
memoryPercentage: true
alertGroupName: resourceNames.existingResources.alertsGroup
alertsGroupName: resourceNames.existingResources.alertsGroup
} : null
tagValues: tagValues
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

25 changes: 25 additions & 0 deletions infrastructure/templates/public-api/components/alerts/config.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var defaultDynamicAlertConfig = {
aggregation: 'Average'
operator: 'GreaterThan'
evaluationFrequency: 'PT5M'
windowSize: 'PT15M'
numberOfEvaluationPeriods: 5
minFailingPeriodsToAlert: 5
sensitivity: 'Low'
severity: 'Warning'
}

@export()
var cpuPercentageConfig = union(defaultDynamicAlertConfig, {
nameSuffix: 'cpu-percentage'
})

@export()
var memoryPercentageConfig = union(defaultDynamicAlertConfig, {
nameSuffix: 'memory-percentage'
})

@export()
var responseTimeConfig = union(defaultDynamicAlertConfig, {
nameSuffix: 'response-time'
})

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import {
EvaluationFrequency
MetricName
DynamicMetricOperator
DynamicAlertConfig
ResourceType
TimeAggregation
WindowSize
Severity
Sensitivity
severityMapping
} from 'types.bicep'

import { ResourceMetric } from 'resourceMetrics.bicep'

@description('Name of the resource that this alert is being applied to.')
param resourceName string

@description('''
Optional id of the resource that this alert is being applied to,
if it cannot be looked up by the combination of resourceName and resourceType.
''')
param id string?

@description('Resource type and metric name combination.')
param resourceMetric ResourceMetric

@description('Configuration for this dynamic alert.')
param config DynamicAlertConfig

@description('''
An optional date that prevents machine learning algorithms from using metric data prior to this date in order to
calculate its dynamic threshold.
''')
param ignoreDataBefore string?

@description('Name of the Alerts Group used to send alert messages.')
param alertsGroupName string

@description('Tags with which to tag the resource in Azure.')
param tagValues object

var severityLevel = severityMapping[config.severity]

var resourceIds = [id != null ? id! : resourceId(resourceMetric.resourceType, resourceName)]

resource alertsActionGroup 'Microsoft.Insights/actionGroups@2023-01-01' existing = {
name: alertsGroupName
}

resource metricAlertRule 'Microsoft.Insights/metricAlerts@2018-03-01' = {
name: '${resourceName}-${config.nameSuffix}'
location: 'Global'
properties: {
enabled: true
scopes: resourceIds
severity: severityLevel
evaluationFrequency: config.evaluationFrequency
windowSize: config.windowSize
criteria: {
'odata.type': 'Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria'
allOf: [
{
criterionType: 'DynamicThresholdCriterion'
name: 'Metric1'
metricName: resourceMetric.metric
metricNamespace: resourceMetric.resourceType
timeAggregation: config.aggregation
operator: config.operator
alertSensitivity: config.sensitivity
skipMetricValidation: false
failingPeriods: {
minFailingPeriodsToAlert: config.minFailingPeriodsToAlert
numberOfEvaluationPeriods: config.numberOfEvaluationPeriods
}
ignoreDataBefore: ignoreDataBefore
}
]
}
actions: [
{
actionGroupId: alertsActionGroup.id
}
]
}
tags: tagValues
}

This file was deleted.

Loading
Loading