其他分享
首页 > 其他分享> > 在EXSI Console中利用各种命令获取EXSI的各种配置信息

在EXSI Console中利用各种命令获取EXSI的各种配置信息

作者:互联网

[root@localhost:/bin] ls esxcfg*
esxcfg-advcfg esxcfg-info esxcfg-mpath esxcfg-resgrp esxcfg-vmknic
esxcfg-dumppart esxcfg-init esxcfg-nas esxcfg-route esxcfg-volume
esxcfg-fcoe esxcfg-ipsec esxcfg-nics esxcfg-scsidevs esxcfg-vswitch
esxcfg-hwiscsi esxcfg-module esxcfg-rescan esxcfg-swiscsi

// 查看版本
[root@localhost:/bin] vmware -v
VMware ESXi 6.5.0 build-7388607

// 查看硬件信息
[root@localhost:~] esxcfg-info -a
+Host :
 \==+Hardware Info :
 |----BIOS UUID................................................0x8a 0x68 0x 50 0x87 0xfe 0x3d 0x11 0xe6 0x86 0xbd 0xd0 0x74 0x8 0xec 0x2a 0x20
 |----BIOS Vendor..............................................Lenovo
 |----BIOS Version.............................................PSE517L-1.78
 |----BIOS ReleaseDate.........................................2019-12-20T0 0:00:00
 |----BIOS Asset Tag...........................................none
 |----Product Name.............................................ThinkSystem SR950
 |----Vendor Name..............................................FOXCONN
 |----Serial Number............................................PROT4A1A9E
 |----Hardware Uptime..........................................230707437574 75
 |----Ipmi Supported...........................................true
 |----BMC Version..............................................3.34
 \==+PCI Info :
 \==+All Pci Devices :
 \==+PCI Device :
 |----Segment.........................................0x0000
 |----Bus.............................................0x00
 |----Slot............................................0x00

// 查看当前虚拟交换机的配置
[root@localhost:/bin] esxcfg-vswitch -l
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitch0 10752 37 128 1500 vmnic0


 PortGroup Name VLAN ID Used Ports Uplinks
 VM Network 0 33 vmnic0
 Management Network 0 1 vmnic0


Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitchUSB0 10752 4 128 1500 vusb0


 PortGroup Name VLAN ID Used Ports Uplinks
 IMM_Network0 0 1 vusb0

// 查看EXSI的网卡信息
[root@localhost:/bin] esxcfg-nics -l
Name PCI Driver Link Speed Duplex MAC Address MTU Description
vmnic0 0000:1a:00.0 i40en Up 1000Mbps Full 08:94:ef:3f:ed:xc 1500 Intel(R) Ethernet Connection X722 for 1GbE
vmnic1 0000:1a:00.1 i40en Down 0Mbps Half 08:94:ef:3f:ed:xd 1500 Intel(R) Ethernet Connection X722 for 1GbE
vmnic2 0000:3f:00.0 elxnet Down 0Mbps Half 00:10:9b:16:88:x0 1500 Emulex Corporation Emulex OneConnect OCe14000 NIC
vmnic3 0000:3f:00.1 elxnet Down 0Mbps Half 00:10:9b:16:88:x8 1500 Emulex Corporation Emulex OneConnect OCe14000 NIC
vusb0 Pseudo cdce Up 100Mbps Full 0a:94:ef:3f:ec:xf 1500 IBM XClarity Controller

// 查看磁盘信息
[root@localhost:/bin] ls -l /vmfs/devices/disks
total 20468037685
-rw------- 1 root root 1200243695616 Oct 9 16:44 naa.5000039738391031
-rw------- 1 root root 1200240984576 Oct 9 16:44 naa.5000039738391031:3
-rw------- 1 root root 1200243695616 Oct 9 16:44 naa.5000039738398995
-rw------- 1 root root 134217728 Oct 9 16:44 naa.5000039738398995:1
-rw------- 1 root root 1200107814912 Oct 9 16:44 naa.5000039738398995:2
-rw------- 1 root root 300000000000 Oct 9 16:44 naa.5000039798114b8d
-rw------- 1 root root 134217728 Oct 9 16:44 naa.5000039798114b8d:1
-rw------- 1 root root 299864424448 Oct 9 16:44 naa.5000039798114b8d:2

