Showing posts with label vmware. Show all posts
Showing posts with label vmware. Show all posts

Wednesday, February 26, 2014

How to find VLANs/Portgroups configured in ESXi Standard switch?

Note: Verified for ESXI version 5.1

# esxcli network vswitch standard list vSwitch0 Name: vSwitch0 Class: etherswitch Num Ports: 128 Used Ports: 4 Configured Ports: 128 MTU: 1500 CDP Status: listen Beacon Enabled: false Beacon Interval: 1 Beacon Threshold: 3 Beacon Required By: Uplinks: vmnic0 Portgroups: VM Network, Management Network vSwitch1 Name: vSwitch1 Class: etherswitch Num Ports: 1024 Used Ports: 8 Configured Ports: 1024 MTU: 1500 CDP Status: listen Beacon Enabled: false Beacon Interval: 1 Beacon Threshold: 3 Beacon Required By: Uplinks: vmnic5, vmnic1 Portgroups: VLAN198, NFS vSwitch2 Name: vSwitch2 Class: etherswitch Num Ports: 1024 Used Ports: 17 Configured Ports: 1024 MTU: 1500 CDP Status: listen Beacon Enabled: false Beacon Interval: 1 Beacon Threshold: 3 Beacon Required By: Uplinks: vmnic7, vmnic6, vmnic3, vmnic2 Portgroups: VLAN124, VLAN115, VLAN114, VLAN112, VLAN110, VLAN106, VLAN105, VLAN104, VLAN103, VLAN102, VLAN101, VLAN100, VLAN99, VLAN98, VLAN97, VLAN96, VLAN79, VLAN113, VLAN111, VLAN76, VLAN78

Thursday, May 10, 2012

VMWARE - ESXi 4.0 - command line examples (How-to command line VMware host?)

~ # vim-cmd vmsvc 
Commands available under vmsvc/:
acquiremksticket          get.configoption          power.off
connect                   get.datastores            power.on
convert.toTemplate        get.disabledmethods       power.reboot
convert.toVm              get.environment           power.reset
createdummyvm             get.filelayout            power.shutdown
destroy                   get.guest                 power.suspend
device.connection         get.guestheartbeatStatus  reload
device.connusbdev         get.managedentitystatus   setscreenres
device.disconnusbdev      get.networks              snapshot.create
device.diskadd            get.runtime               snapshot.dumpoption
device.diskaddexisting    get.snapshotinfo          snapshot.get
device.diskremove         get.summary               snapshot.remove
device.getdevices         get.tasklist              snapshot.removeall
device.toolsSyncSet       getallvms                 snapshot.revert
device.vmiadd             gethostconstraints        snapshot.setoption
device.vmiremove          login                     tools.cancelinstall
devices.createnic         logout                    tools.install
get.capability            message                   tools.upgrade
get.config                power.getstate            unregister
get.config.cpuidmask      power.hibernate           upgrade



~ # vim-cmd vmsvc/getallvms 
Vmid     Name                File                  Guest OS      Version   Annotation
64     server101   [local-datastore] server101/server101.vmx   rhel4_64Guest   vmx-07
80     server100   [local-datastore] server100/server100.vmx   rhel4_64Guest   vmx-07




~ # vim-cmd vmsvc/get.guest 80 
Guest information:

(vim.vm.GuestInfo) {
   dynamicType = ,
   toolsStatus = "toolsOk",
   toolsVersionStatus = "guestToolsUnmanaged",
   toolsRunningStatus = "guestToolsRunning",
   toolsVersion = "2147483647",
   guestId = "rhel4_64Guest",
   guestFamily = "linuxGuest",
   guestFullName = "Red Hat Enterprise Linux 4 (64-bit)",
   hostName = "server100",
   ipAddress = ,
   net = (vim.vm.GuestInfo.NicInfo) [
      (vim.vm.GuestInfo.NicInfo) {
         dynamicType = ,
         network = "Primary network",
         ipAddress = (string) [
            "fe80::20c:29ff:fe05:ec55"
         ],
         macAddress = "00:0c:29:05:ec:55",
         connected = true,
         deviceConfigId = 4000,
      },
      (vim.vm.GuestInfo.NicInfo) {
         dynamicType = ,
         network = "NFS Network",
         ipAddress = (string) [
            "fe80::20c:29ff:fe05:ec5f"
         ],
         macAddress = "00:0c:29:05:ec:5f",
         connected = true,
         deviceConfigId = 4001,
      }
   ],
   disk = (vim.vm.GuestInfo.DiskInfo) [
      (vim.vm.GuestInfo.DiskInfo) {
         dynamicType = ,
         diskPath = "/",
         capacity = 12387078144,
         freeSpace = 3344904192,
      },
      (vim.vm.GuestInfo.DiskInfo) {
         dynamicType = ,
         diskPath = "/boot",
         capacity = 1028120576,
         freeSpace = 1001758720,
      },
   ],
   screen = (vim.vm.GuestInfo.ScreenInfo) {
      dynamicType = ,
      width = 720,
      height = 400,
   },
   guestState = "running",
}




~ # vim-cmd vmsvc/power.getstate 80 
Retrieved runtime info
Powered on



~ # vim-cmd vmsvc/get.datastores 80 
name                 vmserv7
url                  /vmfs/volumes/4a7232e5-948e00b5-f42a-18a9054626b0
capacity             145760452608
freeSpace            37782290432
accessible           1
type                 VMFS
multipleHostAccess   



~ # vim-cmd vmsvc/get.networks  80 
Networks:

(vim.Network.Summary) {
   dynamicType = ,
   network = 'vim.Network:HaNetwork-Primary network',
   name = "Primary network",
   accessible = true,
   ipPoolName = "",
}
(vim.Network.Summary) {
   dynamicType = ,
   network = 'vim.Network:HaNetwork-NFS Network',
   name = "NFS Network",
   accessible = true,
   ipPoolName = "",
}


How to find Guest hosts inside VMware ESXi from command line?

~ # vim-cmd vmsvc/getallvms
Vmid     Name                      File                       Guest OS       Version   Annotation
112    server100       [datastore-NFS] server100/server100.vmx   rhel4_64Guest   vmx-07
64     server101-old   [datastore-local] server101/server101.vmx rhel4_64Guest   vmx-07
80     server100-old   [datastore-local] server100/server100.vmx rhel4_64Guest   vmx-07
96     server102       [datastore-NFS] server102/server102.vmx   rhel4_64Guest   vmx-07
Note: This Q&A is good/tested for following release: VMkernel 4.0.0 #1 SMP Release build-171294 x86_64