Skip to content

Commit 7bf800c

Browse files
Merge pull request #234513 from priyamshet/priyshet/networkCloudCLIupdates
NetworkCloud - How to Guides updated based on latest CLI changes for 12-12-2022 API
2 parents 0fdcad8 + a44d020 commit 7bf800c

6 files changed

+103
-125
lines changed

articles/operator-nexus/howto-baremetal-review-read-output.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.date: 03/23/2023
99
ms.custom: template-how-to
1010
---
1111

12-
# How to view the output of an `az networkcloud run-read-command` in the Cluster Manager Storage account
12+
# How to view the output of an `az networkcloud baremetalmachine run-read-command` in the Cluster Manager Storage account
1313

1414
This guide walks you through accessing the output file that is created in the Cluster Manager Storage account when an `az networkcloud baremetalmachine run-read-command` is executed on a server. The name of the file is identified in the `az rest` status output.
1515

articles/operator-nexus/howto-baremetal-run-read.md

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ The command syntax is:
6060
```azurecli
6161
az networkcloud baremetalmachine run-read-command --name "<machine-name>"
6262
--limit-time-seconds <timeout> \
63-
--commands arguments="<arg1>" arguments="<arg2>" command="<command>" --resource-group "<resourceGroupName>" \
64-
--subscription "<subscription>" \
65-
--debug
63+
--commands '[{"command":"<command1>"},{"command":"<command2>","arguments":["<arg1>","<arg2>"]}]' \
64+
--resource-group "<resourceGroupName>" \
65+
--subscription "<subscription>"
6666
```
6767

68-
These commands to not require `arguments`:
68+
These commands don't require `arguments`:
6969

7070
- `fdisk -l`
7171
- `hostname`
@@ -75,60 +75,50 @@ These commands to not require `arguments`:
7575
- `ss`
7676
- `ulimit -a`
7777

78-
All other inputs are required. Multiple commands are each specified with their own `--commands` option.
78+
All other inputs are required.
7979

80-
Each `--commands` option specifies `command` and `arguments`. For a command with multiple arguments, `arguments` is repeated for each one.
80+
Multiple commands can be provided in json format to `--commands` option.
8181

