|
| 1 | +--- |
| 2 | +title: Troubleshoot BMM issues using the `az networkcloud baremetalmachine run-read-command` for Operator Nexus |
| 3 | +description: Step by step guide on using the `az networkcloud baremetalmachine run-read-command` to run diagnostic commands on a BMM. |
| 4 | +author: eak13 |
| 5 | +ms.author: ekarandjeff |
| 6 | +ms.service: azure |
| 7 | +ms.topic: how-to |
| 8 | +ms.date: 03/23/2023 |
| 9 | +ms.custom: template-how-to |
| 10 | +--- |
| 11 | + |
| 12 | +# Troubleshoot BMM issues using the `az networkcloud baremetalmachine run-read-command` |
| 13 | + |
| 14 | +There may be situations where a user needs to investigate & resolve issues with an on-premises BMM. Operator Nexus provides the `az networkcloud baremetalmachine run-read-command` so users can run a curated list of read only commands to get information from a BMM. |
| 15 | + |
| 16 | +The command execution produces an output file containing the results that can be found in the Cluster Manager's Storage account. |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | + |
| 20 | +1. Install the latest version of the |
| 21 | + [appropriate CLI extensions](./howto-install-cli-extensions.md) |
| 22 | +1. Ensure that the target BMM must have its `poweredState` set to `On` and have its `readyState` set to `True` |
| 23 | +1. Get the Resource group name that you created for `Cluster` resource |
| 24 | + |
| 25 | +## Executing a run-read command |
| 26 | + |
| 27 | +The run-read command executes a read-only command on the specified BMM. |
| 28 | + |
| 29 | +The current list of supported commands are: |
| 30 | + |
| 31 | +- `traceroute` |
| 32 | +- `ping` |
| 33 | +- `arp` |
| 34 | +- `tcpdump` |
| 35 | +- `brctl show` |
| 36 | +- `dmidecode` |
| 37 | +- `host` |
| 38 | +- `ip link show` |
| 39 | +- `ip address show` |
| 40 | +- `ip maddress show` |
| 41 | +- `ip route show` |
| 42 | +- `journalctl` |
| 43 | +- `kubectl logs` |
| 44 | +- `kubectl describe` |
| 45 | +- `kubectl get` |
| 46 | +- `kubectl api-resources` |
| 47 | +- `kubectl api-versions` |
| 48 | +- `uname` |
| 49 | +- `uptime` |
| 50 | +- `fdisk -l` |
| 51 | +- `hostname` |
| 52 | +- `ifconfig -a` |
| 53 | +- `ifconfig -s` |
| 54 | +- `mount` |
| 55 | +- `ss` |
| 56 | +- `ulimit -a` |
| 57 | + |
| 58 | +The command syntax is: |
| 59 | + |
| 60 | +```azurecli |
| 61 | +az networkcloud baremetalmachine run-read-command --name "<machine-name>" |
| 62 | + --limit-time-seconds <timeout> \ |
| 63 | + --commands arguments="<arg1>" arguments="<arg2>" command="<command>" --resource-group "<resourceGroupName>" \ |
| 64 | + --subscription "<subscription>" \ |
| 65 | + --debug |
| 66 | +``` |
| 67 | + |
| 68 | +These commands to not require `arguments`: |
| 69 | + |
| 70 | +- `fdisk -l` |
| 71 | +- `hostname` |
| 72 | +- `ifconfig -a` |
| 73 | +- `ifconfig -s` |
| 74 | +- `mount` |
| 75 | +- `ss` |
| 76 | +- `ulimit -a` |
| 77 | + |
| 78 | +All other inputs are required. Multiple commands are each specified with their own `--commands` option. |
| 79 | + |
| 80 | +Each `--commands` option specifies `command` and `arguments`. For a command with multiple arguments, `arguments` is repeated for each one. |
| 81 | + |
| 82 | +`--debug` is required to get the operation status that can be queried to get the URL for the output file. |
| 83 | + |
| 84 | +### This example executes the `hostname` command and a `ping` command. |
| 85 | + |
| 86 | +```azurecli |
| 87 | +az networkcloud baremetalmachine run-read-command --name "bareMetalMachineName" \ |
| 88 | + --limit-time-seconds 60 \ |
| 89 | + --commands command="hostname" \ |
| 90 | + --commands arguments="192.168.0.99" arguments="-c" arguments="3" command="ping" \ |
| 91 | + --resource-group "resourceGroupName" \ |
| 92 | + --subscription "<subscription>" \ |
| 93 | + --debug |
| 94 | +``` |
| 95 | + |
| 96 | +In the response, an HTTP status code of 202 is returned as the operation is performed asynchronously. |
| 97 | + |
| 98 | +## Checking command status and viewing output |
| 99 | + |
| 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 | +``` |
| 105 | + |
| 106 | +Check the status of the operation with the `az rest` command: |
| 107 | + |
| 108 | +```azurecli |
| 109 | +az rest --method get --url <Azure-AsyncOperation-URL> |
| 110 | +``` |
| 111 | + |
| 112 | +Repeat until the response to the URL displays the result of the run-read-command. |
| 113 | + |
| 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. |
| 115 | + |
| 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. |
| 117 | + |
| 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 | +} |
| 134 | +``` |
0 commit comments