You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-monitor/containers/prometheus-metrics-multiple-workspaces.md
+168-4Lines changed: 168 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,18 +8,182 @@ ms.reviewer: aul
8
8
9
9
# Send Prometheus metrics to multiple Azure Monitor workspaces
10
10
11
-
Routing metrics to more Azure Monitor workspaces can be done through the creation of additional data collection rules.
11
+
Routing different metrics to more Azure Monitor workspaces can be done through the creation of additional data collection rules.
12
12
13
-
## Send different metrics to different Azure Monitor workspaces
13
+
You can create Data Collection Rules with corresponding Data Collection Endpoints for different metrics to be sent to additional Azure Monitor workspaces from the same Kubernetes cluster.
14
+
Currently, this is only available through onboarding through Resource Manager templates. You can follow the [regular onboarding process](kubernetes-monitoring-enable.md#enable-prometheus-and-grafana) and then edit the same Resource Manager templates to add additional DCRs and DCEs 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 , add the Monitor Reader Role for the new Azure Monitor workspace and add an additional Azure Monitor workspace integration for Grafana.
14
15
15
-
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:
16
+
- Add the following parameters:
17
+
```json
18
+
"parameters": {
19
+
"azureMonitorWorkspaceResourceId2": {
20
+
"type": "string"
21
+
},
22
+
"azureMonitorWorkspaceLocation2": {
23
+
"type": "string",
24
+
"defaultValue": "",
25
+
"allowedValues": [
26
+
"eastus2euap",
27
+
"centraluseuap",
28
+
"centralus",
29
+
"eastus",
30
+
"eastus2",
31
+
"northeurope",
32
+
"southcentralus",
33
+
"southeastasia",
34
+
"uksouth",
35
+
"westeurope",
36
+
"westus",
37
+
"westus2"
38
+
]
39
+
},
40
+
...
41
+
}
42
+
```
43
+
44
+
- Add an additional Data Collection Endpoint. You *must* replace `<dceName>`:
- Add an additional Data Collection Rule Association (DCRA) with the relevant Data Collection Rule (DCR). This associates the DCR with the cluster. You must replace `<dcraName>`:
Then configure which metrics are routed to which workspace, by adding 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:
16
180
17
181
```yaml
18
182
relabel_configs:
19
183
- source_labels: [__address__]
20
184
target_label: microsoft_metrics_account
21
185
action: replace
22
-
replacement: "MonitoringAccountLabel1"
186
+
replacement: "MonitoringAccountLabel2"
23
187
```
24
188
25
189
The source label is `__address__` because this label will always exist so this relabel config will always be applied. The target label will always be `microsoft_metrics_account` and its value should be replaced with the corresponding label value for the workspace.
0 commit comments