Skip to content

Commit 6991903

Browse files
Merge pull request #225300 from Sohamdg081992/UpdateMultiDcrDoc
Update doc for sending Prometheus metrics to multiple workspace
2 parents 13669c9 + 0af20d3 commit 6991903

File tree

1 file changed

+63
-4
lines changed

1 file changed

+63
-4
lines changed

articles/azure-monitor/essentials/prometheus-metrics-multiple-workspaces.md

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Routing metrics to more Azure Monitor Workspaces can be done through the creatio
1313

1414
## Send same metrics to multiple Azure Monitor workspaces
1515

16-
You can create multiple Data Collection Rules that point to the same Data Collection Endpoint for metrics to be sent to additional Azure Monitor Workspaces from the same Kubernetes cluster. Currently, this is only available through onboarding through Resource Manager templates. You can follow the [regular onboarding process](prometheus-metrics-enable.md) and then edit the same Resource Manager templates to add additional DCRs for your additional Azure Monitor Workspaces. You'll need to edit the template to add an additional parameters for every additional Azure Monitor workspace, add another DCR for every additional Azure Monitor workspace, and add an additional Azure Monitor workspace integration for Grafana.
16+
You can create multiple Data Collection Rules that point to the same Data Collection Endpoint for metrics to be sent to additional Azure Monitor Workspaces from the same Kubernetes cluster. In case you have a very high volume of metrics, a new Data Collection Endpoint can be created as well. Please refer to the service limits [document](../service-limits.md) regarding ingestion limits. Currently, this is only available through onboarding through Resource Manager templates. You can follow the [regular onboarding process](prometheus-metrics-enable.md) and then edit the same Resource Manager templates to add additional DCRs and DCEs(if applicable) for your additional Azure Monitor Workspaces. You'll need to edit the template to add an additional parameters for every additional Azure Monitor workspace, add another DCR for every additional Azure Monitor workspace, add another DCE (if applicable), add the Monitor Reader Role for the new Azure Monitor Workspace and add an additional Azure Monitor workspace integration for Grafana.
1717

1818
- Add the following parameters:
1919
```json
@@ -43,7 +43,18 @@ You can create multiple Data Collection Rules that point to the same Data Collec
4343
}
4444
```
4545

46-
- Add an additional DCR with the same Data Collection Endpoint. You *must* replace `<dcrName>`:
46+
- For high metric volume, add an additional Data Collection Endpoint. You *must* replace `<dceName>`:
47+
```json
48+
{
49+
"type": "Microsoft.Insights/dataCollectionEndpoints",
50+
"apiVersion": "2021-09-01-preview",
51+
"name": "[variables('dceName')]",
52+
"location": "[parameters('azureMonitorWorkspaceLocation2')]",
53+
"kind": "Linux",
54+
"properties": {}
55+
}
56+
```
57+
- Add an additional DCR with the same or a different Data Collection Endpoint. You *must* replace `<dcrName>`:
4758
```json
4859
{
4960
"type": "Microsoft.Insights/dataCollectionRules",
@@ -84,7 +95,42 @@ You can create multiple Data Collection Rules that point to the same Data Collec
8495
}
8596
```
8697

87-
98+
- Add an additional DCRA with the relevant Data Collection Rule. You *must* replace `<dcraName>`:
99+
```json
100+
{
101+
"type": "Microsoft.Resources/deployments",
102+
"name": "<dcraName>",
103+
"apiVersion": "2017-05-10",
104+
"subscriptionId": "[variables('clusterSubscriptionId')]",
105+
"resourceGroup": "[variables('clusterResourceGroup')]",
106+
"dependsOn": [
107+
"[resourceId('Microsoft.Insights/dataCollectionEndpoints/', variables('dceName'))]",
108+
"[resourceId('Microsoft.Insights/dataCollectionRules', variables('dcrName'))]"
109+
],
110+
"properties": {
111+
"mode": "Incremental",
112+
"template": {
113+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
114+
"contentVersion": "1.0.0.0",
115+
"parameters": {},
116+
"variables": {},
117+
"resources": [
118+
{
119+
"type": "Microsoft.ContainerService/managedClusters/providers/dataCollectionRuleAssociations",
120+
"name": "[concat(variables('clusterName'),'/microsoft.insights/', variables('dcraName'))]",
121+
"apiVersion": "2021-09-01-preview",
122+
"location": "[parameters('clusterLocation')]",
123+
"properties": {
124+
"description": "Association of data collection rule. Deleting this association will break the data collection for this AKS Cluster.",
125+
"dataCollectionRuleId": "[resourceId('Microsoft.Insights/dataCollectionRules', variables('dcrName'))]"
126+
}
127+
}
128+
]
129+
},
130+
"parameters": {}
131+
}
132+
}
133+
```
88134
- Add an additional Grafana integration:
89135
```json
90136
{
@@ -116,8 +162,21 @@ You can create multiple Data Collection Rules that point to the same Data Collec
116162
}
117163
}
118164
```
119-
Similar to the regular Resource Manager onboarding process, the `Monitoring Data Reader` role will need to be assigned for every Azure Monitor workspace linked to Grafana. This will allow the Azure Managed Grafana resource to read data from the Azure Monitor workspace and is a requirement for viewing the metrics.
165+
- Assign `Monitoring Data Reader` role to read data from the new Azure Monitor Workspace:
120166

167+
```json
168+
{
169+
"type": "Microsoft.Authorization/roleAssignments",
170+
"apiVersion": "2022-04-01",
171+
"name": "[parameters('roleNameGuid')]",
172+
"scope": "[parameters('azureMonitorWorkspaceResourceId2')]",
173+
"properties": {
174+
"roleDefinitionId": "[concat('/subscriptions/', variables('clusterSubscriptionId'), '/providers/Microsoft.Authorization/roleDefinitions/', 'b0d8363b-8ddd-447d-831f-62ca05bff136')]",
175+
"principalId": "[reference(resourceId('Microsoft.Dashboard/grafana', split(parameters('grafanaResourceId'),'/')[8]), '2022-08-01', 'Full').identity.principalId]"
176+
}
177+
}
178+
179+
```
121180
## Send different metrics to different Azure Monitor workspaces
122181

123182
If you want to send some metrics to one Azure Monitor Workspace and other metrics to a different one, follow the above steps to add additional DCRs. The value of `microsoft_metrics_include_label` under the `labelIncludeFilter` in the DCR is the identifier for the workspace. To then configure which metrics are routed to which workspace, you can add an extra pre-defined label, `microsoft_metrics_account` to the metrics. The value should be the same as the corresponding `microsoft_metrics_include_label` in the DCR for that workspace. To add the label to the metrics, you can utilize `relabel_configs` in your scrape config. To send all metrics from one job to a certain workspace, add the following relabel config:

0 commit comments

Comments
 (0)