ESXi host: esxcli and other useful commands

System related commands
uname -a
vmware -v
vmware -vl
ps -tgs | grep -i <VM-Name>
esxcli vm process list
esxcli system boot device get
esxcli system coredump partition list
esxcli system hostname get
esxcli system account list
esxcli system stats uptime get
esxcli system stats installtime get
echo $(($(esxcli system stats uptime get)/86400000000))
esxcli system hostname set --host=<Hostname without FQDN>
esxcli system hostname set --fqdn=<Rest of the FQDN>
esxcli network ip dns search add --domain=corp.company.com
esxcli system module list
esxcli system process list
esxcli system process stats load get
esxcli system process stats running get
esxcli system secpolicy domain list
esxcli system settings advanced list
esxcli system settings kernel list
esxcli system syslog config get
esxcli system syslog config logger list
esxcli system uuid get
esxcli system version get
esxcli system visorfs get
esxcli system visorfs ramdisk list
esxcli system visorfs tardisk list
esxcli device driver list
esxcli software vib list
esxcli software vib get -n <Product name >
esxcli software vib remove -n  esx-dvfilter-arpspy -n esx-dvfilter-ipv6spy -n esx-dvfilter-maclearn
esxcli software vib install --no-sig-check -v ....... 
esxcli software vib install --depot=/vmfs/volumes/datastore-whatever/patchwhatever
esxcli software vib install -d /tmp/< Product-file >
esxcfg-info
esxcfg-module --list
esxcfg-volume --list
esxcfg-advcfg --list
esxcfg-dumppart --list
vim-cmd vmsvc/getallvms
vim-cmd vmsvc/power.getstate <VM-UUID>
vim-cmd vmsvc/power.on <VM-UUID>
vim-cmd hostsvc/enable_ssh
vim-cmd hostsvc/start_ssh
vim-cmd hostsvc/enable_esx_shell
vim-cmd hostsvc/start_esx_shell
vsish -e get /hardware/cpu/cpuModelName
vim-cmd hostsvc/hosthardware 
vim-cmd hostsvc/hosthardware | grep CPU
esxcli system settings advanced set -i 1 -o "/UserVars/SuppressShellWarning"
esxcli system settings advanced set -o /Mem/ShareForceSalting -i 0
esxcli system maintenanceMode get
esxcli system maintenanceMode set --enable yes
esxcli system maintenanceMode set --enable no
vim-cmd hostsvc/maintenance_mode_enter
vim-cmd hostsvc/maintenance_mode_exit
vim-cmd vmsvc/get.capability <VM-ID>
vim-cmd proxysvc/port_info
vim-cmd solo/querycfgoptdesc
vim-cmd hostsvc/queryconnectioninfo | grep <VM-Name> -A40 -B4
esxcli --debug --formatter=table system version get
vim-cmd vmsvc/device.getdevices <VM-ID>
vim-cmd vmsvc/get.config <VM-ID>
vim-cmd vmsvc/get.environment <VM-ID>
vim-cmd vmsvc/get.runtime <VM-ID>
vim-cmd vmsvc/get.summary <VM-ID>
esxcli system settings advanced list -d
esxcli system settings kernel list -d
esxcli system snmp get | hash | set | test
esxcli vm process kill -t soft -w <WorldID>
esxcli system shutdown reboot --delay=60 --reason="<Whatever>"
esxcli system shutdown reboot -d 60 -r "<Whatever be the reason>"
esxcli system shutdown poweroff --delay=60 --reason="<Whatever>"

/opt/hp/hpssacli/bin/hpssacli controller all show config detail

