Skip to content

Commit

Permalink
Add cluster id scope to rule groups for alerts to be linked to UX
Browse files Browse the repository at this point in the history
  • Loading branch information
Sohamdg081992 committed Sep 20, 2023
1 parent ad196bd commit 41ccd8e
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 32 deletions.
12 changes: 8 additions & 4 deletions AddonArmTemplate/FullAzureMonitorMetricsProfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@
"properties": {
"description": "[concat(variables('nodeRecordingRuleGroupDescription'), variables('version'))]",
"scopes": [
"[parameters('azureMonitorWorkspaceResourceId')]"
"[parameters('azureMonitorWorkspaceResourceId')]",
"[parameters('clusterResourceId')]"
],
"clusterName": "[variables('clusterName')]",
"interval": "PT1M",
Expand Down Expand Up @@ -281,7 +282,8 @@
"properties": {
"description": "[concat(variables('kubernetesRecordingRuleGroupDescription'), variables('version'))]",
"scopes": [
"[parameters('azureMonitorWorkspaceResourceId')]"
"[parameters('azureMonitorWorkspaceResourceId')]",
"[parameters('clusterResourceId')]"
],
"clusterName": "[variables('clusterName')]",
"interval": "PT1M",
Expand Down Expand Up @@ -385,7 +387,8 @@
"properties": {
"description": "[concat(variables('RecordingRuleGroupDescriptionWin'), variables('version'))]",
"scopes": [
"[parameters('azureMonitorWorkspaceResourceId')]"
"[parameters('azureMonitorWorkspaceResourceId')]",
"[parameters('clusterResourceId')]"
],
"enabled": "[parameters('enableWindowsRecordingRules')]",
"clusterName": "[variables('clusterName')]",
Expand Down Expand Up @@ -462,7 +465,8 @@
"properties": {
"description": "[concat(variables('RecordingRuleGroupDescriptionWin'), variables('version'))]",
"scopes": [
"[parameters('azureMonitorWorkspaceResourceId')]"
"[parameters('azureMonitorWorkspaceResourceId')]",
"[parameters('clusterResourceId')]"
],
"enabled": "[parameters('enableWindowsRecordingRules')]",
"clusterName": "[variables('clusterName')]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"properties": {
"description": "[concat(variables('RecordingRuleGroupDescriptionWin'), variables('version'))]",
"scopes": [
"[parameters('azureMonitorWorkspaceResourceId')]"
"[parameters('azureMonitorWorkspaceResourceId')]",
"[parameters('clusterResourceId')]"
],
"enabled": true,
"clusterName": "[variables('clusterName')]",
Expand Down Expand Up @@ -133,7 +134,8 @@
"properties": {
"description": "[concat(variables('RecordingRuleGroupDescriptionWin'), variables('version'))]",
"scopes": [
"[parameters('azureMonitorWorkspaceResourceId')]"
"[parameters('azureMonitorWorkspaceResourceId')]",
"[parameters('clusterResourceId')]"
],
"enabled": true,
"clusterName": "[variables('clusterName')]",
Expand Down Expand Up @@ -211,4 +213,4 @@
}
}
]
}
}
8 changes: 2 additions & 6 deletions AddonBicepTemplate/AzureMonitorAlertsProfile.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ resource recommendedAlerts 'Microsoft.AlertsManagement/prometheusRuleGroups@2023
location: location
properties: {
description: 'Kubernetes Alert RuleGroup-RecommendedCIAlerts - 0.1'
scopes: [
monitorWorkspace.id
]
scopes: [monitorWorkspace.id,aksResourceId]
clusterName: split(aksResourceId, '/')[8]
enabled: true
interval: 'PT5M'
Expand Down Expand Up @@ -241,9 +239,7 @@ resource communityALerts 'Microsoft.AlertsManagement/prometheusRuleGroups@2023-0
location: location
properties: {
description: 'Kubernetes Alert RuleGroup-communityCIAlerts - 0.1'
scopes: [
monitorWorkspace.id
]
scopes: [monitorWorkspace.id,aksResourceId]
clusterName: split(aksResourceId, '/')[8]
enabled: true
interval: 'PT1M'
Expand Down
16 changes: 4 additions & 12 deletions AddonBicepTemplate/FullAzureMonitorMetricsProfile.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ resource nodeRecordingRuleGroup 'Microsoft.AlertsManagement/prometheusRuleGroups
location: azureMonitorWorkspaceLocation
properties: {
description: '${nodeRecordingRuleGroupDescription}${version}'
scopes: [
azureMonitorWorkspaceResourceId
]
scopes: [azureMonitorWorkspaceResourceId,clusterResourceId]
enabled: true
clusterName: clusterName
interval: 'PT1M'
Expand Down Expand Up @@ -201,9 +199,7 @@ resource kubernetesRecordingRuleGroup 'Microsoft.AlertsManagement/prometheusRule
location: azureMonitorWorkspaceLocation
properties: {
description: '${kubernetesRecordingRuleGroupDescription}${version}'
scopes: [
azureMonitorWorkspaceResourceId
]
scopes: [azureMonitorWorkspaceResourceId,clusterResourceId]
enabled: true
clusterName: clusterName
interval: 'PT1M'
Expand Down Expand Up @@ -305,9 +301,7 @@ resource nodeRecordingRuleGroupNameWin 'Microsoft.AlertsManagement/prometheusRul
location: azureMonitorWorkspaceLocation
properties: {
description: '${RecordingRuleGroupDescriptionWin}${version}'
scopes: [
azureMonitorWorkspaceResourceId
]
scopes: [azureMonitorWorkspaceResourceId,clusterResourceId]
enabled: enableWindowsRecordingRules
clusterName: clusterName
interval: 'PT1M'
Expand Down Expand Up @@ -381,9 +375,7 @@ resource nodeAndKubernetesRecordingRuleGroupNameWin 'Microsoft.AlertsManagement/
location: azureMonitorWorkspaceLocation
properties: {
description: '${RecordingRuleGroupDescriptionWin}${version}'
scopes: [
azureMonitorWorkspaceResourceId
]
scopes: [azureMonitorWorkspaceResourceId,clusterResourceId]
enabled: enableWindowsRecordingRules
clusterName: clusterName
interval: 'PT1M'
Expand Down
16 changes: 12 additions & 4 deletions AddonPolicyTemplate/AddonPolicyMetricsProfile.rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@
"location": "[parameters('azureMonitorWorkspaceLocation')]",
"properties": {
"description": "[concat(variables('nodeRecordingRuleGroupDescription'), variables('version'))]",
"scopes": ["[parameters('azureMonitorWorkspaceResourceId')]"],
"scopes": [
"[parameters('azureMonitorWorkspaceResourceId')]",
"[parameters('clusterResourceId')]"
],
"clusterName": "[variables('clusterName')]",
"interval": "PT1M",
"rules": [
Expand Down Expand Up @@ -283,7 +286,10 @@
"location": "[parameters('azureMonitorWorkspaceLocation')]",
"properties": {
"description": "[concat(variables('kubernetesRecordingRuleGroupDescription'), variables('version'))]",
"scopes": ["[parameters('azureMonitorWorkspaceResourceId')]"],
"scopes": [
"[parameters('azureMonitorWorkspaceResourceId')]",
"[parameters('clusterResourceId')]"
],
"clusterName": "[variables('clusterName')]",
"interval": "PT1M",
"rules": [
Expand Down Expand Up @@ -386,7 +392,8 @@
"properties": {
"description": "[concat(variables('RecordingRuleGroupDescriptionWin'), variables('version'))]",
"scopes": [
"[parameters('azureMonitorWorkspaceResourceId')]"
"[parameters('azureMonitorWorkspaceResourceId')]",
"[parameters('clusterResourceId')]"
],
"enabled": "[parameters('enableWindowsRecordingRules')]",
"clusterName": "[variables('clusterName')]",
Expand Down Expand Up @@ -463,7 +470,8 @@
"properties": {
"description": "[concat(variables('RecordingRuleGroupDescriptionWin'), variables('version'))]",
"scopes": [
"[parameters('azureMonitorWorkspaceResourceId')]"
"[parameters('azureMonitorWorkspaceResourceId')]",
"[parameters('clusterResourceId')]"
],
"enabled": "[parameters('enableWindowsRecordingRules')]",
"clusterName": "[variables('clusterName')]",
Expand Down
9 changes: 8 additions & 1 deletion GeneratedMonitoringArtifacts/Default/DefaultAlerts.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
"description": "Cluster name"
}
},
"clusterResourceId": {
"type": "string",
"metadata": {
"description": "Cluster Resource Id"
}
},
"actionGroupResourceId": {
"type": "string",
"metadata": {
Expand Down Expand Up @@ -40,7 +46,8 @@
"properties": {
"description": "[concat(variables('kubernetesAlertRuleGroupDescription'), variables('version'))]",
"scopes": [
"[parameters('azureMonitorWorkspaceResourceId')]"
"[parameters('azureMonitorWorkspaceResourceId')]",
"[parameters('clusterResourceId')]"
],
"clusterName": "[parameters('clusterName')]",
"interval": "PT1M",
Expand Down
11 changes: 10 additions & 1 deletion GeneratedMonitoringArtifacts/Default/DefaultRecordingRules.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
"description": "Cluster name"
}
},
"clusterResourceId": {
"type": "string",
"metadata": {
"description": "Cluster Resource Id"
}
},
"azureMonitorWorkspaceResourceId": {
"type": "string",
"metadata": {
Expand Down Expand Up @@ -41,7 +47,10 @@
"location": "[parameters('location')]",
"properties": {
"description": "[concat(variables('nodeRecordingRuleGroupDescription'), variables('version'))]",
"scopes": [ "[parameters('azureMonitorWorkspaceResourceId')]" ],
"scopes": [
"[parameters('azureMonitorWorkspaceResourceId')]",
"[parameters('clusterResourceId')]"
],
"enabled": true,
"clusterName": "[parameters('clusterName')]",
"interval": "PT1M",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
"description": "Cluster name"
}
},
"clusterResourceId": {
"type": "string",
"metadata": {
"description": "Cluster Resource Id"
}
},
"actionGroupResourceId": {
"type": "string",
"metadata": {
Expand Down Expand Up @@ -40,7 +46,8 @@
"properties": {
"description": "[concat(variables('kubernetesAlertRuleGroupDescription'), variables('version'))]",
"scopes": [
"[parameters('azureMonitorWorkspaceResourceId')]"
"[parameters('azureMonitorWorkspaceResourceId')]",
"[parameters('clusterResourceId')]"
],
"clusterName": "[parameters('clusterName')]",
"enabled": true,
Expand Down

0 comments on commit 41ccd8e

Please sign in to comment.