Esxi Commands-1

Version:

  • vmware-vl       | Check the version and build number of ESXi host. 

VM Commands

  • vm-support -V | List all the VM registered on host and the power state
  • vim-cmd vmsvc/getallvms | list all the VM running with the VMID
  • vmsvc/power.getstate <Vmid>Get the power state of the VM using VMID
  • vim-cmd vmsvc/unregister 240 | Unregister a VM  ; 240 is a VMID, you can get the VMID from command“vim-cmd vmsvc/getallvms”
  • vim-cmd solo/registervm pathto.vmx | Register a VM

 Services

  • ./sbin/services.sh restart       | Restart all management agents on the host
  • ./etc/init.d/hostd restart        | Restart hostd service , To verify the status of hostd services you can check hostd.log under /var/log/ with the keyword : BEGIN SERVICES
  • /etc/init.d/mgmt-vmware status | Check vpxa service
  • /etc/init.d/sshd restart        |Restart a SSH service

 

ESX Storage commands:

  • esxcli storage core path list | Generates a list of all LUN paths currently connected to the ESX host.
  • esxcli storage core device list | Generates a list of LUNS currently connected to the ESX host.
  • esxcli storage vmfs extent list | Generates a list of extents for each volume as well as providing the mapping from device name to UUID.
  • esxcli storage filesystem list | Generates a compact list of the LUNs currently connected to the ESXi host, including VMFS version.
  •  ls -alh /vmfs/devices/disks | Lists the possible targets for certain storage operations.
  • esxcli storage core device smart get -d ` ls /dev/disks/|egrep -v “:|vml|naa|eui”` | grep -i health | Command to check the health of SATA-DOM
  • ./smartinfo.sh under /usr/lib/vmware/vm-support/bin | Display physical disk statistics like smartctl

 

Esxtop

esxtop Changing views is easy type the following keys for the associated views:

  •      c = cpu
  •      m = memory
  •      n = network
  •      i = interrupts
  •      d = disk adapter
  •      u = disk device (includes NFS as of 4.0 Update 2)
  •      v = disk VM
  •      p = power states
  •      V = only show virtual machine worlds
  •      e = Expand/Rollup CPU statistics, show details of all worlds associated with group (GID)”
  •      k = kill world, for tech support purposes only!
  •      l = limit display to a single group (GID), enables you to focus on one VM”
  •      # = limiting the number of entities, for instance the top 5
  •      2 = highlight a row, moving down”
  •      8 = highlight a row, moving up”
  •      4 = remove selected row from view
  •      e = statistics broken down per world
  •      6 = statistics broken down per world

 

ESXi upgrade or Drivers installation:

  • esxcli software vib update –depot /vmfs/volumes/<dataStoreName>/<folderName>/zipfile.zip    | Install the vib ,Update Switch will Update installed VIBs to newer VIB packages. No new VIBs will be installed, only updates or esxcli software vib update -d /vmfs/volumes/<dataStoreName>/<folderName>/zipfile.zip. 
  • esxcli software vib remove -n <name of the vib to be uninstalled> –dry-run | Run the commnd to see what result would be expected ,before installing updates or upgrading drivers
  • esxcli software vib remove -n <name of the vib to be uninstalled>  | Removes VIB packages from the host
  • esxcli software vib list | grep -i megaraid   | Command to list the VIB installed and use grep to filter

 

Logs Location to verify network/storage/Drivers/Memory/CPU issue in ESXi

  • https://kb.vmware.com/kb/1021806  | KB to find the location of log files for VMware products
  • grep vmnic /var/log/vmkernel.log | grep Link        > Check Vmkernal logs to see if there was link down [ ESXi log ]
  • grep vmnic /var/log/vobd.log | grep -i down           >Check VOBD logs to see if there was link down [ ESXi log ]

ESXi Keys

  • ALT-F1 = Switches to the console
  • ALT-F2 = Switches to the DCUI
  • ALT-F11 = Returns to the banner screen
  • ALT-F12 = Displays the VMkernel log on the console
  • SHIFT+ O = edit bootcfg during boot.

Firewall commands

  • esxcli network firewall set –enabled true    | Command to enable firewall in ESXi
  • esxcli network firewall set –enabled false   | Command to disable firewall in ESXi

 

Advertisements