Network related commands
esxcli network nic list
esxcli network vm list
esxcli network ip interface list
esxcli network ip interface ipv4 get
esxcli network ip route ipv4 list
esxcli network ip neighbor list
esxcli network ip netstack list
esxcli network ip netstack get -N defaultTcpipStack
esxcfg-route
esxcfg-route -l
esxcfg-vswitch -l
esxcfg-vswitch -U vmnic5 vSwitch0   (Removes vmnic5)
esxcfg-vswitch -L vmnic3 vSwitch0   (Adds vmnic3)
esxcfg-vmknic -l
esxcli network ip interface set -e true -i vmk1
esxcli network ip interface set -e true -i vmk2
esxcfg-nics -l
esxcfg-nas --list
esxcli storage nfs list
esxcli network ip dns search list
esxcli network ip dns server list
esxcli network ip dns server add -s <New-DNS-server>
esxcli network firewall ruleset list
esxcli network firewall ruleset rule list
esxcli network ip connection list
esxcli network ip connection list | grep 5671      Useful in checking the TCP connection between the RabbitMQ daemon and the one on the ESXi host
esxcli network ip interface ipv4 set -i vmk0/1 -I <IP-address> -N <Netmask> -P false -t static
esxcli network ip interface ipv4 set --interface-name vmk0/1 --ipv4 <IP-address> --netmask <Netmask> --type static 
esxcli network ip interface set --interface-name=vmk0/1 --mtu=9000
esxcli network vswitch standard list
esxcli network vswitch dvs vmware list
esxcli network nic get -n vmnic0
esxcli network nic stats get --nic-name=vmnic0
esxcli network nic vlan stats get --nic-name=vmnic0
/usr/lib/vmware/vm-support/bin/nicinfo.sh
esxcli network ip dns search add --domain=<dept.>.<company>.com
esxcli network vswitch standard portgroup list
esxcli network vswitch standard portgroup set -p "VM Network" --vlan-id 997
esxcli network ip interface set --mtu=9000 --interface-name=vmk1/2
esxcli network ip interface tag add -i vmk1/2 -t VMotion
esxcli network vswitch standard portgroup policy failover get --portgroup-name=<Portgroup>
esxcli network vswitch standard portgroup policy failover set -p <IP-vmotion1/2> -a vmnic0/1 -s vmnic1/0
esxcli network vswitch standard policy failover get -v vSwitch0
esxcli network vswitch standard portgroup policy failover get -p "Management Network"
esxcli network vswitch standard policy failover set -l iphash -v vSwitch0
esxcli network vswitch standard portgroup policy failover set -p "Management Network" -l iphash
esxcli network vswitch standard policy failover set -l explicit -v vSwitch0
esxcli network vswitch standard policy failover set -l portid -v vSwitch0
esxcli network vswitch standard policy failover set -l mac -v vSwitch0
esxcli network vswitch standard policy failover set -v vSwitch0 --active-uplinks vmnic0,vmnic3
esxcli network vswitch standard policy failover set -v vSwitch0 --active-uplinks vmnic0 --standby-uplinks vmnic3
esxcli network vm list
esxcli network ip ipsec sa list
esxcli network ip set --ipv6-enabled=false
esxcli network ip interface ipv6 set -i vmk0 -d false -r false
esxcli network nic stats get –n vmnic0
vsish -e get /net/pNics/vmnic0/stats                  or vmnic1, vmnic2 or vmnic3
esxcli network nic list | grep Up | cut -d " " -f 1 | xargs -n 1 esxcli network nic stats get -n
tcpdump-uw –i vmk0
tcpdump-uw -i vmk0 icmp
tcpdump-uw –i vmk0 –s 1514 tcp
tcpdump-uw –i vmk0 –s 1514 port not 22 and port not 53
tcpdump-uw -i vmk0 icmp -XX
tcpdump-uw -i vmk0 not port 22 -vvv
pktcap-uw –-vmk vmk0
pktcap-uw –-uplink vmnic0
pktcap-uw --vmk vmk0 --proto 0x01
pktcap-uw --vmk vmk0 --proto 0x01 --capture PortOutput
pktcap-uw --vmk vmk0 --ip 216.239.35.4
pktcap-uw --vmk vmk0 --ip 216.239.35.4 --capture PortOutput
pktcap-uw --vmk vmk0 --tcpport 443
pktcap-uw --switchport <SwitchPortNumber>
pktcap-uw --switchport <SwitchPortNumber> --capture PortOutput
pktcap-uw --capture Drop
net-stats –l
esxcli network vswitch standard policy failover get --vswitch-name=<vSwitch>
ethtool -S vmnic2 | egrep -i 'error|drop'                    For RX error
ethtool -S vmnic0 | grep rx_crc_error
esxcli network nic tso get
esxcli network nic coalesce get
vsish -e get /net/tcpip/instances/defaultTcpipStack/sysctl/_net_inet_tcp_delayed_ack
vmdumper -l
esxcli network ip interface ipv4 set -i vmk0 -I 10.133.72.43 -N 255.255.254.0 --type static
esxcfg-route
esxcfg-route -l
esxcfg-route -a 10.133.72.0/23 10.133.72.1
esxcfg-route -d 10.133.96.0/23 10.133.96.1
esxcli network ip route ipv4 add --gateway 10.133.72.1 --network 10.133.72.0/23
esxcli network ip route ipv4 list
esxcli network ip route ipv4 remove --gateway 10.133.96.1 --network 10.133.96.0/23
esxcli network ip route ipv4 remove -n 10.133.96.0/23 -g 10.133.96.1
esxcfg-route -l
esxcli software vib get -n net-e1000e
esxcli software vib get -n net-ixgbe
esxcli network vm list
esxcli network vm port list --world-id=<World-ID>
esxcli network port filter stats get --portid=<Port-ID> 
esxcli network diag ping --ipv4 --host=<Host-IP> --size=9000
vim-cmd hostsvc/net/query_networkhint --pnic-name=vmnic2
vim-cmd hostsvc/net/query_networkhint --pnic-name=vmnic2 |  egrep "location|mgmtAddr|softwareVersion|systemName|hardware|vlan|portId|port|ipSubnet"
vim-cmd vmsvc/getallvms    (for VM IDs)
vim-cmd vmsvc/get.networks <VM-ID>
esxcli network switch standard policy shaping get -v vSwitch0
esxcli network switch standard policy security get -v vSwitch0
esxcli network switch standard policy failover get -v vSwitch0
esxcli network vswitch dvs vmware lacp config get
esxcli network vswitch dvs vmware lacp status get
esxcli network vswitch dvs vmware lacp stats get
esxcli network nic ring preset get -n vmnic0/1/2/3/4/5
esxcli network nic down -n vmnic2
esxcli network nic up -n vmnic2
esxcli system module get --module=ixgbe
esxcli system module get --module=ixgben
Storage related commands
esxcli storage nmp device list
esxcli storage vmfs snapshot list
esxcli storage nmp satp list
esxcli storage nmp psp list
esxcli storage core device list
esxcli storage core path list
esxcli storage nfs list
esxcli storage nfs add -H <NFS-Storage-IP> | <NFS-hostname> -s <Share-mount-point-on-the-NFS-storage> -v <Datastore-name>
esxcli storage nfs remove -v <Datastore-name>
esxcfg-nas --list
esxcli storage core adapter list | grep fc | awk ‘{print $4}’
esxcli storage core device partition list
esxcli storage core device stats get
esxcli storage core path stats get
esxcli storage vmfs extent list
esxcli storage vmfs unmap -l <Datastore-LUN>
esxcli storage filesystem list
esxcli storage san fc list
esxcli storage san fc events get
esxcli storage san iscsi list
esxcli storage san sas list
esxcli storage core device world list
esxcfg-scsidevs –l
esxcfg-scsidevs –m
ls -altr /vmfs/devices/disks
esxcfg-mpath –b
esxcfg-mpath --list
esxcli storage core device vaai status get
esxcli storage nmp satp set --default-psp VMW_PSP_RR --satp <youre_satp_policy>
esxcli storage core claimrule list -c all
esxcli storage core adapter rescan --all
esxcli storage core adapter rescan --adapter vmhba4
vim-cmd vmsvc/get.datastores <VM-ID>
vdq -iH
vdq -qH
esxcli vsan cluster unicastagent list
esxcli vsan cluster get
vim-cmd hostsvc/storage/diagnostic/query_available
vim-cmd hostsvc/queryconnectioninfo | grep DataStoreInfo -A20
vim-cmd hostsvc/datastore/listsummary esxcli iscsi adapter list
esxcli iscsi adapter auth chap get --adapter=vmhba64
esxcli iscsi adapter capabilities get --adapter=vmhba64
esxcli iscsi adapter discovery sendtarget list
esxcli iscsi adapter param get --adapter=vmhba64
esxcli iscsi logicalnetworkportal list
esxcli iscsi physicalnetworkportal list
esxcli iscsi plugin list 
voma -m vmfs -f check -d /vmfs/devices/disks

