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/essentials/prometheus-metrics-enable.md
+63-18Lines changed: 63 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ Use any of the following methods to install the Azure Monitor agent on your AKS
31
31
32
32
1. Open the **Azure Monitor workspaces** menu in the Azure portal and select your cluster.
33
33
2. Select **Managed Prometheus** to display a list of AKS clusters.
34
-
3.Click**Configure** next to the cluster you want to enable.
34
+
3.Select**Configure** next to the cluster you want to enable.
35
35
36
36
:::image type="content" source="media/prometheus-metrics-enable/azure-monitor-workspace-configure-prometheus.png" lightbox="media/prometheus-metrics-enable/azure-monitor-workspace-configure-prometheus.png" alt-text="Screenshot of Azure Monitor workspace with Prometheus configuration.":::
37
37
@@ -50,7 +50,7 @@ Use `az aks update` with the `-enable-azuremonitormetrics` option to install the
50
50
51
51
52
52
**Create a new default Azure Monitor workspace.**<br>
53
-
If no Azure Monitor Workspace is specified, then a default Azure Monitor Workspace will be created in the `DefaultRG-<cluster_region>` following the format `DefaultAzureMonitorWorkspace-<mapped_region>`.
53
+
If no Azure Monitor Workspace is specified, a default Azure Monitor Workspace is created in the `DefaultRG-<cluster_region>` following the format `DefaultAzureMonitorWorkspace-<mapped_region>`.
54
54
This Azure Monitor Workspace is in the region specific in [Region mappings](#region-mappings).
55
55
56
56
```azurecli
@@ -89,7 +89,8 @@ The output for each command looks similar to the following:
89
89
Following are optional parameters that you can use with the previous commands.
90
90
91
91
-`--ksm-metric-annotations-allow-list` is a comma-separated list of Kubernetes annotations keys that will be used in the resource's labels metric. By default the metric contains only name and namespace labels. To include more annotations provide a list of resource names in their plural form and Kubernetes annotation keys, you would like to allow for them. A single `*` can be provided per resource instead to allow any annotations, but that has severe performance implications.
92
-
-`--ksm-metric-labels-allow-list` is a comma-separated list of more Kubernetes label keys that will be used in the resource's labels metric. By default the metric contains only name and namespace labels. To include more labels provide a list of resource names in their plural form and Kubernetes label keys, you would like to allow for them. A single `*` can be provided per resource instead to allow any labels, but that has severe performance implications.
92
+
-`--ksm-metric-labels-allow-list` is a comma-separated list of more Kubernetes label keys that is used in the resource's labels metric. By default the metric contains only name and namespace labels. To include more labels provide a list of resource names in their plural form and Kubernetes label keys, you would like to allow for them. A single `*` can be provided per resource instead to allow any labels, but that has severe performance implications.
93
+
-`--enable-windows-recording-rules` lets you enable the recording rule groups required for proper functioning of the windows dashboards.
93
94
94
95
**Use annotations and labels.**
95
96
@@ -116,7 +117,7 @@ The output is similar to the following:
116
117
### Prerequisites
117
118
118
119
- Register the `AKS-PrometheusAddonPreview` feature flag in the Azure Kubernetes clusters subscription with the following command in Azure CLI: `az feature register --namespace Microsoft.ContainerService --name AKS-PrometheusAddonPreview`.
119
-
- If the Azure Managed Grafana instance is in a subscription other than the Azure Monitor Workspaces subscription, then please register the Azure Monitor Workspace subscription with the `Microsoft.Dashboard` resource provider following this [documentation](../../azure-resource-manager/management/resource-providers-and-types.md#register-resource-provider).
120
+
- If the Azure Managed Grafana instance is in a subscription other than the Azure Monitor Workspaces subscription, register the Azure Monitor Workspace subscription with the `Microsoft.Dashboard` resource provider following this [documentation](../../azure-resource-manager/management/resource-providers-and-types.md#register-resource-provider).
120
121
- The Azure Monitor workspace and Azure Managed Grafana workspace must already be created.
121
122
- The template needs to be deployed in the same resource group as the Azure Managed Grafana workspace.
122
123
- Users with 'User Access Administrator' role in the subscription of the AKS cluster can be able to enable 'Monitoring Data Reader' role directly by deploying the template.
@@ -203,7 +204,7 @@ The final `azureMonitorWorkspaceResourceId` entry is already in the template and
203
204
- Users with 'User Access Administrator' role in the subscription of the AKS cluster can be able to enable 'Monitoring Data Reader' role directly by deploying the template.
204
205
205
206
### Minor Limitation while deploying through bicep
206
-
Currently in bicep, there is no way to explicitly "scope" the Monitoring Data Reader role assignment on a string parameter "resource id" for Azure Monitor Workspace (like in ARM template). Bicep expects a value of type "resource | tenant" and currently there is no rest api [spec](https://github.com/Azure/azure-rest-api-specs) for Azure Monitor Workspace. So, as a workaround, the default scoping for Monitoring Data Reader role is on the resource group and thus the role is applied on the same Azure monitor workspace (by inheritance) which is the expected behavior. Thus, after deploying this bicep template, the Grafana resource will get read permissions in all the Azure Monitor Workspaces under the subscription.
207
+
Currently in bicep, there's no way to explicitly "scope" the Monitoring Data Reader role assignment on a string parameter "resource ID" for Azure Monitor Workspace (like in ARM template). Bicep expects a value of type "resource | tenant" and currently there's no rest api [spec](https://github.com/Azure/azure-rest-api-specs) for Azure Monitor Workspace. So, as a workaround, the default scoping for Monitoring Data Reader role is on the resource group and thus the role is applied on the same Azure monitor workspace (by inheritance) which is the expected behavior. Thus, after deploying this bicep template, the Grafana resource will get read permissions in all the Azure Monitor Workspaces under the subscription.
207
208
208
209
209
210
### Retrieve required values for Grafana resource
@@ -233,7 +234,7 @@ If you're using an existing Azure Managed Grafana instance that already has been
233
234
2. Download the parameter file from [here](https://aka.ms/azureprometheus-enable-bicep-template-parameters) and save it as **FullAzureMonitorMetricsProfileParameters.json** in the same directory as the main bicep template.
234
235
3. Download the [nested_azuremonitormetrics_dcra_clusterResourceId.bicep](https://aka.ms/nested_azuremonitormetrics_dcra_clusterResourceId) and [nested_azuremonitormetrics_profile_clusterResourceId.bicep](https://aka.ms/nested_azuremonitormetrics_profile_clusterResourceId) files in the same directory as the main bicep template.
235
236
4. Edit the values in the parameter file.
236
-
5. The main bicep template creates all the required resources and uses two modules for creating the dcra and monitormetrics profile resources from the other two bicep files.
237
+
5. The main bicep template creates all the required resources and uses two modules for creating the dcra and monitor metrics profile resources from the other two bicep files.
237
238
238
239
| Parameter | Value |
239
240
|:---|:---|
@@ -291,13 +292,13 @@ The final `azureMonitorWorkspaceResourceId` entry is already in the template and
291
292
292
293
1. Download the main Azure policy rules template from [here](https://aka.ms/AddonPolicyMetricsProfile) and save it as **AddonPolicyMetricsProfile.rules.json**.
293
294
2. Download the parameter file from [here](https://aka.ms/AddonPolicyMetricsProfile.parameters) and save it as **AddonPolicyMetricsProfile.parameters.json** in the same directory as the rules template.
4. After creating the policy definition, go to Azure portal -> Policy -> Definitions and select the Policy definition you created.
296
-
5. Click on 'Assign' and then go to the 'Parameters' tab and fill in the details. Then click 'Review + Create'.
297
+
5. Select 'Assign' and then go to the 'Parameters' tab and fill in the details. Then select 'Review + Create'.
297
298
6. Now that the policy is assigned to the subscription, whenever you create a new cluster, which does not have Prometheus enabled, the policy will run and deploy the resources. If you want to apply the policy to existing AKS cluster, create a 'Remediation task' for that AKS cluster resource after going to the 'Policy Assignment'.
298
299
7. Now you should see metrics flowing in the existing linked Grafana resource, which is linked with the corresponding Azure Monitor Workspace.
299
300
300
-
In case you create a new Managed Grafana resource from Azure portal, please link it with the corresponding Azure Monitor Workspace from the 'Linked Grafana Workspaces' tab of the relevant Azure Monitor Workspace page. Please assign the role 'Monitoring Data Reader' to the Grafana MSI on the Azure Monitor Workspace resource so that it can read data for displaying the charts, using the instructions below.
301
+
In case you create a new Managed Grafana resource from Azure portal, please link it with the corresponding Azure Monitor Workspace from the 'Linked Grafana Workspaces' tab of the relevant Azure Monitor Workspace page. Assign the role 'Monitoring Data Reader' to the Grafana MSI on the Azure Monitor Workspace resource so that it can read data for displaying the charts, using the instructions below.
301
302
302
303
1. From the **Overview** page for the Azure Managed Grafana instance in the Azure portal, select **JSON view**.
303
304
@@ -314,23 +315,47 @@ In case you create a new Managed Grafana resource from Azure portal, please link
314
315
4. Select `Monitoring Data Reader`.
315
316
5. Select **Managed identity** and then **Select members**.
316
317
6. Select the **system-assigned managed identity** with the `principalId` from the Grafana resource.
317
-
7. Click **Select** and then **Review+assign**.
318
+
7. Select **Select** and then **Review+assign**.
318
319
319
320
### Deploy template
320
321
321
322
Deploy the template with the parameter file using any valid method for deploying Resource Manager templates. See [Deploy the sample templates](../resource-manager-samples.md#deploy-the-sample-templates) for examples of different methods.
322
323
323
324
### Limitations
324
325
325
-
- Ensure that you update the `kube-state metrics` Annotations and Labels list with proper formatting. There's a limitation in the Resource Manager template deployments that require exact values in the `kube-state` metrics pods. If the kuberenetes pod has any issues with malformed parameters and isn't running, then the feature won't work as expected.
326
+
- Ensure that you update the `kube-state metrics` Annotations and Labels list with proper formatting. There's a limitation in the Resource Manager template deployments that require exact values in the `kube-state` metrics pods. If the Kubernetes pod has any issues with malformed parameters and isn't running, then the feature won't work as expected.
326
327
- A data collection rule and data collection endpoint is created with the name `MSProm-\<short-cluster-region\>-\<cluster-name\>`. These names can't currently be modified.
327
328
- You must get the existing Azure Monitor workspace integrations for a Grafana workspace and update the Resource Manager template with it, otherwise it will overwrite and remove the existing integrations from the grafana workspace.
328
-
329
329
---
330
330
331
+
## Enable windows metrics collection
332
+
333
+
As of version 6.4.0-main-02-22-2023-3ee44b9e, windows metric collection has been enabled for the AKS clusters. Onboarding to the Azure Monitor Metrics Addon will enable the windows daemonset pods to start running on your nodepools. Both Windows Server 2019 and Windows Server 2022 are supported. Follow the steps below to enable the pods to collect metrics from your windows node pools.
334
+
335
+
1. Manually install the windows exporter on AKS nodes to access windows metrics.
336
+
Enable the following collectors:
337
+
338
+
* `[defaults]`
339
+
* `container`
340
+
* `memory`
341
+
* `process`
342
+
* `cpu_info`
343
+
344
+
Deploy the [windows-exporter-daemonset YAML](https://github.com/prometheus-community/windows_exporter/blob/master/kubernetes/windows-exporter-daemonset.yaml) file
345
+
```
346
+
kubectl apply -f windows-exporter-daemonset.yaml
347
+
```
348
+
2. Apply the [ama-metrics-settings-configmap](https://github.com/Azure/prometheus-collector/blob/main/otelcollector/configmaps/ama-metrics-settings-configmap.yaml) to your cluster, setting the `windowsexporter` and `windowskubeproxy` booleans to rue`. For more information, see [Metrics addon settings configmap](./prometheus-metrics-scrape-configuration.md#metrics-addon-settings-configmap).
349
+
3. While onboarding, enable the recording rules required for the default dashboards.
350
+
351
+
* For CLI include the option `--enable-windows-recording-rules`.
352
+
* For ARM template, Bicep, or Policy, set `enableWindowsRecordingRules` to `true` in the parameters file.
353
+
354
+
If the cluster is already onboarded to Azure Monitor Metrics, to enable windows recording rule groups use this [ARM template](https://github.com/Azure/prometheus-collector/blob/kaveesh/windows_recording_rules/AddonArmTemplate/WindowsRecordingRuleGroupTemplate/WindowsRecordingRules.json) and [Parameters](https://github.com/Azure/prometheus-collector/blob/kaveesh/windows_recording_rules/AddonArmTemplate/WindowsRecordingRuleGroupTemplate/WindowsRecordingRulesParameters.json) file to create the rule groups.
355
+
331
356
## Verify Deployment
332
357
333
-
Run the following command to verify that the DaemonSet was deployed properly:
358
+
Run the following command to verify that the DaemonSet was deployed properly on the linux nodepools:
334
359
335
360
```
336
361
kubectl get ds ama-metrics-node --namespace=kube-system
@@ -344,6 +369,21 @@ NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SEL
344
369
ama-metrics-node 1 1 1 1 1 <none> 10h
345
370
```
346
371
372
+
373
+
Run the following command to verify that the DaemonSet was deployed properly on the windows nodepools:
374
+
375
+
```
376
+
kubectl get ds ama-metrics-win-node --namespace=kube-system
377
+
```
378
+
379
+
The output should resemble the following:
380
+
381
+
```
382
+
User@aksuser:~$ kubectl get ds ama-metrics-node --namespace=kube-system
383
+
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
384
+
ama-metrics-win-node 3 3 3 3 3 <none> 10h
385
+
```
386
+
347
387
Run the following command to which verify that the ReplicaSets were deployed properly:
- HTTP Proxy is supported and will use the same settings as the HTTP Proxy settings for the AKS cluster configured with [these instructions](/articles/aks/http-proxy.md).
404
+
- HTTP Proxy is supported and will use the same settings as the HTTP Proxy settings for the AKS cluster configured with [these instructions](../../../articles/aks/http-proxy.md).
365
405
366
406
## Limitations
367
407
368
408
- CPU and Memory requests and limits can't be changed for Container insights metrics addon. If changed, they'll be reconciled and replaced by original values in a few seconds.
369
-
- Azure Monitor Private Link (AMPLS) is not currently supported.
409
+
- Azure Monitor Private Link (AMPLS) isn't currently supported.
370
410
- Only public clouds are currently supported.
371
411
372
412
373
413
## Uninstall metrics addon
374
414
Currently, Azure CLI is the only option to remove the metrics addon and stop sending Prometheus metrics to Azure Monitor managed service for Prometheus.
375
415
376
-
If you don't already have it, install the aks-preview extension with the following command.
416
+
Install the `aks-preview` extension using the following command:
377
417
378
-
The `aks-preview` extension needs to be installed using the following command. For more information on how to install a CLI extension, see [Use and manage extensions with the Azure CLI](/cli/azure/azure-cli-extensions-overview).
418
+
```
419
+
az extension add --name aks-preview
420
+
```
379
421
422
+
For more information on installing a CLI extension, see [Use and manage extensions with the Azure CLI](/cli/azure/azure-cli-extensions-overview).
423
+
424
+
> [!NOTE]
425
+
> Upgrade your az cli version to the latest version and ensure that the aks-preview version you're using is at least '0.5.132'. Find your current version using the `az version`.
380
426
```azurecli
381
427
az extension add --name aks-preview
382
428
```
@@ -447,4 +493,3 @@ When you allow a default Azure Monitor workspace to be created when you install
447
493
- [Customize Prometheus metric scraping for the cluster](./prometheus-metrics-scrape-configuration.md).
448
494
- [Use Azure Monitor managed service for Prometheus (preview) as data source for Grafana](./prometheus-grafana.md)
449
495
- [Configure self-hosted Grafana to use Azure Monitor managed service for Prometheus (preview)](./prometheus-self-managed-grafana-azure-active-directory.md)
0 commit comments