diff --git a/infrastructure/templates/public-api/application/public-api/publicApiApp.bicep b/infrastructure/templates/public-api/application/public-api/publicApiApp.bicep index 72a2120777..97cc4986ee 100644 --- a/infrastructure/templates/public-api/application/public-api/publicApiApp.bicep +++ b/infrastructure/templates/public-api/application/public-api/publicApiApp.bicep @@ -157,6 +157,8 @@ module apiContainerAppModule '../../components/containerApp.bicep' = { alerts: deployAlerts ? { restarts: true responseTime: true + cpuPercentage: true + memoryPercentage: true alertsGroupName: resourceNames.existingResources.alertsGroup } : null tagValues: tagValues diff --git a/infrastructure/templates/public-api/application/public-api/publicApiDataProcessor.bicep b/infrastructure/templates/public-api/application/public-api/publicApiDataProcessor.bicep index 1e214dc312..82070bdba1 100644 --- a/infrastructure/templates/public-api/application/public-api/publicApiDataProcessor.bicep +++ b/infrastructure/templates/public-api/application/public-api/publicApiDataProcessor.bicep @@ -114,6 +114,8 @@ module dataProcessorFunctionAppModule '../../components/functionApp.bicep' = { storageFirewallRules: storageFirewallRules alerts: deployAlerts ? { functionAppHealth: true + cpuPercentage: true + memoryPercentage: true storageAccountAvailability: true storageLatency: true fileServiceAvailability: true diff --git a/infrastructure/templates/public-api/application/shared/postgreSqlFlexibleServer.bicep b/infrastructure/templates/public-api/application/shared/postgreSqlFlexibleServer.bicep index ecca8569a1..4d9fddc329 100644 --- a/infrastructure/templates/public-api/application/shared/postgreSqlFlexibleServer.bicep +++ b/infrastructure/templates/public-api/application/shared/postgreSqlFlexibleServer.bicep @@ -62,6 +62,11 @@ module postgreSqlServerModule '../../components/postgresqlDatabase.bicep' = { availability: true queryTime: true transactionTime: true + clientConenctionsWaiting: true + cpuPercentage: true + diskBandwidth: true + diskIops: true + memoryPercentage: true alertGroupName: resourceNames.existingResources.alertsGroup } : null tagValues: tagValues diff --git a/infrastructure/templates/public-api/components/alerts/appGateways/backendPoolHealth.bicep b/infrastructure/templates/public-api/components/alerts/appGateways/backendPoolHealthAlert.bicep similarity index 71% rename from infrastructure/templates/public-api/components/alerts/appGateways/backendPoolHealth.bicep rename to infrastructure/templates/public-api/components/alerts/appGateways/backendPoolHealthAlert.bicep index 069e01ba90..24321cde43 100644 --- a/infrastructure/templates/public-api/components/alerts/appGateways/backendPoolHealth.bicep +++ b/infrastructure/templates/public-api/components/alerts/appGateways/backendPoolHealthAlert.bicep @@ -1,7 +1,7 @@ import { Severity } from '../types.bicep' -@description('Names of the resources that these alerts are being applied to.') -param resourceNames string[] +@description('Name of the resource that these alerts are being applied to.') +param resourceName string @description('The alert severity.') param severity Severity = 'Critical' @@ -12,11 +12,11 @@ param alertsGroupName string @description('Tags with which to tag the resource in Azure.') param tagValues object -module alerts '../staticMetricAlert.bicep' = [for name in resourceNames: { - name: '${name}BackendHealthAlertModule' +module alerts '../staticMetricAlert.bicep' = { + name: '${resourceName}BackendHealthAlertModule' params: { - alertName: '${name}-backend-pool-health' - resourceIds: [resourceId('Microsoft.Network/applicationGateways', name)] + alertName: '${resourceName}-backend-pool-health' + resourceIds: [resourceId('Microsoft.Network/applicationGateways', resourceName)] resourceType: 'Microsoft.Network/applicationGateways' query: { metric: 'UnhealthyHostCount' @@ -30,4 +30,4 @@ module alerts '../staticMetricAlert.bicep' = [for name in resourceNames: { alertsGroupName: alertsGroupName tagValues: tagValues } -}] +} diff --git a/infrastructure/templates/public-api/components/alerts/appGateways/responseTimeAlert.bicep b/infrastructure/templates/public-api/components/alerts/appGateways/responseTimeAlert.bicep index fa5fc24c9f..b767c7551b 100644 --- a/infrastructure/templates/public-api/components/alerts/appGateways/responseTimeAlert.bicep +++ b/infrastructure/templates/public-api/components/alerts/appGateways/responseTimeAlert.bicep @@ -1,10 +1,5 @@ -import { Severity } from '../types.bicep' - -@description('Names of the resources that these alerts are being applied to.') -param resourceNames string[] - -@description('The alert severity.') -param severity Severity = 'Warning' +@description('Name of the resource that these alerts are being applied to.') +param resourceName string @description('Name of the Alerts Group used to send alert messages.') param alertsGroupName string @@ -12,21 +7,13 @@ param alertsGroupName string @description('Tags with which to tag the resource in Azure.') param tagValues object -module alerts '../dynamicMetricAlert.bicep' = [for name in resourceNames: { - name: '${name}ResponseTimeAlertModule' +module alerts '../baseResponseTimeAlert.bicep' = { + name: '${resourceName}ResponseTimeAlertModule' params: { - alertName: '${name}-response-time' - resourceIds: [resourceId('Microsoft.Network/applicationGateways', name)] + resourceName: resourceName resourceType: 'Microsoft.Network/applicationGateways' - query: { - metric: 'ApplicationGatewayTotalTime' - aggregation: 'Average' - operator: 'GreaterThan' - } - evaluationFrequency: 'PT1M' - windowSize: 'PT5M' - severity: severity + metricName: 'ApplicationGatewayTotalTime' alertsGroupName: alertsGroupName tagValues: tagValues } -}] +} diff --git a/infrastructure/templates/public-api/components/alerts/appServicePlans/cpuPercentageAlert.bicep b/infrastructure/templates/public-api/components/alerts/appServicePlans/cpuPercentageAlert.bicep new file mode 100644 index 0000000000..63a12bf7e6 --- /dev/null +++ b/infrastructure/templates/public-api/components/alerts/appServicePlans/cpuPercentageAlert.bicep @@ -0,0 +1,19 @@ +@description('Name of the resource that these alerts are being applied to.') +param resourceName 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 + +module alerts '../baseCpuPercentageAlert.bicep' = { + name: '${resourceName}CpuPercentageAlertModule' + params: { + resourceName: resourceName + resourceType: 'Microsoft.Web/serverfarms' + metricName: 'CpuPercentage' + alertsGroupName: alertsGroupName + tagValues: tagValues + } +} diff --git a/infrastructure/templates/public-api/components/alerts/appServicePlans/memoryPercentageAlert.bicep b/infrastructure/templates/public-api/components/alerts/appServicePlans/memoryPercentageAlert.bicep new file mode 100644 index 0000000000..090f8389f4 --- /dev/null +++ b/infrastructure/templates/public-api/components/alerts/appServicePlans/memoryPercentageAlert.bicep @@ -0,0 +1,19 @@ +@description('Names of the resources that these alerts are being applied to.') +param resourceName 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 + +module alerts '../baseMemoryPercentageAlert.bicep' = { + name: '${resourceName}MemoryPercentageAlertModule' + params: { + resourceName: resourceName + resourceType: 'Microsoft.Web/serverfarms' + metricName: 'MemoryPercentage' + alertsGroupName: alertsGroupName + tagValues: tagValues + } +} diff --git a/infrastructure/templates/public-api/components/alerts/baseCpuPercentageAlert.bicep b/infrastructure/templates/public-api/components/alerts/baseCpuPercentageAlert.bicep new file mode 100644 index 0000000000..27c45cf942 --- /dev/null +++ b/infrastructure/templates/public-api/components/alerts/baseCpuPercentageAlert.bicep @@ -0,0 +1,38 @@ +import { Severity } from 'types.bicep' + +@description('Name of the resource that these alerts are being applied to.') +param resourceName string + +@description('Names of the resources that these alerts are being applied to.') +param resourceType string + +@description('Names of the resources that these alerts are being applied to.') +param metricName string + +@description('The alert severity.') +param severity Severity = 'Warning' + +@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 + +module alerts 'dynamicMetricAlert.bicep' = { + name: '${resourceName}CpuPercentBaseAlertModule' + params: { + alertName: '${resourceName}-cpu-percentage' + resourceIds: [resourceId(resourceType, resourceName)] + resourceType: resourceType + query: { + metric: metricName + aggregation: 'Average' + operator: 'GreaterThan' + } + evaluationFrequency: 'PT5M' + windowSize: 'PT15M' + severity: severity + alertsGroupName: alertsGroupName + tagValues: tagValues + } +} diff --git a/infrastructure/templates/public-api/components/alerts/baseMemoryPercentageAlert.bicep b/infrastructure/templates/public-api/components/alerts/baseMemoryPercentageAlert.bicep new file mode 100644 index 0000000000..cfb412844f --- /dev/null +++ b/infrastructure/templates/public-api/components/alerts/baseMemoryPercentageAlert.bicep @@ -0,0 +1,38 @@ +import { Severity } from 'types.bicep' + +@description('Name of the resource that these alerts are being applied to.') +param resourceName string + +@description('Names of the resources that these alerts are being applied to.') +param resourceType string + +@description('Names of the resources that these alerts are being applied to.') +param metricName string + +@description('The alert severity.') +param severity Severity = 'Warning' + +@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 + +module alerts 'dynamicMetricAlert.bicep' = { + name: '${resourceName}MemoryPercentBaseAlertModule' + params: { + alertName: '${resourceName}-memory-percentage' + resourceIds: [resourceId(resourceType, resourceName)] + resourceType: resourceType + query: { + metric: metricName + aggregation: 'Average' + operator: 'GreaterThan' + } + evaluationFrequency: 'PT5M' + windowSize: 'PT15M' + severity: severity + alertsGroupName: alertsGroupName + tagValues: tagValues + } +} diff --git a/infrastructure/templates/public-api/components/alerts/baseResponseTimeAlert.bicep b/infrastructure/templates/public-api/components/alerts/baseResponseTimeAlert.bicep new file mode 100644 index 0000000000..11fbfbe2b7 --- /dev/null +++ b/infrastructure/templates/public-api/components/alerts/baseResponseTimeAlert.bicep @@ -0,0 +1,38 @@ +import { Severity } from 'types.bicep' + +@description('Name of the resource that these alerts are being applied to.') +param resourceName string + +@description('Names of the resources that these alerts are being applied to.') +param resourceType string + +@description('Names of the resources that these alerts are being applied to.') +param metricName string + +@description('The alert severity.') +param severity Severity = 'Warning' + +@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 + +module alerts 'dynamicMetricAlert.bicep' = { + name: '${resourceName}ResponseTimeBaseAlertModule' + params: { + alertName: '${resourceName}-response-time' + resourceIds: [resourceId(resourceType, resourceName)] + resourceType: resourceType + query: { + metric: metricName + aggregation: 'Average' + operator: 'GreaterThan' + } + evaluationFrequency: 'PT5M' + windowSize: 'PT15M' + severity: severity + alertsGroupName: alertsGroupName + tagValues: tagValues + } +} diff --git a/infrastructure/templates/public-api/components/alerts/containerApps/cpuPercentageAlert.bicep b/infrastructure/templates/public-api/components/alerts/containerApps/cpuPercentageAlert.bicep new file mode 100644 index 0000000000..68031359eb --- /dev/null +++ b/infrastructure/templates/public-api/components/alerts/containerApps/cpuPercentageAlert.bicep @@ -0,0 +1,19 @@ +@description('Name of the resource that these alerts are being applied to.') +param resourceName 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 + +module alerts '../baseCpuPercentageAlert.bicep' = { + name: '${resourceName}CpuPercentageAlertModule' + params: { + resourceName: resourceName + resourceType: 'Microsoft.App/containerApps' + metricName: 'CpuPercentage' + alertsGroupName: alertsGroupName + tagValues: tagValues + } +} diff --git a/infrastructure/templates/public-api/components/alerts/containerApps/memoryPercentageAlert.bicep b/infrastructure/templates/public-api/components/alerts/containerApps/memoryPercentageAlert.bicep new file mode 100644 index 0000000000..0c20eb1cb8 --- /dev/null +++ b/infrastructure/templates/public-api/components/alerts/containerApps/memoryPercentageAlert.bicep @@ -0,0 +1,19 @@ +@description('Name of the resources that these alerts are being applied to.') +param resourceName 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 + +module alerts '../baseMemoryPercentageAlert.bicep' = { + name: '${resourceName}MemoryPercentageAlertModule' + params: { + resourceName: resourceName + resourceType: 'Microsoft.App/containerApps' + metricName: 'MemoryPercentage' + alertsGroupName: alertsGroupName + tagValues: tagValues + } +} diff --git a/infrastructure/templates/public-api/components/alerts/containerApps/responseTimeAlert.bicep b/infrastructure/templates/public-api/components/alerts/containerApps/responseTimeAlert.bicep index 7957c351fd..979ee0759f 100644 --- a/infrastructure/templates/public-api/components/alerts/containerApps/responseTimeAlert.bicep +++ b/infrastructure/templates/public-api/components/alerts/containerApps/responseTimeAlert.bicep @@ -1,10 +1,5 @@ -import { Severity } from '../types.bicep' - -@description('Names of the resources that these alerts are being applied to.') -param resourceNames string[] - -@description('The alert severity.') -param severity Severity = 'Warning' +@description('Name of the resource that these alerts are being applied to.') +param resourceName string @description('Name of the Alerts Group used to send alert messages.') param alertsGroupName string @@ -12,21 +7,13 @@ param alertsGroupName string @description('Tags with which to tag the resource in Azure.') param tagValues object -module alerts '../dynamicMetricAlert.bicep' = [for name in resourceNames: { - name: '${name}LatencyAlertModule' +module alerts '../baseResponseTimeAlert.bicep' = { + name: '${resourceName}ResponseTimeAlertModule' params: { - alertName: '${name}-latency' - resourceIds: [resourceId('Microsoft.App/containerApps', name)] + resourceName: resourceName resourceType: 'Microsoft.App/containerApps' - query: { - metric: 'ResponseTime' - aggregation: 'Average' - operator: 'GreaterThan' - } - evaluationFrequency: 'PT1M' - windowSize: 'PT5M' - severity: severity + metricName: 'ResponseTime' alertsGroupName: alertsGroupName tagValues: tagValues } -}] +} diff --git a/infrastructure/templates/public-api/components/alerts/containerApps/restarts.bicep b/infrastructure/templates/public-api/components/alerts/containerApps/restartsAlert.bicep similarity index 66% rename from infrastructure/templates/public-api/components/alerts/containerApps/restarts.bicep rename to infrastructure/templates/public-api/components/alerts/containerApps/restartsAlert.bicep index fb79c183cf..d4346d6a1b 100644 --- a/infrastructure/templates/public-api/components/alerts/containerApps/restarts.bicep +++ b/infrastructure/templates/public-api/components/alerts/containerApps/restartsAlert.bicep @@ -1,7 +1,7 @@ import { Severity } from '../types.bicep' -@description('Names of the resources that these alerts are being applied to.') -param resourceNames string[] +@description('Name of the resource that these alerts are being applied to.') +param resourceName string @description('The alert severity.') param severity Severity = 'Warning' @@ -12,11 +12,11 @@ param alertsGroupName string @description('Tags with which to tag the resource in Azure.') param tagValues object -module alerts '../staticMetricAlert.bicep' = [for name in resourceNames: { - name: '${name}RestartsAlertModule' +module alerts '../staticMetricAlert.bicep' = { + name: '${resourceName}RestartsAlertModule' params: { - alertName: '${name}-restarts' - resourceIds: [resourceId('Microsoft.App/containerApps', name)] + alertName: '${resourceName}-restarts' + resourceIds: [resourceId('Microsoft.App/containerApps', resourceName)] resourceType: 'Microsoft.App/containerApps' query: { metric: 'RestartCount' @@ -30,4 +30,4 @@ module alerts '../staticMetricAlert.bicep' = [for name in resourceNames: { alertsGroupName: alertsGroupName tagValues: tagValues } -}] +} diff --git a/infrastructure/templates/public-api/components/alerts/fileServices/availabilityAlert.bicep b/infrastructure/templates/public-api/components/alerts/fileServices/availabilityAlert.bicep index a4f4e3c771..288ce5fd51 100644 --- a/infrastructure/templates/public-api/components/alerts/fileServices/availabilityAlert.bicep +++ b/infrastructure/templates/public-api/components/alerts/fileServices/availabilityAlert.bicep @@ -1,7 +1,7 @@ import { Severity } from '../types.bicep' -@description('Names of the resources that these alerts are being applied to.') -param resourceNames string[] +@description('Name of the resource that these alerts are being applied to.') +param resourceName string @description('The alert severity.') param severity Severity = 'Critical' @@ -12,11 +12,11 @@ param alertsGroupName string @description('Tags with which to tag the resource in Azure.') param tagValues object -module alerts '../staticMetricAlert.bicep' = [for name in resourceNames: { - name: '${name}FsAvailabilityAlertModule' +module alerts '../staticMetricAlert.bicep' = { + name: '${resourceName}FsAvailabilityAlertModule' params: { - alertName: '${name}-fileservice-availability' - resourceIds: [resourceId('Microsoft.Storage/storageAccounts/fileServices', name, 'default')] + alertName: '${resourceName}-fileservice-availability' + resourceIds: [resourceId('Microsoft.Storage/storageAccounts/fileServices', resourceName, 'default')] resourceType: 'Microsoft.Storage/storageAccounts/fileServices' query: { metric: 'availability' @@ -30,4 +30,4 @@ module alerts '../staticMetricAlert.bicep' = [for name in resourceNames: { alertsGroupName: alertsGroupName tagValues: tagValues } -}] +} diff --git a/infrastructure/templates/public-api/components/alerts/fileServices/latencyAlert.bicep b/infrastructure/templates/public-api/components/alerts/fileServices/latencyAlert.bicep index 160cb49974..8c7198ead3 100644 --- a/infrastructure/templates/public-api/components/alerts/fileServices/latencyAlert.bicep +++ b/infrastructure/templates/public-api/components/alerts/fileServices/latencyAlert.bicep @@ -1,7 +1,7 @@ import { Severity } from '../types.bicep' -@description('Names of the resources that these alerts are being applied to.') -param resourceNames string[] +@description('Name of the resource that these alerts are being applied to.') +param resourceName string @description('The alert severity.') param severity Severity = 'Warning' @@ -12,11 +12,11 @@ param alertsGroupName string @description('Tags with which to tag the resource in Azure.') param tagValues object -module alerts '../dynamicMetricAlert.bicep' = [for name in resourceNames: { - name: '${name}FsLatencyAlertModule' +module alerts '../dynamicMetricAlert.bicep' = { + name: '${resourceName}FsLatencyAlertModule' params: { - alertName: '${name}-fileservice-latency' - resourceIds: [resourceId('Microsoft.Storage/storageAccounts/fileServices', name, 'default')] + alertName: '${resourceName}-fileservice-latency' + resourceIds: [resourceId('Microsoft.Storage/storageAccounts/fileServices', resourceName, 'default')] resourceType: 'Microsoft.Storage/storageAccounts/fileServices' query: { metric: 'SuccessE2ELatency' @@ -29,4 +29,4 @@ module alerts '../dynamicMetricAlert.bicep' = [for name in resourceNames: { alertsGroupName: alertsGroupName tagValues: tagValues } -}] +} diff --git a/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/clientConnectionsWaitingAlert.bicep b/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/clientConnectionsWaitingAlert.bicep new file mode 100644 index 0000000000..55372c5cd2 --- /dev/null +++ b/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/clientConnectionsWaitingAlert.bicep @@ -0,0 +1,32 @@ +import { Severity } from '../types.bicep' + +@description('Name of the resource that these alerts are being applied to.') +param resourceName string + +@description('The alert severity.') +param severity Severity = 'Warning' + +@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 + +module alerts '../dynamicMetricAlert.bicep' = { + name: '${resourceName}ClientConnectionsWaitingAlertModule' + params: { + alertName: '${resourceName}-query-time' + resourceIds: [resourceId('Microsoft.DBforPostgreSQL/flexibleServers', resourceName)] + resourceType: 'Microsoft.DBforPostgreSQL/flexibleServers' + query: { + metric: 'client_connections_waiting' + aggregation: 'Maximum' + operator: 'GreaterThan' + } + evaluationFrequency: 'PT5M' + windowSize: 'PT15M' + severity: severity + alertsGroupName: alertsGroupName + tagValues: tagValues + } +} diff --git a/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/cpuPercentageAlert.bicep b/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/cpuPercentageAlert.bicep new file mode 100644 index 0000000000..735aea36ba --- /dev/null +++ b/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/cpuPercentageAlert.bicep @@ -0,0 +1,19 @@ +@description('Name of the resource that these alerts are being applied to.') +param resourceName 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 + +module alerts '../baseCpuPercentageAlert.bicep' = { + name: '${resourceName}CpuPercentageAlertModule' + params: { + resourceName: resourceName + resourceType: 'Microsoft.DBforPostgreSQL/flexibleServers' + metricName: 'cpu_percent' + alertsGroupName: alertsGroupName + tagValues: tagValues + } +} diff --git a/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/databaseAlive.bicep b/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/databaseAlive.bicep index 21358742e0..5070d495e2 100644 --- a/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/databaseAlive.bicep +++ b/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/databaseAlive.bicep @@ -1,7 +1,7 @@ import { Severity } from '../types.bicep' -@description('Names of the resources that these alerts are being applied to.') -param resourceNames string[] +@description('Name of the resource that these alerts are being applied to.') +param resourceName string @description('The alert severity.') param severity Severity = 'Critical' @@ -12,11 +12,11 @@ param alertsGroupName string @description('Tags with which to tag the resource in Azure.') param tagValues object -module alerts '../staticMetricAlert.bicep' = [for name in resourceNames: { - name: '${name}DbAliveAlertModule' +module alerts '../staticMetricAlert.bicep' = { + name: '${resourceName}DbAliveAlertModule' params: { - alertName: '${name}-database-alive' - resourceIds: [resourceId('Microsoft.DBforPostgreSQL/flexibleServers', name)] + alertName: '${resourceName}-database-alive' + resourceIds: [resourceId('Microsoft.DBforPostgreSQL/flexibleServers', resourceName)] resourceType: 'Microsoft.DBforPostgreSQL/flexibleServers' query: { metric: 'is_db_alive' @@ -30,4 +30,4 @@ module alerts '../staticMetricAlert.bicep' = [for name in resourceNames: { alertsGroupName: alertsGroupName tagValues: tagValues } -}] +} diff --git a/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/diskBandwidthAlert.bicep b/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/diskBandwidthAlert.bicep new file mode 100644 index 0000000000..20505ba4d0 --- /dev/null +++ b/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/diskBandwidthAlert.bicep @@ -0,0 +1,32 @@ +import { Severity } from '../types.bicep' + +@description('Name of the resource that these alerts are being applied to.') +param resourceName string + +@description('The alert severity.') +param severity Severity = 'Warning' + +@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 + +module alerts '../dynamicMetricAlert.bicep' = { + name: '${resourceName}DiskBandwidthAlertModule' + params: { + alertName: '${resourceName}-disk-bandwidth' + resourceIds: [resourceId('Microsoft.DBforPostgreSQL/flexibleServers', resourceName)] + resourceType: 'Microsoft.DBforPostgreSQL/flexibleServers' + query: { + metric: 'disk_bandwidth_consumed_percentage' + aggregation: 'Average' + operator: 'GreaterThan' + } + evaluationFrequency: 'PT5M' + windowSize: 'PT15M' + severity: severity + alertsGroupName: alertsGroupName + tagValues: tagValues + } +} diff --git a/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/diskIopsAlert.bicep b/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/diskIopsAlert.bicep new file mode 100644 index 0000000000..33ec25dec6 --- /dev/null +++ b/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/diskIopsAlert.bicep @@ -0,0 +1,32 @@ +import { Severity } from '../types.bicep' + +@description('Name of the resource that these alerts are being applied to.') +param resourceName string + +@description('The alert severity.') +param severity Severity = 'Warning' + +@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 + +module alerts '../dynamicMetricAlert.bicep' = { + name: '${resourceName}DiskIopsAlertModule' + params: { + alertName: '${resourceName}-disk-bandwidth' + resourceIds: [resourceId('Microsoft.DBforPostgreSQL/flexibleServers', resourceName)] + resourceType: 'Microsoft.DBforPostgreSQL/flexibleServers' + query: { + metric: 'disk_iops_consumed_percentage' + aggregation: 'Average' + operator: 'GreaterThan' + } + evaluationFrequency: 'PT5M' + windowSize: 'PT15M' + severity: severity + alertsGroupName: alertsGroupName + tagValues: tagValues + } +} diff --git a/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/memoryPercentageAlert.bicep b/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/memoryPercentageAlert.bicep new file mode 100644 index 0000000000..f515794ea6 --- /dev/null +++ b/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/memoryPercentageAlert.bicep @@ -0,0 +1,19 @@ +@description('Name of the resource that these alerts are being applied to.') +param resourceName 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 + +module alerts '../baseMemoryPercentageAlert.bicep' = { + name: '${resourceName}MemoryPercentageAlertModule' + params: { + resourceName: resourceName + resourceType: 'Microsoft.DBforPostgreSQL/flexibleServers' + metricName: 'memory_percent' + alertsGroupName: alertsGroupName + tagValues: tagValues + } +} diff --git a/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/queryTimeAlert.bicep b/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/queryTimeAlert.bicep index c9e51a2e8c..08cfc6f5d1 100644 --- a/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/queryTimeAlert.bicep +++ b/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/queryTimeAlert.bicep @@ -1,7 +1,7 @@ import { Severity } from '../types.bicep' -@description('Names of the resources that these alerts are being applied to.') -param resourceNames string[] +@description('Name of the resource that these alerts are being applied to.') +param resourceName string @description('The alert severity.') param severity Severity = 'Warning' @@ -12,11 +12,11 @@ param alertsGroupName string @description('Tags with which to tag the resource in Azure.') param tagValues object -module alerts '../dynamicMetricAlert.bicep' = [for name in resourceNames: { - name: '${name}QueryTimeAlertModule' +module alerts '../dynamicMetricAlert.bicep' = { + name: '${resourceName}QueryTimeAlertModule' params: { - alertName: '${name}-query-time' - resourceIds: [resourceId('Microsoft.DBforPostgreSQL/flexibleServers', name)] + alertName: '${resourceName}-query-time' + resourceIds: [resourceId('Microsoft.DBforPostgreSQL/flexibleServers', resourceName)] resourceType: 'Microsoft.DBforPostgreSQL/flexibleServers' query: { metric: 'longest_query_time_sec' @@ -29,4 +29,4 @@ module alerts '../dynamicMetricAlert.bicep' = [for name in resourceNames: { alertsGroupName: alertsGroupName tagValues: tagValues } -}] +} diff --git a/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/transactionTimeAlert.bicep b/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/transactionTimeAlert.bicep index 487313a7ee..46cd9de14f 100644 --- a/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/transactionTimeAlert.bicep +++ b/infrastructure/templates/public-api/components/alerts/postgreSqlFlexibleServers/transactionTimeAlert.bicep @@ -1,7 +1,7 @@ import { Severity } from '../types.bicep' -@description('Names of the resources that these alerts are being applied to.') -param resourceNames string[] +@description('Name of the resource that these alerts are being applied to.') +param resourceName string @description('The alert severity.') param severity Severity = 'Warning' @@ -12,11 +12,11 @@ param alertsGroupName string @description('Tags with which to tag the resource in Azure.') param tagValues object -module alerts '../dynamicMetricAlert.bicep' = [for name in resourceNames: { - name: '${name}TransactionTimeAlertModule' +module alerts '../dynamicMetricAlert.bicep' = { + name: '${resourceName}TransactionTimeAlertModule' params: { - alertName: '${name}-query-time' - resourceIds: [resourceId('Microsoft.DBforPostgreSQL/flexibleServers', name)] + alertName: '${resourceName}-query-time' + resourceIds: [resourceId('Microsoft.DBforPostgreSQL/flexibleServers', resourceName)] resourceType: 'Microsoft.DBforPostgreSQL/flexibleServers' query: { metric: 'longest_transaction_time_sec' @@ -29,4 +29,4 @@ module alerts '../dynamicMetricAlert.bicep' = [for name in resourceNames: { alertsGroupName: alertsGroupName tagValues: tagValues } -}] +} diff --git a/infrastructure/templates/public-api/components/alerts/sites/healthAlert.bicep b/infrastructure/templates/public-api/components/alerts/sites/healthAlert.bicep index f7af74839d..6a4ba3ccdb 100644 --- a/infrastructure/templates/public-api/components/alerts/sites/healthAlert.bicep +++ b/infrastructure/templates/public-api/components/alerts/sites/healthAlert.bicep @@ -1,7 +1,7 @@ import { EvaluationFrequency, WindowSize, Severity } from '../types.bicep' -@description('Names of the resources that these alerts are being applied to.') -param resourceNames string[] +@description('Name of the resource that these alerts are being applied to.') +param resourceName string @description('Type of the resource that this alert is being applied to.') param resourceType @@ -23,12 +23,12 @@ param severity Severity = 'Critical' @description('Tags with which to tag the resource in Azure.') param tagValues object -module metricAlertModule '../staticMetricAlert.bicep' = [for name in resourceNames: { - name: '${replace(name, '/', '-')}HealthAlertModule' +module metricAlertModule '../staticMetricAlert.bicep' = { + name: '${replace(resourceName, '/', '-')}HealthAlertModule' params: { - alertName: '${replace(name, '/', '-')}-health' + alertName: '${replace(resourceName, '/', '-')}-health' alertsGroupName: alertsGroupName - resourceIds: [resourceId(resourceType, name)] + resourceIds: [resourceId(resourceType, resourceName)] resourceType: resourceType query: { metric: 'HealthCheckStatus' @@ -41,4 +41,4 @@ module metricAlertModule '../staticMetricAlert.bicep' = [for name in resourceNam severity: severity tagValues: tagValues } -}] +} diff --git a/infrastructure/templates/public-api/components/alerts/storageAccounts/availabilityAlert.bicep b/infrastructure/templates/public-api/components/alerts/storageAccounts/availabilityAlert.bicep index d71ce969f8..af13ea2faa 100644 --- a/infrastructure/templates/public-api/components/alerts/storageAccounts/availabilityAlert.bicep +++ b/infrastructure/templates/public-api/components/alerts/storageAccounts/availabilityAlert.bicep @@ -1,7 +1,7 @@ import { Severity } from '../types.bicep' -@description('Names of the resources that these alerts are being applied to.') -param resourceNames string[] +@description('Name of the resource that these alerts are being applied to.') +param resourceName string @description('The alert severity.') param severity Severity = 'Critical' @@ -12,11 +12,11 @@ param alertsGroupName string @description('Tags with which to tag the resource in Azure.') param tagValues object -module alerts '../staticMetricAlert.bicep' = [for name in resourceNames: { - name: '${name}AvailabilityAlertModule' +module alerts '../staticMetricAlert.bicep' = { + name: '${resourceName}AvailabilityAlertModule' params: { - alertName: '${name}-availability' - resourceIds: [resourceId('Microsoft.Storage/storageAccounts', name)] + alertName: '${resourceName}-availability' + resourceIds: [resourceId('Microsoft.Storage/storageAccounts', resourceName)] resourceType: 'Microsoft.Storage/storageAccounts' query: { metric: 'availability' @@ -30,4 +30,4 @@ module alerts '../staticMetricAlert.bicep' = [for name in resourceNames: { alertsGroupName: alertsGroupName tagValues: tagValues } -}] +} diff --git a/infrastructure/templates/public-api/components/alerts/storageAccounts/latencyAlert.bicep b/infrastructure/templates/public-api/components/alerts/storageAccounts/latencyAlert.bicep index 164c717cff..583a5854fa 100644 --- a/infrastructure/templates/public-api/components/alerts/storageAccounts/latencyAlert.bicep +++ b/infrastructure/templates/public-api/components/alerts/storageAccounts/latencyAlert.bicep @@ -1,10 +1,5 @@ -import { Severity } from '../types.bicep' - -@description('Names of the resources that these alerts are being applied to.') -param resourceNames string[] - -@description('The alert severity.') -param severity Severity = 'Warning' +@description('Name of the resource that these alerts are being applied to.') +param resourceName string @description('Name of the Alerts Group used to send alert messages.') param alertsGroupName string @@ -12,21 +7,13 @@ param alertsGroupName string @description('Tags with which to tag the resource in Azure.') param tagValues object -module alerts '../dynamicMetricAlert.bicep' = [for name in resourceNames: { - name: '${name}LatencyAlertModule' +module alerts '../baseResponseTimeAlert.bicep' = { + name: '${resourceName}LatencyAlertModule' params: { - alertName: '${name}-latency' - resourceIds: [resourceId('Microsoft.Storage/storageAccounts', name)] + resourceName: resourceName resourceType: 'Microsoft.Storage/storageAccounts' - query: { - metric: 'SuccessE2ELatency' - aggregation: 'Average' - operator: 'GreaterThan' - } - evaluationFrequency: 'PT1M' - windowSize: 'PT5M' - severity: severity + metricName: 'SuccessE2ELatency' alertsGroupName: alertsGroupName tagValues: tagValues } -}] +} diff --git a/infrastructure/templates/public-api/components/alerts/types.bicep b/infrastructure/templates/public-api/components/alerts/types.bicep index b262448386..9d3c2ce587 100644 --- a/infrastructure/templates/public-api/components/alerts/types.bicep +++ b/infrastructure/templates/public-api/components/alerts/types.bicep @@ -1,8 +1,17 @@ @export() -type EvaluationFrequency = 'PT1M' +type EvaluationFrequency = + | 'PT1M' + | 'PT5M' + | 'PT15M' + | 'PT30M' + | 'PT1H' @export() -type WindowSize = 'PT5M' +type WindowSize = + | 'PT5M' + | 'PT15M' + | 'PT30M' + | 'PT1H' @export() type DynamicMetricOperator = @@ -10,7 +19,6 @@ type DynamicMetricOperator = | 'GreaterThan' | 'LessThan' - @export() type StaticMetricOperator = | 'Equals' @@ -58,6 +66,7 @@ type ResourceType = | 'Microsoft.Sql/servers/databases' | 'Microsoft.Storage/storageAccounts' | 'Microsoft.Storage/storageAccounts/fileServices' + | 'Microsoft.Web/serverfarms' | 'Microsoft.Web/sites' | 'Microsoft.Web/sites/slots' @@ -66,13 +75,20 @@ type MetricName = | 'ApplicationGatewayTotalTime' | 'availability' | 'blocked_by_firewall' + | 'client_connections_waiting' | 'connection_failed' | 'connections_failed' | 'cpu_percent' + | 'CpuPercentage' + | 'CpuUtilization' + | 'disk_bandwidth_consumed_percentage' + | 'disk_iops_consumed_percentage' | 'HealthCheckStatus' | 'is_db_alive' | 'longest_query_time_sec' | 'longest_transaction_time_sec' + | 'memory_percent' + | 'MemoryPercentage' | 'ResponseTime' | 'RestartCount' | 'SuccessE2ELatency' diff --git a/infrastructure/templates/public-api/components/appGateway.bicep b/infrastructure/templates/public-api/components/appGateway.bicep index 31a9742a4a..abb106a9cd 100644 --- a/infrastructure/templates/public-api/components/appGateway.bicep +++ b/infrastructure/templates/public-api/components/appGateway.bicep @@ -283,10 +283,10 @@ resource appGateway 'Microsoft.Network/applicationGateways@2024-01-01' = { ] } -module backendPoolsHealthAlert 'alerts/appGateways/backendPoolHealth.bicep' = if (alerts != null && alerts!.health) { +module backendPoolsHealthAlert 'alerts/appGateways/backendPoolHealthAlert.bicep' = if (alerts != null && alerts!.health) { name: '${appGatewayName}BackendPoolsHealthDeploy' params: { - resourceNames: [appGatewayName] + resourceName: appGatewayName alertsGroupName: alerts!.alertsGroupName tagValues: tagValues } @@ -295,7 +295,7 @@ module backendPoolsHealthAlert 'alerts/appGateways/backendPoolHealth.bicep' = if module responseTimeAlert 'alerts/appGateways/responseTimeAlert.bicep' = if (alerts != null && alerts!.responseTime) { name: '${appGatewayName}ResponseTimeDeploy' params: { - resourceNames: [appGatewayName] + resourceName: appGatewayName alertsGroupName: alerts!.alertsGroupName tagValues: tagValues } diff --git a/infrastructure/templates/public-api/components/appServicePlan.bicep b/infrastructure/templates/public-api/components/appServicePlan.bicep new file mode 100644 index 0000000000..09d2c272a1 --- /dev/null +++ b/infrastructure/templates/public-api/components/appServicePlan.bicep @@ -0,0 +1,57 @@ +@description('Specifies the App Service plan name') +param planName string + +@description('Specifies the location for all resources.') +param location string + +@description('The SKU for the plan') +param sku object + +@description('The kind of plan to deploy. Impacted by application type and desired OS. See https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference.') +param kind + | 'app' + | 'functionapp' + +@description('Function App Plan : operating system') +param operatingSystem 'Windows' | 'Linux' = 'Linux' + +@description('Whether to create or update Azure Monitor alerts during this deploy') +param alerts { + cpuPercentage: bool + memoryPercentage: bool + alertsGroupName: string +}? + +@description('A set of tags with which to tag the resource in Azure') +param tagValues object + +resource appServicePlan 'Microsoft.Web/serverfarms@2023-12-01' = { + name: planName + location: location + kind: kind + sku: sku + properties: { + reserved: operatingSystem == 'Linux' + } + tags: tagValues +} + +module cpuPercentageAlert 'alerts/appServicePlans/cpuPercentageAlert.bicep' = if (alerts != null && alerts!.cpuPercentage) { + name: '${planName}CpuPercentageDeploy' + params: { + resourceName: planName + alertsGroupName: alerts!.alertsGroupName + tagValues: tagValues + } +} + +module memoryPercentageAlert 'alerts/appServicePlans/memoryPercentageAlert.bicep' = if (alerts != null && alerts!.memoryPercentage) { + name: '${planName}MemoryPercentageDeploy' + params: { + resourceName: planName + alertsGroupName: alerts!.alertsGroupName + tagValues: tagValues + } +} + +output planId string = appServicePlan.id diff --git a/infrastructure/templates/public-api/components/containerApp.bicep b/infrastructure/templates/public-api/components/containerApp.bicep index 43539600d2..0d25e18f44 100644 --- a/infrastructure/templates/public-api/components/containerApp.bicep +++ b/infrastructure/templates/public-api/components/containerApp.bicep @@ -106,6 +106,8 @@ param entraIdAuthentication EntraIdAuthentication? param alerts { restarts: bool responseTime: bool + cpuPercentage: bool + memoryPercentage: bool alertsGroupName: string }? @@ -211,10 +213,10 @@ module privateDns 'containerAppPrivateDns.bicep' = if (deployPrivateDns) { } } -module containerAppRestartsAlert 'alerts/containerApps/restarts.bicep' = if (alerts != null && alerts!.restarts) { +module containerAppRestartsAlert 'alerts/containerApps/restartsAlert.bicep' = if (alerts != null && alerts!.restarts) { name: '${containerAppName}RestartsDeploy' params: { - resourceNames: [containerAppName] + resourceName: containerAppName alertsGroupName: alerts!.alertsGroupName tagValues: tagValues } @@ -223,7 +225,25 @@ module containerAppRestartsAlert 'alerts/containerApps/restarts.bicep' = if (ale module responseTimeAlert 'alerts/containerApps/responseTimeAlert.bicep' = if (alerts != null && alerts!.responseTime) { name: '${containerAppName}ResponseTimeDeploy' params: { - resourceNames: [containerAppName] + resourceName: containerAppName + alertsGroupName: alerts!.alertsGroupName + tagValues: tagValues + } +} + +module cpuPercentageAlert 'alerts/containerApps/cpuPercentageAlert.bicep' = if (alerts != null && alerts!.cpuPercentage) { + name: '${containerAppName}CpuPercentageDeploy' + params: { + resourceName: containerAppName + alertsGroupName: alerts!.alertsGroupName + tagValues: tagValues + } +} + +module memoryPercentageAlert 'alerts/containerApps/memoryPercentageAlert.bicep' = if (alerts != null && alerts!.memoryPercentage) { + name: '${containerAppName}MemoryPercentageDeploy' + params: { + resourceName: containerAppName alertsGroupName: alerts!.alertsGroupName tagValues: tagValues } diff --git a/infrastructure/templates/public-api/components/fileShare.bicep b/infrastructure/templates/public-api/components/fileShare.bicep index 9011c2a5e9..058591ea25 100644 --- a/infrastructure/templates/public-api/components/fileShare.bicep +++ b/infrastructure/templates/public-api/components/fileShare.bicep @@ -43,7 +43,7 @@ resource fileShare 'Microsoft.Storage/storageAccounts/fileServices/shares@2023-0 module availabilityAlerts 'alerts/fileServices/availabilityAlert.bicep' = if (alerts != null && alerts!.availability) { name: '${storageAccountName}FsAvailabilityDeploy' params: { - resourceNames: [storageAccountName] + resourceName: storageAccountName alertsGroupName: alerts!.alertsGroupName tagValues: tagValues } @@ -52,7 +52,7 @@ module availabilityAlerts 'alerts/fileServices/availabilityAlert.bicep' = if (al module latencyAlert 'alerts/fileServices/latencyAlert.bicep' = if (alerts != null && alerts!.latency) { name: '${storageAccountName}FsLatencyDeploy' params: { - resourceNames: [storageAccountName] + resourceName: storageAccountName alertsGroupName: alerts!.alertsGroupName tagValues: tagValues } diff --git a/infrastructure/templates/public-api/components/functionApp.bicep b/infrastructure/templates/public-api/components/functionApp.bicep index ca20c4827b..aa9f46d96e 100644 --- a/infrastructure/templates/public-api/components/functionApp.bicep +++ b/infrastructure/templates/public-api/components/functionApp.bicep @@ -13,7 +13,7 @@ param appServicePlanName string param storageAccountsNamePrefix string @description('Function App Plan : operating system') -param appServicePlanOS 'Windows' | 'Linux' = 'Linux' +param operatingSystem 'Windows' | 'Linux' = 'Linux' @description('Function App runtime') param functionAppRuntime 'dotnet' | 'dotnet-isolated' | 'node' | 'python' | 'java' = 'dotnet' @@ -21,9 +21,6 @@ param functionAppRuntime 'dotnet' | 'dotnet-isolated' | 'node' | 'python' | 'jav @description('Specifies the additional setting to add to the Function App') param appSettings object = {} -@description('A set of tags with which to tag the resource in Azure') -param tagValues object - @description('The Application Insights key that is associated with this resource') param applicationInsightsKey string @@ -76,6 +73,8 @@ param storageFirewallRules IpRange[] = [] @description('Whether to create or update Azure Monitor alerts during this deploy') param alerts { functionAppHealth: bool + cpuPercentage: bool + memoryPercentage: bool storageAccountAvailability: bool storageLatency: bool fileServiceAvailability: bool @@ -83,7 +82,8 @@ param alerts { alertsGroupName: string }? -var reserved = appServicePlanOS == 'Linux' +@description('A set of tags with which to tag the resource in Azure') +param tagValues object var identity = userAssignedManagedIdentityParams != null ? { @@ -96,13 +96,20 @@ var identity = userAssignedManagedIdentityParams != null type: 'SystemAssigned' } -resource appServicePlan 'Microsoft.Web/serverfarms@2023-12-01' = { +module appServicePlanModule 'appServicePlan.bicep' = { name: appServicePlanName - location: location - kind: 'functionapp' - sku: sku - properties: { - reserved: reserved + params: { + planName: appServicePlanName + location: location + kind: 'functionapp' + sku: sku + operatingSystem: operatingSystem + alerts: alerts != null ? { + cpuPercentage: alerts!.cpuPercentage + memoryPercentage: alerts!.memoryPercentage + alertsGroupName: alerts!.alertsGroupName + } : null + tagValues: tagValues } } @@ -223,19 +230,19 @@ var firewallRules = [for (firewallRule, index) in functionAppFirewallRules: { var commonSiteProperties = { enabled: true httpsOnly: true - serverFarmId: appServicePlan.id + serverFarmId: appServicePlanModule.outputs.planId // This property integrates the Function App into a VNet given the supplied subnet id. virtualNetworkSubnetId: subnetId clientAffinityEnabled: true - reserved: reserved + reserved: operatingSystem == 'Linux' siteConfig: { alwaysOn: alwaysOn ?? null healthCheckPath: healthCheckPath preWarmedInstanceCount: preWarmedInstanceCount ?? null netFrameworkVersion: '8.0' - linuxFxVersion: appServicePlanOS == 'Linux' ? 'DOTNET-ISOLATED|8.0' : null + linuxFxVersion: operatingSystem == 'Linux' ? 'DOTNET-ISOLATED|8.0' : null keyVaultReferenceIdentity: keyVaultReferenceIdentity publicNetworkAccess: publicNetworkAccessEnabled ? 'Enabled' : 'Disabled' ipSecurityRestrictions: publicNetworkAccessEnabled && length(firewallRules) > 0 ? firewallRules : null @@ -427,7 +434,7 @@ module privateEndpointModule 'privateEndpoint.bicep' = if (privateEndpointSubnet module healthAlert 'alerts/sites/healthAlert.bicep' = if (alerts != null && alerts!.functionAppHealth) { name: '${functionAppName}HealthDeploy' params: { - resourceNames: [functionAppName] + resourceName: functionAppName alertsGroupName: alerts!.alertsGroupName tagValues: tagValues } diff --git a/infrastructure/templates/public-api/components/postgresqlDatabase.bicep b/infrastructure/templates/public-api/components/postgresqlDatabase.bicep index b02b328b58..a966d13ca9 100644 --- a/infrastructure/templates/public-api/components/postgresqlDatabase.bicep +++ b/infrastructure/templates/public-api/components/postgresqlDatabase.bicep @@ -50,6 +50,11 @@ param alerts { availability: bool queryTime: bool transactionTime: bool + clientConenctionsWaiting: bool + cpuPercentage: bool + diskBandwidth: bool + diskIops: bool + memoryPercentage: bool alertGroupName: string }? @@ -147,7 +152,7 @@ resource adminRoleAssignments 'Microsoft.DBforPostgreSQL/flexibleServers/adminis module databaseAliveAlert 'alerts/postgreSqlFlexibleServers/databaseAlive.bicep' = if (alerts != null && alerts!.availability) { name: '${databaseServerName}DbAliveDeploy' params: { - resourceNames: [databaseServerName] + resourceName: databaseServerName alertsGroupName: alerts!.alertGroupName tagValues: tagValues } @@ -156,7 +161,7 @@ module databaseAliveAlert 'alerts/postgreSqlFlexibleServers/databaseAlive.bicep' module queryTimeAlert 'alerts/postgreSqlFlexibleServers/queryTimeAlert.bicep' = if (alerts != null && alerts!.queryTime) { name: '${databaseServerName}QueryTimeDeploy' params: { - resourceNames: [databaseServerName] + resourceName: databaseServerName alertsGroupName: alerts!.alertGroupName tagValues: tagValues } @@ -165,7 +170,52 @@ module queryTimeAlert 'alerts/postgreSqlFlexibleServers/queryTimeAlert.bicep' = module transactionTimeAlert 'alerts/postgreSqlFlexibleServers/transactionTimeAlert.bicep' = if (alerts != null && alerts!.transactionTime) { name: '${databaseServerName}TransactionTimeDeploy' params: { - resourceNames: [databaseServerName] + resourceName: databaseServerName + alertsGroupName: alerts!.alertGroupName + tagValues: tagValues + } +} + +module clientConenctionsWaitingAlert 'alerts/postgreSqlFlexibleServers/clientConnectionsWaitingAlert.bicep' = if (alerts != null && alerts!.clientConenctionsWaiting) { + name: '${databaseServerName}ClientConnectionsDeploy' + params: { + resourceName: databaseServerName + alertsGroupName: alerts!.alertGroupName + tagValues: tagValues + } +} + +module cpuPercentageAlert 'alerts/postgreSqlFlexibleServers/cpuPercentageAlert.bicep' = if (alerts != null && alerts!.cpuPercentage) { + name: '${databaseServerName}CpuPercentageDeploy' + params: { + resourceName: databaseServerName + alertsGroupName: alerts!.alertGroupName + tagValues: tagValues + } +} + +module diskBandwidthAlert 'alerts/postgreSqlFlexibleServers/diskBandwidthAlert.bicep' = if (alerts != null && alerts!.diskBandwidth) { + name: '${databaseServerName}DiskBandwidthDeploy' + params: { + resourceName: databaseServerName + alertsGroupName: alerts!.alertGroupName + tagValues: tagValues + } +} + +module diskIopsAlert 'alerts/postgreSqlFlexibleServers/diskIopsAlert.bicep' = if (alerts != null && alerts!.diskIops) { + name: '${databaseServerName}DiskIopsDeploy' + params: { + resourceName: databaseServerName + alertsGroupName: alerts!.alertGroupName + tagValues: tagValues + } +} + +module memoryPercentageAlert 'alerts/postgreSqlFlexibleServers/memoryPercentageAlert.bicep' = if (alerts != null && alerts!.memoryPercentage) { + name: '${databaseServerName}MemoryPercentageDeploy' + params: { + resourceName: databaseServerName alertsGroupName: alerts!.alertGroupName tagValues: tagValues } diff --git a/infrastructure/templates/public-api/components/storageAccount.bicep b/infrastructure/templates/public-api/components/storageAccount.bicep index d938bc37ba..6e0a106e68 100644 --- a/infrastructure/templates/public-api/components/storageAccount.bicep +++ b/infrastructure/templates/public-api/components/storageAccount.bicep @@ -60,7 +60,7 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = { module availabilityAlerts 'alerts/storageAccounts/availabilityAlert.bicep' = if (alerts != null && alerts!.availability) { name: '${storageAccountName}StorageAvailabilityDeploy' params: { - resourceNames: [storageAccountName] + resourceName: storageAccountName alertsGroupName: alerts!.alertsGroupName tagValues: tagValues } @@ -69,7 +69,7 @@ module availabilityAlerts 'alerts/storageAccounts/availabilityAlert.bicep' = if module latencyAlert 'alerts/storageAccounts/latencyAlert.bicep' = if (alerts != null && alerts!.latency) { name: '${storageAccountName}LatencyDeploy' params: { - resourceNames: [storageAccountName] + resourceName: storageAccountName alertsGroupName: alerts!.alertsGroupName tagValues: tagValues }