Hardware related commands
lspci
lspci | grep Network
esxcli network nic list
esxcfg-nics -l
esxcli hardware cpu list
esxcli hardware memory get
esxcli hardware pci list
esxcli hardware platform get
esxcfg-dumppart --list
vsish -e get /hardware/cpu/cpuModelName
vim-cmd hostsvc/hosthardware 
vim-cmd hostsvc/queryconnectioninfo | grep memorySize -A8
vim-cmd hostsvc/hosthardware | grep CPU
esxcli iscsi adapter list
esxcli storage core adapter list
esxcli storage san fc list
esxcli storage san fc events get
esxcfg-scsidevs --list
esxcfg-scsidevs --vmfs
esxcfg-mpath --list-map
esxcfg-mpath --list-paths
esxcli fcoe adapter list
esxcli fcoe nic list
esxcli hardware usb passthrough device list
esxcli hardware ipmi sel list
esxcli hardware ipmi sdr list
esxcli hardware ipmi fru list
esxcli hardware smartcard info get
esxcli hardware smartcard slot list
smbiosDump | grep -B 13 "Memory" | egrep "Location|Manufacturer|Serial|Part|Size|Speed"

VAAI related commands
To check on the VAAI Plugin install:
esxcli software vib list | grep -i vaai
esxcli software vib get -n <Product name>