82-
`--debug` is required to get the operation status that can be queried to get the URL for the output file.
82+
For a command with multiple arguments, provide as a list to `arguments` parameter. See [Azure CLI Shorthand](https://github.com/Azure/azure-cli/blob/dev/doc/shorthand_syntax.md) for instructions on constructing the `--commands` structure.
83+
84+
These commands can be long running so the recommendation is to set `--limit-time-seconds` to at least 600 seconds (10 minutes). Running multiple extracts might take longer that 10 minutes.
85+
86+
This command runs synchronously. If you wish to skip waiting for the command to complete, specify the `--no-wait --debug` options. For more information, see [how to track asynchronous operations](howto-track-async-operations-cli.md).
87+
/home/priya/azure-docs-pr-pshet/articles/import-export
88+
When an optional argument `--output-directory` is provided, the output result is downloaded and extracted to the local directory.
8389

8490
### This example executes the `hostname` command and a `ping` command.
8591

8692
```azurecli
8793
az networkcloud baremetalmachine run-read-command --name "bareMetalMachineName" \
8894
--limit-time-seconds 60 \
89-
--commands command="hostname" \
90-
--commands arguments="192.168.0.99" arguments="-c" arguments="3" command="ping" \
95+
--commands '[{"command":"hostname"],"arguments":["198.51.102.1","-c","3"]},{"command":"ping"}]' \
9196
--resource-group "resourceGroupName" \
92-
--subscription "<subscription>" \
93-
--debug
97+
--subscription "<subscription>"
9498
```
9599

96100
In the response, an HTTP status code of 202 is returned as the operation is performed asynchronously.
97101

98102
## Checking command status and viewing output
99103

100-
The debug output of the command execution contains the 'Azure-AsyncOperation' response header. Note the URL provided.
101-
102-
```azurecli
103-
cli.azure.cli.core.sdk.policies: 'Azure-AsyncOperation': 'https://management.azure.com/subscriptions/xxxxxx-xxxxxx-xxxx-xxxx-xxxxxx/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/0797fdd7-28eb-48ec-8c70-39a3f893421d*A0123456789F331FE47B40E2BFBCE2E133FD3ED2562348BFFD8388A4AAA1271?api-version=2022-09-30-preview'
104-
```
105104

106-
Check the status of the operation with the `az rest` command:
105+
Sample output looks something as below. It prints the top 4K characters of the result to the screen for convenience and provides a short-lived link to the storage blob containing the command execution result. You can use the link to download the zipped output file (tar.gz).
107106

108107
```azurecli
109-
az rest --method get --url <Azure-AsyncOperation-URL>
110-
```
108+
====Action Command Output====
109+
+ hostname
110+
rack1compute01
111+
+ ping 198.51.102.1 -c 3
112+
PING 198.51.102.1 (198.51.102.1) 56(84) bytes of data.
111113
112-
Repeat until the response to the URL displays the result of the run-read-command.
114+
--- 198.51.102.1 ping statistics ---
115+
3 packets transmitted, 0 received, 100% packet loss, time 2049ms
113116
114-
Sample output looks something like this. The `Succeeded` `status` indicates the command was executed on the BMM. The `resultUrl` provides a link to the zipped output file that contains the output from the command execution. The tar.gz file name can be used to identify the file in the Storage account of the Cluster Manager resource group.
115117
116-
See [How To BareMetal Review Output Run-Read](howto-baremetal-review-read-output.md) for instructions on locating the output file in the Storage Account. You can also use the link to directly access the output zip file.
117118
118-
```azurecli
119-
az rest --method get --url https://management.azure.com/subscriptions/xxxxxx-xxxxxx-xxxx-xxxx-xxxxxx/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/932a8fe6-12ef-419c-bdc2-5bb11a2a071d*C0123456789E735D5D572DECFF4EECE2DFDC121CC3FC56CD50069249183110F?api-version=2022-09-30-preview
120-
{
121-
"endTime": "2023-03-01T12:38:10.8582635Z",
122-
"error": {},
123-
"id": "/subscriptions/xxxxxx-xxxxxx-xxxx-xxxx-xxxxxx/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/932a8fe6-12ef-419c-bdc2-5bb11a2a071d*C0123456789E735D5D572DECFF4EECE2DFDC121CC3FC56CD50069249183110F",
124-
"name": "932a8fe6-12ef-419c-bdc2-5bb11a2a071d*C0123456789E735D5D572DECFF4EECE2DFDC121CC3FC56CD50069249183110F",
125-
"properties": {
126-
"exitCode": "15",
127-
"outputHead": "====Action Command Output====",
128-
"resultUrl": "https://cmnvc94zkjhvst.blob.core.windows.net/bmm-run-command-output/af4fea82-294a-429e-9d1e-e93d54f4ea24-action-bmmruncmd.tar.gz?se=2023-03-01T16%3A38%3A07Z&sig=Lj9MS01234567898fn4qb2E1HORGh260EHdRrCJTJg%3D&sp=r&spr=https&sr=b&st=2023-03-01T12%3A38%3A07Z&sv=2019-12-12"
129-
},
130-
"resourceId": "/subscriptions/xxxxxx-xxxxxx-xxxx-xxxx-xxxxxx/resourceGroups/m01-xx-HostedResources-xx/providers/Microsoft.NetworkCloud/bareMetalMachines/m01r750wkr3",
131-
"startTime": "2023-03-01T12:37:48.2823434Z",
132-
"status": "Succeeded"
133-
}
119+
================================
120+
Script execution result can be found in storage account:
121+
https://<storage_account_name>.blob.core.windows.net/bmm-run-command-output/a8e0a5fe-3279-46a8-b995-51f2f98a18dd-action-bmmrunreadcmd.tar.gz?se=2023-04-14T06%3A37%3A00Z&sig=XXX&sp=r&spr=https&sr=b&st=2023-04-14T02%3A37%3A00Z&sv=2019-12-12
134122
```
123+
124+
See [How To BareMetal Review Output Run-Read](howto-baremetal-review-read-output.md) for instructions on locating the output file in the Storage Account. You can also use the link to directly access the output zip file.

articles/operator-nexus/howto-cluster-manager.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Some arguments that are available for every Azure CLI command
5151

5252
## Create a Cluster Manager
5353

54-
Use the `az network clustermanager create` command to create a Cluster Manager. This command creates a new Cluster Manager or updates the properties of the Cluster Manager if it exists. If you have multiple Azure subscriptions, select the appropriate subscription ID using the [az account set](/cli/azure/account#az-account-set) command.
54+
Use the `az networkcloud clustermanager create` command to create a Cluster Manager. This command creates a new Cluster Manager or updates the properties of the Cluster Manager if it exists. If you have multiple Azure subscriptions, select the appropriate subscription ID using the [az account set](/cli/azure/account#az-account-set) command.
5555

5656
```azurecli
5757
az networkcloud clustermanager create \

articles/operator-nexus/howto-cluster-metrics-configuration-management.md

Lines changed: 55 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -14,115 +14,100 @@ ms.custom: template-how-to
1414
When the user deploys a Cluster, a standard set of metrics are enabled for collection. For the list of metrics, see
1515
[List of Metrics Collected](List-of-metrics-collected.md).
1616

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 to 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.
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 to the list. To enable this experience, users 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 has to update the resource to enable or disable these optional metrics collection.
1818

1919
> [!NOTE]
2020
> * For a cluster, at max, only one MetricsConfiguration resource can be created.
2121
> * 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.
22+
> * Deletion of the MetricsConfiguration resource results in the standard set of metrics being restored.
2323
2424
## How to manage cluster metrics configuration
2525

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.
26+
To support the lifecycle of cluster metrics configurations, the following interactions allow for the creation and management of a cluster's metrics configurations.
2727

2828
### Creating a metrics configuration
2929

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.
30+
Use the `az network cluster metricsconfiguration create` command to create metrics configuration for cluster. If you have multiple Azure subscriptions, select the appropriate subscription ID using the [az account set](/cli/azure/account#az-account-set) command.
31+
32+
```azurecli
33+
az networkcloud cluster metricsconfiguration create \
34+
--cluster-name "<CLUSTER>" \
35+
--extended-location name="<CLUSTER_EXTENDED_LOCATION_ID>" type="CustomLocation" \
36+
--location "<LOCATION>" \
37+
--collection-interval <COLLECTION_INTERVAL (1-1440)> \
38+
--enabled-metrics "<METRIC_TO_ENABLE_1>" "<METRIC_TO_ENABLE_2>" \
39+
--tags <TAG_KEY1>="<TAG_VALUE1>" <TAG_KEY2>="<TAG_VALUE2>" \
40+
--resource-group "<RESOURCE_GROUP>"
41+
```
3342

3443
* Replace values within `<` `>` with your specific information.
3544
* Query the cluster resource and find the value of `<CLUSTER-EXTENDED-LOCATION-ID>` in the `properties.clusterExtendedLocation`
3645
* The `collectionInterval` field is required, `enabledMetrics` is optional and may be omitted.
3746

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-
5747
> [!NOTE]
5848
> * The default metrics collection interval for standard set of metrics is set to every 5 minutes. Changing the `collectionInterval` will also impact the collection frequency for default standard metrics.
49+
> * There can be only one set of metrics configuration defined per cluster. The resource is created with the name `default`.
5950
60-
The following commands will create the metrics configuration. The only name allowed for the metricsConfiguration is `default`.
51+
Specifying `--no-wait --debug` options in az cli command results in the execution of this command asynchronously. For more information, see [how to track asynchronous operations](howto-track-async-operations-cli.md).
6152

62-
```sh
63-
export SUBSCRIPTION=<the subscription id for the cluster>
64-
export RESOURCE_GROUP=<the resource group for the cluster>
65-
export CLUSTER=<the cluter name>
53+
### Metrics configuration elements
6654

67-
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
68-
```
55+
| Parameter name | Description |
56+
| --------------------------------------| -------------------------------------------------------------------------------------------------- |
57+
| CLUSTER | Resource Name of Cluster |
58+
| LOCATION | The Azure Region where the Cluster is deployed |
59+
| CLUSTER_EXTENDED_LOCATION_ID | The Cluster extended Location from Azure portal |
60+
| COLLECTION_INTERVAL | The collection frequency for default standard metrics |
61+
| RESOURCE_GROUP | The Cluster resource group name |
62+
| TAG_KEY1 | Optional tag1 to pass to Cluster create |
63+
| TAG_VALUE1 | Optional tag1 value to pass to Cluster Create |
64+
| TAG_KEY2 | Optional tag2 to pass to Cluster create |
65+
| TAG_VALUE2 | Optional tag2 value to pass to Cluster create |
66+
| METRIC_TO_ENABLE_1 | Optional metric1 that is enabled in addition to the default metrics |
67+
| METRIC_TO_ENABLE_2 | Optional metric2 that is enabled in addition to the default metrics |
6968

70-
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).
69+
Specifying `--no-wait --debug` options in az cli command results in the execution of this command asynchronously. For more information, see [how to track asynchronous operations](howto-track-async-operations-cli.md).
7170

7271
## Retrieving a metrics configuration
7372

7473
After a metrics configuration is created, it can be retrieved using a `az rest` command:
7574

76-
```sh
77-
export SUBSCRIPTION=<the subscription id for the cluster>
78-
export RESOURCE_GROUP=<the resource group for the cluster>
79-
export CLUSTER=<the cluter name>
8075

81-
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"
76+
```azurecli
77+
az networkcloud cluster metricsconfiguration show \
78+
--cluster-name "<CLUSTER>" \
79+
--resource-group "<RESOURCE_GROUP>"
8280
```
8381

84-
This command will return a JSON representation of the metrics configuration.
82+
This command returns a JSON representation of the metrics configuration.
8583

8684
## Updating a metrics configuration
8785

88-
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.
89-
90-
Example filename: update_metrics_configuration.json
86+
Much like the creation of a metrics configuration, an update can be performed to change the configuration or update the tags assigned to the metrics configuration.
9187

92-
```json
93-
{
94-
"properties": {
95-
"collectionInterval": <COLLECTION-INTERVAL (1-1440)>,
96-
"enabledMetrics": [
97-
"<METRIC-TO-ENABLE-1>",
98-
"<METRIC-TO-ENABLE-2>"
99-
]
100-
}
101-
}
88+
```azurecli
89+
az networkcloud cluster metricsconfiguration update \
90+
--cluster-name "<CLUSTER>" \
91+
--collection-interval <COLLECTION_INTERVAL (1-1440)> \
92+
--enabled-metrics "<METRIC_TO_ENABLE_1>" "<METRIC_TO_ENABLE_2>" \
93+
--tags <TAG_KEY1>="<TAG_VALUE1>" <TAG_KEY2>="<TAG_VALUE2>" \
94+
--resource-group "<RESOURCE_GROUP>"
10295
```
10396

104-
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.
97+
The `collection-interval` can be updated independently of `enabled-metrics` list. Omit fields that aren't being changed.
10598

106-
```sh
107-
export SUBSCRIPTION=<the subscription id for the cluster>
108-
export RESOURCE_GROUP=<the resource group for the cluster>
109-
export CLUSTER=<the cluter name>
110-
111-
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
112-
```
113-
114-
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).
99+
Specifying `--no-wait --debug` options in az cli command results in the execution of this command asynchronously. For more information, see [how to track asynchronous operations](howto-track-async-operations-cli.md).
115100

116101
## Deleting a metrics configuration
117102

118-
Deletion of the metrics configuration will return the cluster to an unaltered configuration. To delete a metrics configuration, `az rest` API is used.
103+
Deletion of the metrics configuration returns the cluster to an unaltered configuration. To delete a metrics configuration, use the below command:
119104

120-
```sh
121-
export SUBSCRIPTION=<the subscription id for the cluster>
122-
export RESOURCE_GROUP=<the resource group for the cluster>
123-
export CLUSTER=<the cluter name>
124-
125-
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
105+
```azurecli
106+
az networkcloud cluster metricsconfiguration delete \
107+
--cluster-name "<CLUSTER>" \
108+
--resource-group "<RESOURCE_GROUP>"
126109
```
127110

128-
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).
111+
Specifying `--no-wait --debug` options in az cli command results in the execution of this command asynchronously. For more information, see [how to track asynchronous operations](howto-track-async-operations-cli.md).
112+
113+

0 commit comments

Comments
 (0)