你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
使用 az networkcloud baremetalmachine run-read-command
排查 BMM 问题
在某些情况下,用户可能需要调查并解决本地 BMM 的问题。 运营商关系平台提供了 az networkcloud baremetalmachine run-read-command
,以便用户可以运行精选的只读命令列表,以便从 BMM 获取信息。
该命令执行将会生成一个输出文件,其中包含可在群集管理器的存储帐户中找到的结果。
先决条件
- 安装最新版本的相应 CLI 扩展
- 务必确保目标 BMM 将其
poweredState
设置为On
,并将其readyState
设置为True
- 获取为
Cluster
资源创建的资源组名称
执行 run-read 命令
通过 run-read 命令,可以在 BMM 上运行一个不会更改任何内容的命令。 某些命令包含多个单词,或需要有一个参数才能正常使用。 这些命令的组成将符合如下所述的要求,以便与可以更改内容的命令区分开。 例如,run-read-command 可以使用 kubectl get
,但不能使用 kubectl apply
。 使用这些命令时,必须将所有单词都放在“command”字段中。 例如,{"command":"kubectl get","arguments":["nodes"]}
是正确的;而 {"command":"kubectl","arguments":["get","nodes"]}
则不正确。
另请注意,某些命令以 nc-toolbox nc-toolbox-runread
开头,必须按如下所示进行输入。
nc-toolbox-runread
是一个特殊的容器映像,其中包含未安装在裸机主机上的更多工具,例如 ipmitool
和 racadm
。
某些 run-read 命令需要提供特定的参数以强制实施命令的只读功能。
一个需要特定参数的 run-read 命令的示例是允许的 Mellanox 命令 mstconfig
,这要求提供 query
参数以强制实施只读。
下面的列表显示了可以使用的命令。 *italics*
格式的命令不能有 arguments
;其余的都可以。
arp
brctl show
dmidecode
fdisk -l
host
hostname
ifconfig -a
ifconfig -s
ip address show
ip link show
ip maddress show
ip route show
journalctl
kubectl api-resources
kubectl api-versions
kubectl describe
kubectl get
kubectl logs
mount
ping
ss
tcpdump
traceroute
uname
ulimit -a
uptime
nc-toolbox nc-toolbox-runread ipmitool channel authcap
nc-toolbox nc-toolbox-runread ipmitool channel info
nc-toolbox nc-toolbox-runread ipmitool chassis status
nc-toolbox nc-toolbox-runread ipmitool chassis power status
nc-toolbox nc-toolbox-runread ipmitool chassis restart cause
nc-toolbox nc-toolbox-runread ipmitool chassis poh
nc-toolbox nc-toolbox-runread ipmitool dcmi power get_limit
nc-toolbox nc-toolbox-runread ipmitool dcmi sensors
nc-toolbox nc-toolbox-runread ipmitool dcmi asset_tag
nc-toolbox nc-toolbox-runread ipmitool dcmi get_mc_id_string
nc-toolbox nc-toolbox-runread ipmitool dcmi thermalpolicy get
nc-toolbox nc-toolbox-runread ipmitool dcmi get_temp_reading
nc-toolbox nc-toolbox-runread ipmitool dcmi get_conf_param
nc-toolbox nc-toolbox-runread ipmitool delloem lcd info
nc-toolbox nc-toolbox-runread ipmitool delloem lcd status
nc-toolbox nc-toolbox-runread ipmitool delloem mac list
nc-toolbox nc-toolbox-runread ipmitool delloem mac get
nc-toolbox nc-toolbox-runread ipmitool delloem lan get
nc-toolbox nc-toolbox-runread ipmitool delloem powermonitor powerconsumption
nc-toolbox nc-toolbox-runread ipmitool delloem powermonitor powerconsumptionhistory
nc-toolbox nc-toolbox-runread ipmitool delloem powermonitor getpowerbudget
nc-toolbox nc-toolbox-runread ipmitool delloem vflash info card
nc-toolbox nc-toolbox-runread ipmitool echo
nc-toolbox nc-toolbox-runread ipmitool ekanalyzer print
nc-toolbox nc-toolbox-runread ipmitool ekanalyzer summary
nc-toolbox nc-toolbox-runread ipmitool fru print
nc-toolbox nc-toolbox-runread ipmitool fwum info
nc-toolbox nc-toolbox-runread ipmitool fwum status
nc-toolbox nc-toolbox-runread ipmitool fwum tracelog
nc-toolbox nc-toolbox-runread ipmitool gendev list
nc-toolbox nc-toolbox-runread ipmitool hpm rollbackstatus
nc-toolbox nc-toolbox-runread ipmitool hpm selftestresult
nc-toolbox nc-toolbox-runread ipmitool ime help
nc-toolbox nc-toolbox-runread ipmitool ime info
nc-toolbox nc-toolbox-runread ipmitool isol info
nc-toolbox nc-toolbox-runread ipmitool lan print
nc-toolbox nc-toolbox-runread ipmitool lan alert print
nc-toolbox nc-toolbox-runread ipmitool lan stats get
nc-toolbox nc-toolbox-runread ipmitool mc bootparam get
nc-toolbox nc-toolbox-runread ipmitool mc chassis poh
nc-toolbox nc-toolbox-runread ipmitool mc chassis policy list
nc-toolbox nc-toolbox-runread ipmitool mc chassis power status
nc-toolbox nc-toolbox-runread ipmitool mc chassis status
nc-toolbox nc-toolbox-runread ipmitool mc getenables
nc-toolbox nc-toolbox-runread ipmitool mc getsysinfo
nc-toolbox nc-toolbox-runread ipmitool mc guid
nc-toolbox nc-toolbox-runread ipmitool mc info
nc-toolbox nc-toolbox-runread ipmitool mc restart cause
nc-toolbox nc-toolbox-runread ipmitool mc watchdog get
nc-toolbox nc-toolbox-runread ipmitool bmc bootparam get
nc-toolbox nc-toolbox-runread ipmitool bmc chassis poh
nc-toolbox nc-toolbox-runread ipmitool bmc chassis policy list
nc-toolbox nc-toolbox-runread ipmitool bmc chassis power status
nc-toolbox nc-toolbox-runread ipmitool bmc chassis status
nc-toolbox nc-toolbox-runread ipmitool bmc getenables
nc-toolbox nc-toolbox-runread ipmitool bmc getsysinfo
nc-toolbox nc-toolbox-runread ipmitool bmc guid
nc-toolbox nc-toolbox-runread ipmitool bmc info
nc-toolbox nc-toolbox-runread ipmitool bmc restart cause
nc-toolbox nc-toolbox-runread ipmitool bmc watchdog get
nc-toolbox nc-toolbox-runread ipmitool nm alert get
nc-toolbox nc-toolbox-runread ipmitool nm capability
nc-toolbox nc-toolbox-runread ipmitool nm discover
nc-toolbox nc-toolbox-runread ipmitool nm policy get policy_id
nc-toolbox nc-toolbox-runread ipmitool nm policy limiting
nc-toolbox nc-toolbox-runread ipmitool nm statistics
nc-toolbox nc-toolbox-runread ipmitool nm suspend get
nc-toolbox nc-toolbox-runread ipmitool nm threshold get
nc-toolbox nc-toolbox-runread ipmitool pef
nc-toolbox nc-toolbox-runread ipmitool picmg addrinfo
nc-toolbox nc-toolbox-runread ipmitool picmg policy get
nc-toolbox nc-toolbox-runread ipmitool power status
nc-toolbox nc-toolbox-runread ipmitool sdr elist
nc-toolbox nc-toolbox-runread ipmitool sdr get
nc-toolbox nc-toolbox-runread ipmitool sdr info
nc-toolbox nc-toolbox-runread ipmitool sdr list
nc-toolbox nc-toolbox-runread ipmitool sdr type
nc-toolbox nc-toolbox-runread ipmitool sel elist
nc-toolbox nc-toolbox-runread ipmitool sel get
nc-toolbox nc-toolbox-runread ipmitool sel info
nc-toolbox nc-toolbox-runread ipmitool sel list
nc-toolbox nc-toolbox-runread ipmitool sel time get
nc-toolbox nc-toolbox-runread ipmitool sensor get
nc-toolbox nc-toolbox-runread ipmitool sensor list
nc-toolbox nc-toolbox-runread ipmitool session info
nc-toolbox nc-toolbox-runread ipmitool sol info
nc-toolbox nc-toolbox-runread ipmitool sol payload status
nc-toolbox nc-toolbox-runread ipmitool user list
nc-toolbox nc-toolbox-runread ipmitool user summary
nc-toolbox nc-toolbox-runread racadm arp
nc-toolbox nc-toolbox-runread racadm coredump
nc-toolbox nc-toolbox-runread racadm diagnostics
nc-toolbox nc-toolbox-runread racadm eventfilters get
nc-toolbox nc-toolbox-runread racadm fcstatistics
nc-toolbox nc-toolbox-runread racadm get
nc-toolbox nc-toolbox-runread racadm getconfig
nc-toolbox nc-toolbox-runread racadm gethostnetworkinterfaces
nc-toolbox nc-toolbox-runread racadm getled
nc-toolbox nc-toolbox-runread racadm getniccfg
nc-toolbox nc-toolbox-runread racadm getraclog
nc-toolbox nc-toolbox-runread racadm getractime
nc-toolbox nc-toolbox-runread racadm getsel
nc-toolbox nc-toolbox-runread racadm getsensorinfo
nc-toolbox nc-toolbox-runread racadm getssninfo
nc-toolbox nc-toolbox-runread racadm getsvctag
nc-toolbox nc-toolbox-runread racadm getsysinfo
nc-toolbox nc-toolbox-runread racadm gettracelog
nc-toolbox nc-toolbox-runread racadm getversion
nc-toolbox nc-toolbox-runread racadm hwinventory
nc-toolbox nc-toolbox-runread racadm ifconfig
nc-toolbox nc-toolbox-runread racadm inlettemphistory get
nc-toolbox nc-toolbox-runread racadm jobqueue view
nc-toolbox nc-toolbox-runread racadm lclog view
nc-toolbox nc-toolbox-runread racadm lclog viewconfigresult
nc-toolbox nc-toolbox-runread racadm license view
nc-toolbox nc-toolbox-runread racadm netstat
nc-toolbox nc-toolbox-runread racadm nicstatistics
nc-toolbox nc-toolbox-runread racadm ping
nc-toolbox nc-toolbox-runread racadm ping6
nc-toolbox nc-toolbox-runread racadm racdump
nc-toolbox nc-toolbox-runread racadm sslcertview
nc-toolbox nc-toolbox-runread racadm swinventory
nc-toolbox nc-toolbox-runread racadm systemconfig getbackupscheduler
nc-toolbox nc-toolbox-runread racadm systemperfstatistics
(不允许使用 PeakReset 参数)nc-toolbox nc-toolbox-runread racadm techsupreport getupdatetime
nc-toolbox nc-toolbox-runread racadm traceroute
nc-toolbox nc-toolbox-runread racadm traceroute6
nc-toolbox nc-toolbox-runread racadm usercertview
nc-toolbox nc-toolbox-runread racadm vflashsd status
nc-toolbox nc-toolbox-runread racadm vflashpartition list
nc-toolbox nc-toolbox-runread racadm vflashpartition status -a
nc-toolbox nc-toolbox-runread mstregdump
nc-toolbox nc-toolbox-runread mstconfig
(需要query
参数)nc-toolbox nc-toolbox-runread mstflint
(需要query
参数)nc-toolbox nc-toolbox-runread mstlink
(需要query
参数)nc-toolbox nc-toolbox-runread mstfwmanager
(需要query
参数)nc-toolbox nc-toolbox-runread mlx_temp
命令语法为:
az networkcloud baremetalmachine run-read-command --name <machine-name>
--limit-time-seconds <timeout> \
--commands '[{"command":"<command1>"},{"command":"<command2>","arguments":["<arg1>","<arg2>"]}]' \
--resource-group "<resourceGroupName>" \
--subscription "<subscription>"
可以以 json 格式向 --commands
选项提供多个命令。
对于具有多个参数的命令,请以列表的形式提供给 arguments
参数。 有关构造 --commands
结构的说明,请参阅 Azure CLI 简写。
这些命令可以长时间运行,因此建议将 --limit-time-seconds
设置为至少 600 秒(10 分钟)。 运行多个提取可能需要 10 分钟以上的时间。
此命令将同步运行。 如果要跳过等待命令完成的过程,请指定 --no-wait --debug
选项。 有关详细信息,请参阅如何跟踪异步操作。
提供可选参数 --output-directory
时,输出结果将下载并提取到本地目录。
此示例将执行 hostname
命令和 ping
命令
az networkcloud baremetalmachine run-read-command --name "<bareMetalMachineName>" \
--limit-time-seconds 60 \
--commands '[{"command":"hostname"},{"command":"ping","arguments":["198.51.102.1","-c","3"]}]' \
--resource-group "<resourceGroupName>" \
--subscription "<subscription>"
此示例将执行 racadm getsysinfo -c
命令
az networkcloud baremetalmachine run-read-command --name "<bareMetalMachineName>" \
--limit-time-seconds 60 \
--commands '[{"command":"nc-toolbox nc-toolbox-runread racadm getsysinfo","arguments":["-c"]}]' \
--resource-group "<resourceGroupName>" \
--subscription "<subscription>"
检查命令状态和查看输出
下面显示了示例输出。 为了方便起见,系统将结果的前 4,000 个字符打印到了屏幕上,并提供了指向包含命令执行结果的存储 blob 的短期链接。 你可以使用该链接下载压缩的输出文件 (tar.gz)。
====Action Command Output====
+ hostname
rack1compute01
+ ping 198.51.102.1 -c 3
PING 198.51.102.1 (198.51.102.1) 56(84) bytes of data.
--- 198.51.102.1 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2049ms
================================
Script execution result can be found in storage account:
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
如何在群集管理器存储帐户中查看 az networkcloud baremetalmachine run-read-command
的输出
本指南将介绍如何访问在服务器上执行 az networkcloud baremetalmachine run-read-command
时在群集管理器存储帐户中创建的输出文件。 该文件的名称将在 az rest
状态输出中进行标识。
打开托管服务器的群集的群集管理器托管资源组,然后选择“存储帐户”。
在存储帐户详细信息中,从左侧的导航菜单中选择“存储浏览器”。
在存储浏览器详细信息中,选择“blob 容器”。
选择 baremetal-run-command-output blob 容器。
通过 run-read 命令选择输出文件。 可通过
az rest --method get
命令确定文件名。 此外,“上次修改时间”时间戳将与执行命令的时间一致。你可以从“概述”弹出窗口中管理并下载输出文件。