Viewing VMWare ESX server configuration data from the command line


While poking around the ESX 3.0 service console last week, I came across the amazingly useful esxcfg-info utility. This utility can be used to extract statistics and configuration data for the network devices, hardware and storage that are attached to a server. To view the network configuration, you can invoke esxcfg-info with the “-n” option:

$ esxcfg-info -n |more

+NetworkInfoImpl :
==+Network Entities:
==+ConsoleNicInfoImpl :
==+Console Nics:
==+VnicImpl :
|----Name............................................vswif0
|----Port Group......................................portgroup0
|----Port Id.........................................16777219
|----Enabled.........................................true
|----Ip Address......................................10.1.1.50
|----Ip Netmask......................................255.255.255.0
|----Ip Broadcast....................................10.1.1.255
|----DHCP............................................false
|----MAC Address.....................................00:50:56:48:2e:d3
|----MTU.............................................1500
==+DnsConfig :
|----Hostname..............................................foo01
|----Domain................................................
|----Search List...........................................
|----Primary Name Server...................................10.1.1.28
|----Secondary Name Server.................................10.1.1.26
==+RoutingInfoImpl :
|----Kernel Gateway........................................10.1.1.1
|----Console Gateway.......................................10.1.1.1
|----Console Gateway Device................................vswif0

[ ..... ]

To view the hardware present in a server, esxcfg-info can be invoked with the “-w” option:

$ esxcfg-info -w |more

+HardwareInfoImpl :
|----BIOS UUID...................................................0x66 0x9d 0x71 0xf4 0xaa 0x38 0x11 0xd9 0xae 0x6c 0x0 0x30
0x6e 0xc 0x67 0x4d
==+PciInfoImpl :
==+All Pci Devices:
==+PciDeviceImpl :
|----Bus................................................0x00
|----Slot...............................................0x06
|----Function...........................................0x00
|----Vendor Id..........................................0x1022
|----Device Id..........................................0x7460
|----Sub-Vendor Id......................................0x0000
|----Sub-Device Id......................................0x0000
|----Vendor Name........................................Advanced Micro Devices [AMD]
|----Device Name........................................AMD-8111 PCI
|----Device Class.......................................1540
|----PIC Line...........................................255
|----Service Console IRQ................................255
|----Vector.............................................0
|----PCI Pin............................................0
|----Spawned Bus........................................1
|----Flags..............................................258
|----Module Id..........................................0
|----Chassis............................................0
|----Physical Slot......................................0
|----VmKernel Device Name...............................

[ ..... ]

And for all of the storage folks out there, esxcfg-info provides the “-s” option to print the storage configuration:

$ esxcfg-info -s |more

+StorageInfoImpl :
==+DiagnosticPartition :
==+DiskLunPartition :
|----Name.....................................................vmhba0:0:0:7
|----Start Sector.............................................143155278
|----End Sector...............................................143364060
|----Partition Type...........................................252
|----Console Device.........................................../dev/sda7
|----Size.....................................................106896384
==+Scsi Stats :
|----Commands : ...........................................0
|----Blocks Read: .........................................0
|----Blocks Written: ......................................0
|----Aborts: ..............................................0
|----Resets: ..............................................0
|----Read Operations: .....................................0
|----Write Operations: ....................................0
|----PAE commands: ........................................0
|----PAE copies: ..........................................0
|----Split commands: ......................................0
|----Split copies: ........................................0
|----Issue Time: ..........................................0
|----Total Time: ..........................................0
|----IsActive.................................................true

[ ..... ]

There are some other useful options, but I will let folks investigate those when they play around with this super useful utility.

This article was posted by Matty on 2006-07-02 11:26:00 -0400 -0400