To install:
esxcli software vib install -d /tmp/<Product name>

To view whether VAAI is enabled or disabled, run the following commands.  If the value that is returned is 0, VAAI is disabled.   If the value returned is 1, VAAI is enabled.

esxcfg-advcfg -g /DataMover/HardwareAcceleratedMove
esxcfg-advcfg -g /DataMover/HardwareAcceleratedInit
esxcfg-advcfg -g /VMFS3/HardwareAcceleratedLocking

To enable VAAI for a dedicated primitive, use the option -s 1:

esxcfg-advcfg -s 1 /DataMover/HardwareAcceleratedMove
esxcfg-advcfg -s 1 /DataMover/HardwareAcceleratedInit
esxcfg-advcfg -s 1 /VMFS3/HardwareAcceleratedLocking

To disable VAAI for a dedicated primitive, use the option -s 1:

esxcfg-advcfg -s 0 /DataMover/HardwareAcceleratedMove
esxcfg-advcfg -s 0 /DataMover/HardwareAcceleratedInit
esxcfg-advcfg -s 0 /VMFS3/HardwareAcceleratedLocking

Use this command to check on the VAAI status:
esxcli storage core device vaai status get

Troubleshooting possibilities
esxcli network ip connection list
esxcli network ip neighbor list
tcpdump-uw -c 5 -n -i vmk0 host <IP-address> and port 443
esxcli network diag ping -s 9000 -H <IP-address>
traceroute <IP-address>


Commonly used Networking commands
vmware -vl
esxcli network ip interface list
esxcli network nic list
esxcli network vm list
esxcli network ip interface ipv4 get
esxcli network ip route ipv4 list
esxcli network ip neighbor list
esxcli network ip neighbor list -i vmk3
esxcli network ip connection list
esxcli network vswitch standard list
esxcli network vswitch dvs vmware list
esxcli network nic get -n vmnic0
esxcli network nic get -n vmnic1
esxcli network nic get -n vmnic2
esxcli network nic get -n vmnic3
esxcli network nic stats get --nic-name=vmnic0
esxcli network nic vlan stats get --nic-name=vmnic0
esxcli network vswitch standard portgroup list
esxcli network ip ipsec sa list
net-stats -l
tcpdump-uw -i vmk0
pktcap-uw --vmk vmk0
pktcap-uw --uplink vmnic0
cat /var/log/shell.log          for showing History of commands
ethtool -S vmnic0
lspci | grep -i network




No comments:

Post a Comment