|
| 1 | +--- |
| 2 | +title: "Azure Operator Nexus: How to configure cluster metrics configuration management" |
| 3 | +description: Instructional for the inputs and methods for creating, updating, retrieving, and deleting cluster metrics configurations. |
| 4 | +author: bryan-strassner |
| 5 | +ms.author: bstrassner |
| 6 | +ms.service: azure |
| 7 | +ms.topic: how-to |
| 8 | +ms.date: 02/09/2023 |
| 9 | +ms.custom: template-how-to |
| 10 | +--- |
| 11 | + |
| 12 | +# Cluster metrics configuration |
| 13 | + |
| 14 | +When the user deploys a Cluster, a standard set of metrics are enabled for collection. For the list of metrics, see |
| 15 | +[List of Metrics Collected](List-of-metrics-collected.md). |
| 16 | + |
| 17 | +Users can't control the behavior (enable or disable) for collection of these included standard metrics. Though, users can control the collection of some optional metrics that aren't part of the link in the list. To enable this experience, users will have to create and update a MetricsConfiguration resource for a cluster. By default, creation of this MetricsConfiguration resource doesn't change the collection of metrics. User will have to update the resource to enable or disable these optional metrics collection. |
| 18 | + |
| 19 | +> [!NOTE] |
| 20 | +> * For a cluster, at max, only one MetricsConfiguration resource could be created. |
| 21 | +> * Users need to create a MetricsConfiguration resource to check a list of optional metrics that can be controlled. |
| 22 | +> * Deletion of the MetricsConfiguration resource will result in the standard set of metrics being restored. |
| 23 | +
|
| 24 | +## How to manage cluster metrics configuration |
| 25 | + |
| 26 | +To support the lifecycle of cluster metrics configurations, the following `az rest` interactions allow for the creation and management of a cluster's metrics configurations. |
| 27 | + |
| 28 | +### Creating a metrics configuration |
| 29 | + |
| 30 | +Use of the `az rest` command requires that the request input is defined, and then a `PUT` request is made to the `Microsoft.NetworkCloud` resource provider. |
| 31 | + |
| 32 | +Define a file with the desired metrics configuration. |
| 33 | + |
| 34 | +* Replace values within `<` `>` with your specific information. |
| 35 | +* Query the cluster resource and find the value of `<CLUSTER-EXTENDED-LOCATION-ID>` in the `properties.clusterExtendedLocation` |
| 36 | +* The `collectionInterval` field is required, `enabledMetrics` is optional and may be omitted. |
| 37 | + |
| 38 | +Example filename: create_metrics_configuration.json |
| 39 | + |
| 40 | +```json |
| 41 | +{ |
| 42 | + "location": "<REGION (example: eastus)>", |
| 43 | + "extendedLocation": { |
| 44 | + "name": "<CLUSTER-EXTENDED-LOCATION-ID>", |
| 45 | + "type": "CustomLocation" |
| 46 | + }, |
| 47 | + "properties": { |
| 48 | + "collectionInterval": <COLLECTION-INTERVAL (1-1440)>, |
| 49 | + "enabledMetrics": [ |
| 50 | + "<METRIC-TO-ENABLE-1>", |
| 51 | + "<METRIC-TO-ENABLE-2>" |
| 52 | + ] |
| 53 | + } |
| 54 | +} |
| 55 | +``` |
| 56 | + |
| 57 | +The following commands will create the metrics configuration. The only name allowed for the metricsConfiguration is `default`. |
| 58 | + |
| 59 | +```sh |
| 60 | +export SUBSCRIPTION=<the subscription id for the cluster> |
| 61 | +export RESOURCE_GROUP=<the resource group for the cluster> |
| 62 | +export CLUSTER=<the cluter name> |
| 63 | + |
| 64 | +az rest -m put -u "https://management.azure.com/subscriptions/${SUBSCRIPTION}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.NetworkCloud/clusters/${CLUSTER}/metricsConfigurations/default?api-version=2022-12-12-preview" -b @create_metrics_configuration.json --debug |
| 65 | +``` |
| 66 | + |
| 67 | +Specifying `--debug` in REST API will result in the tracking operation status in the returned command output. This operation status can be queried to monitor the progress of the operation. See: [How-to track asynchronous operations](howto-track-async-operations-cli.md). |
| 68 | + |
| 69 | +## Retrieving a metrics configuration |
| 70 | + |
| 71 | +After a metrics configuration is created, it can be retrieved using a `az rest` command: |
| 72 | + |
| 73 | +```sh |
| 74 | +export SUBSCRIPTION=<the subscription id for the cluster> |
| 75 | +export RESOURCE_GROUP=<the resource group for the cluster> |
| 76 | +export CLUSTER=<the cluter name> |
| 77 | + |
| 78 | +az rest -m get -u "https://management.azure.com/subscriptions/${SUBSCRIPTION}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.NetworkCloud/clusters/${CLUSTER}/metricsConfigurations/default?api-version=2022-12-12-preview" |
| 79 | +``` |
| 80 | + |
| 81 | +This command will return a JSON representation of the metrics configuration. |
| 82 | + |
| 83 | +## Updating a metrics configuration |
| 84 | + |
| 85 | +Much like the creation of a metrics configuration, an update can be performed to change the configuration. A file, containing the metrics to be updated, is consumed as an input. |
| 86 | + |
| 87 | +Example filename: update_metrics_configuration.json |
| 88 | + |
| 89 | +```json |
| 90 | +{ |
| 91 | + "properties": { |
| 92 | + "collectionInterval": <COLLECTION-INTERVAL (1-1440)>, |
| 93 | + "enabledMetrics": [ |
| 94 | + "<METRIC-TO-ENABLE-1>", |
| 95 | + "<METRIC-TO-ENABLE-2>" |
| 96 | + ] |
| 97 | + } |
| 98 | +} |
| 99 | +``` |
| 100 | + |
| 101 | +This file is used as input to an `az rest` command. The change may include either or both of the updatable fields, `collectionInterval` or `enabledMetrics`. The `collectionInterval` can be updated independently of `enabledMetrics`. Omit fields that aren't being changed. |
| 102 | + |
| 103 | +```sh |
| 104 | +export SUBSCRIPTION=<the subscription id for the cluster> |
| 105 | +export RESOURCE_GROUP=<the resource group for the cluster> |
| 106 | +export CLUSTER=<the cluter name> |
| 107 | + |
| 108 | +az rest -m put -u "https://management.azure.com/subscriptions/${SUBSCRIPTION}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.NetworkCloud/clusters/${CLUSTER}/metricsConfigurations/default?api-version=2022-12-12-preview" -b @update_metrics_configuration.json --debug |
| 109 | +``` |
| 110 | + |
| 111 | +Specifying `--debug` in REST API will result in the tracking operation status in the returned command output. This operation status can be queried to monitor the progress of the operation. See: [How-to track asynchronous operations](howto-track-async-operations-cli.md). |
| 112 | + |
| 113 | +## Deleting a metrics configuration |
| 114 | + |
| 115 | +Deletion of the metrics configuration will return the cluster to an unaltered configuration. To delete a metrics configuration, `az rest` API is used. |
| 116 | + |
| 117 | +```sh |
| 118 | +export SUBSCRIPTION=<the subscription id for the cluster> |
| 119 | +export RESOURCE_GROUP=<the resource group for the cluster> |
| 120 | +export CLUSTER=<the cluter name> |
| 121 | + |
| 122 | +az rest -m delete -u "https://management.azure.com/subscriptions/${SUBSCRIPTION}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.NetworkCloud/clusters/${CLUSTER}/metricsConfigurations/default?api-version=2022-12-12-preview" --debug |
| 123 | +``` |
| 124 | + |
| 125 | +Specifying `--debug` in REST API will result in the tracking operation status in the returned command output. This operation status can be queried to monitor the progress of the operation. See: [How-to track asynchronous operations](howto-track-async-operations-cli.md). |
0 commit comments