// 查看某种接口存储设置
[root@localhost:/bin] esxcli storage san sas list
 Device Name: vmhba1
 SAS Address: 60:1e:52:26:0d:e8:a2:31
 Physical ID: 0
 Minimum Link Rate: 0 Mbps
 Maximum Link Rate: 0 Mbps
 Negotiated Link Rate: 0 Mbps
 Model Description:
 Hardware Version:
 OptionROM Version:
 Firmware Version: 50.0.1-0372
 Driver Name: lsi_mr3
 Driver Version: 7.703.51.00

// 直接输入vmsvc去查看有哪些参数
[root@localhost:/bin] vim-cmd vmsvc/
Commands available under vmsvc/:
acquiremksticket get.snapshotinfo
acquireticket get.spaceNeededForConsolidation
createdummyvm get.summary
destroy get.tasklist
device.connection getallvms
device.connusbdev gethostconstraints
...

// 查看已部署了哪些OS,可以利用 vim-cmd, 里面有很多的参数,例如 vmsvc/getallvms
[root@localhost:/bin] vim-cmd vmsvc/getallvms
Skipping invalid VM '307'
Vmid Name File Guest OS Version Annotation
125 MD-1.40 [datastore1] Hasin-GD-1.40/Hasin-GD-1.40.vmx rhel6_64Guest vmx-07
150 CentOS8 [DataStorage-1] Hasin-CentOS8/-CentOS8.vmx coreos64Guest vmx-13
169 Win8.1 [DataStorage-2] Win8-old-1/Win8-old-1.vmx windows8_64Guest vmx-13

// 查看宿主机的网络信息
[root@localhost:/bin] vim-cmd hostsvc/net/vnic_info
(vim.host.VirtualNic) [
 (vim.host.VirtualNic) {
 device = "vmk0",
 key = "key-vim.host.VirtualNic-vmk0",
 portgroup = "Management Network",
 spec = (vim.host.VirtualNic.Specification) {
 dynamicProperty = <unset>,
 ip = (vim.host.IpConfig) {
 dhcp = false,
 ipAddress = "xxx.xxx.xxx.xxx",
 subnetMask = "255.255.254.0",
// 查看某个OS的配置信息,包含IP,power状态等
[root@localhost:/bin] vim-cmd vmsvc/get.summary Vmid

 guest = (vim.vm.Summary.GuestSummary) {
 guestId = "",
 guestFullName = <unset>,
 toolsStatus = "toolsOk",
 toolsVersionStatus = "guestToolsUnmanaged",
 toolsVersionStatus2 = "guestToolsUnmanaged",
 toolsRunningStatus = "guestToolsRunning",
 hostName = "localhost",
 ipAddress = "xxx.xxx.xxx.xxx"
 },

// 如果想查看某个OS的mac地址
[root@localhost:/bin] vim-cmd vmsvc/device.getdevices Vmid

(vim.vm.device.VirtualVmxnet3) {
 dynamicProperty = <unset>,
 key = 4001,
 deviceInfo = (vim.Description) {
 label = "Network adapter 2",
 summary = "VM Network"
 },
 backing = (vim.vm.device.VirtualEthernetCard.NetworkBackingInfo) {
 deviceName = "VM Network",
 useAutoDetect = false,
 network = 'vim.Network:HaNetwork-VM Network',
 inPassthroughMode = <unset>
 },
 connectable = (vim.vm.device.VirtualDevice.ConnectInfo) {
 startConnected = true,
 allowGuestControl = true,
 connected = true,
 status = "ok"
 },
 slotInfo = (vim.vm.device.VirtualDevice.BusSlotInfo) null,
 controllerKey = 100,
 unitNumber = 8,
 addressType = "generated",
 macAddress = "00:0c:29:a6:90:xd",
 wakeOnLanEnabled = true,
 resourceAllocation = (vim.vm.device.VirtualEthernetCard.ResourceAllocation) {
 reservation = 0,
 share = (vim.SharesInfo) {
 shares = 50,
 level = "normal"
 },
 limit = -1
 },
 externalId = <unset>,
 uptCompatibilityEnabled = true
 }

 

 

标签:bin,各种,Console,vim,----,esxcfg,EXSI,root,localhost
来源: https://www.cnblogs.com/dw-gaoshuaiusersec/p/15420467.html