[go: up one dir, main page]

0% found this document useful (0 votes)
213 views14 pages

ESX 5 Esxcli Cheat Sheet

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
213 views14 pages

ESX 5 Esxcli Cheat Sheet

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

ESX 5.

5 Cheat Sheet using esxcli


https://ervikrant06.wordpress.com/2014/07/16/esx-5-5-cheat-sheet-part-1/

While working on various ESXi related issue I found strong need to get familiar with ESXi
commands. In this article I am going to show the basic usage of those commands with output.
esxcfg-* commands are also available for same purpose but I found esxcli command more
useful for my use.

I have issued these commands on ESXi 5.5.0. Covering System and Hardware Part here.

***********************************SYSTEM********************************
*************

How to get ESXi version information?

~ # esxcli system version get


Product: VMware ESXi
Version: 5.5.0
Build: Releasebuild-1623387
Update: 1

How to get the uuid?

~ # esxcli system uuid get


53bf0f5e-5b22-8964-2574-000c29f89b93

How to get the hostname ? 

~ # esxcli system hostname get


Domain Name: ganesh.com
Fully Qualified Domain Name: esx1.ganesh.com
Host Name: esx1

How to check the Load on server ? we can also use “uptime” for same 

~ # esxcli system process stats load get


Load1Minute: 0.02
Load15Minutes: 0.03
Load5Minutes: 0.02

How Many processes are running on ESXi ?

~ # esxcli system process stats running get


Running Processes: 405
How to get the boot device information for ESXi?

~ # esxcli system boot device get


Boot Filesystem UUID: 5bba5c75-aadf80d0-d554-c0ac58729550
Boot NIC:
Stateless Boot NIC:

How to see the coredump device used to capture dump ?

~ # esxcli system coredump file list


Path Active Configured Size
——————————————————————————————————-
—— ———- ———
/vmfs/volumes/53c033b3-b6a7b6f3-e8bf-000c29f89b93/vmkdump/564D3C1B-1B4F-DD7B-
61A7-737834F89B93.dumpfile true true 119537664

How to see the coredump partition information ?

~ # esxcli system coredump partition list


Name Path Active Configured
————————————————————————–
———————————————————————————————- —— ———-
t10.ATA_____VMware_Virtual_IDE_Hard_Drive___________00000000000000000001:7 /
vmfs/devices/disks/t10.ATA_____VMware_Virtual_IDE_Hard_Drive___________0000000
0000000000001:7 true true

How to list the loaded module? Partial output is shown.

~ # esxcli system module list


Name Is Loaded Is Enabled
—————————– ——— ———-
vmkernel true true
chardevs true true
user true true
vmkapi_socket true true
procfs true true
procMisc true true

How to see the information related to particular Module ?

~ # esxcli system module get -m swapobj


Module: swapobj
Module File: /usr/lib/vmware/vmkmod/swapobj
License: VMware
Version:
Signed Status: VMware Signed
Signature Issuer: VMware, Inc.
Signature Digest: 7308 1040 f1ab 8d96 07c0 0a51 eef7 3fd4 a836 01a1 0341 fc15 21bd 97da
ce61 6073
Signature FingerPrint: cb44 247a 1614 cea1 2079 362d ec86 9d0e
Provided Namespaces: com.vmware.swapobj@0
Required Namespaces: com.vmware.vmkapi@v2_2_0_0,
com.vmware.vmkapi.incompat@v2_2_0_0, com.vmware.vmklinkmpi@0,
com.vmware.vsanPrivate@0.0.0.1

How to see the log rotation policies ?

~ # esxcli system syslog config get


Default Network Retry Timeout: 180
Local Log Output: /scratch/log
Local Log Output Is Configured: false
Local Log Output Is Persistent: true
Local Logging Default Rotation Size: 1024
Local Logging Default Rotations: 8
Log To Unique Subdirectory: false
Remote Host: <none>

How to see special purpose file systems?

~ # esxcli system visorfs ramdisk list


Ramdisk Name System Include in Coredumps Reserved Maximum Used Peak Used Free
Reserved Free Maximum Inodes Allocated Inodes Used Inodes Mount Point
———— —— ——————– ——— ———- ——– ——— —- ————- ————–
—————- ———– —————————
root true true 32768 KiB 32768 KiB 460 KiB 468 KiB 98 % 98 % 8192 4096 3559 /
etc true true 28672 KiB 28672 KiB 180 KiB 212 KiB 99 % 99 % 4096 1024 463 /etc
tmp false false 2048 KiB 196608 KiB 8 KiB 232 KiB 99 % 99 % 8192 256 4 /tmp
hostdstats false false 0 KiB 84992 KiB 1784 KiB 1784 KiB 97 % 0 % 8192 32 4
/var/lib/vmware/hostd/stats

******************************************HARDWARE*********************
********************

How to list the CPU information related to ESXi?

~ # esxcli hardware cpu global get


CPU Packages: 1
CPU Cores: 2
CPU Threads: 2
Hyperthreading Active: false
Hyperthreading Supported: false
Hyperthreading Enabled: true
HV Support: 3
HV Replay Capable: false
HV Replay Disabled Reasons: incompatible CPU
How to list the details information related to each core ?

~ # esxcli hardware cpu list


CPU:0
Id: 0
Package Id: 0
Family: 6
Model: 60
Type: 0
Stepping: 3
Brand: GenuineIntel
Core Speed: 3400060000
Bus Speed: 66000000
APIC ID: 0x0
Node: 0
L2 Cache Size: 262144
L2 Cache Associativity: 8
L2 Cache Line Size: 64
L2 Cache CPU Count: 2
L3 Cache Size: 8388608
L3 Cache Associativity: 16
L3 Cache Line Size: 64
L3 Cache CPU Count: 2

CPU:1
Id: 1
Package Id: 0
Family: 6
Model: 60
Type: 0
Stepping: 3
Brand: GenuineIntel
Core Speed: 3400060000
Bus Speed: 66000000
APIC ID: 0x1
Node: 0
L2 Cache Size: 262144
L2 Cache Associativity: 8
L2 Cache Line Size: 64
L2 Cache CPU Count: 2
L3 Cache Size: 8388608
L3 Cache Associativity: 16
L3 Cache Line Size: 64
L3 Cache CPU Count: 2
How to check the physical memory present ?

~ # esxcli hardware memory get


Physical Memory: 4294430720 Bytes
Reliable Memory: 0 Bytes
NUMA Node Count: 1

How to Check the Hardware Clock ?

~ # esxcli hardware clock get


2014-07-15T18:30:34Z

How to list PCI devices connected ?

~ # esxcli hardware pci list | more


000:000:00.0
Address: 000:000:00.0
Segment: 0x0000
Bus: 0x00
Slot: 0x00

Most useful command to check the serial number of physical server and other


related  information to HW.

~ # smbiosDump.

********************NIC and IP information********************

How Many NIC are present on server? Another command to do same work ~ # esxcfg-
nics -l

~ # esxcli network nic list


Name PCI Device Driver Link Speed Duplex MAC Address MTU Description
—— ————- —— —- —– —— —————– —-
————————————————————–
vmnic0 0000:002:00.0 e1000 Up 1000 Full 00:0c:29:f8:9b:93 1500 Intel Corporation
82545EM Gigabit Ethernet Controller (Copper)
vmnic1 0000:002:03.0 e1000 Up 1000 Full 00:0c:29:f8:9b:9d 1500 Intel Corporation
82545EM Gigabit Ethernet Controller (Copper)
vmnic2 0000:002:04.0 e1000 Up 1000 Full 00:0c:29:f8:9b:a7 1500 Intel Corporation
82545EM Gigabit Ethernet Controller (Copper)

How to see the network statistics of particular NIC ?

~ # esxcli network nic stats get -n vmnic0


NIC statistics for vmnic0
Packets received: 371
Packets sent: 181
Bytes received: 35047
Bytes sent: 30559
Receive packets dropped: 0
Transmit packets dropped: 0
Total receive errors: 0
Receive length errors: 0
Receive over errors: 0
Receive CRC errors: 0
Receive frame errors: 0
Receive FIFO errors: 0
Receive missed errors: 0
Total transmit errors: 0
Transmit aborted errors: 0
Transmit carrier errors: 0
Transmit FIFO errors: 0
Transmit heartbeat errors: 0
Transmit window errors: 0

Use the below logic to get the network statistics of all packages.

~ # for i in `esxcli network nic list | awk ‘{print $1}’ | sed ‘1,2d’`
> do
> esxcli network nic stats get -n $i
> done

How to see the DNS server?

~ # esxcli network ip dns server list


DNSServers: 192.168.111.10

Result of DNS search operation?

~ # esxcli network ip dns search list


DNSSearch Domains: ganesh.com, localdomain

How to see the routing information?

~ # esxcli network ip route ipv4 list


Network Netmask Gateway Interface Source
————- ————- ————- ——— ——
default 0.0.0.0 192.168.111.1 vmk0 MANUAL
192.168.111.0 255.255.255.0 0.0.0.0 vmk0 MANUAL
192.168.112.0 255.255.255.0 0.0.0.0 vmk1 MANUAL

Another command to check the status of NIC present on server?

~ # esxcli network ip interface list


vmk0
Name: vmk0
MAC Address: 00:0c:29:f8:9b:93
Enabled: true
Portset: vSwitch0
Portgroup: Management Network
Netstack Instance: defaultTcpipStack
VDS Name: N/A
VDS UUID: N/A
VDS Port: N/A
VDS Connection: -1
MTU: 1500
TSO MSS: 65535
Port ID: 33554436

vmk1
Name: vmk1
MAC Address: 00:50:56:6f:57:99
Enabled: true
Portset: vSwitch1
Portgroup: StorageNW
Netstack Instance: defaultTcpipStack
VDS Name: N/A
VDS UUID: N/A
VDS Port: N/A
VDS Connection: -1
MTU: 1500
TSO MSS: 65535
Port ID: 50331652

vmk2
Name: vmk2
MAC Address: 00:50:56:78:eb:70
Enabled: true
Portset: vSwitch2
Portgroup: VMkernel
Netstack Instance: defaultTcpipStack
VDS Name: N/A
VDS UUID: N/A
VDS Port: N/A
VDS Connection: -1
MTU: 1500
TSO MSS: 65535
Port ID: 67108868

How to see active connections to server?

~ # esxcli network ip connection list


Proto Recv Q Send Q Local Address Foreign Address State World ID CC Algo World Name
—– —— —— —————————— ——————- ———– ——– ——- —————
tcp 0 0 127.0.0.1:8307 127.0.0.1:32391 ESTABLISHED 33923 newreno hostd-worker
tcp 0 0 127.0.0.1:32391 127.0.0.1:8307 ESTABLISHED 33980 newreno rhttpproxy-work
tcp 0 0 127.0.0.1:443 127.0.0.1:22793 ESTABLISHED 33982 newreno rhttpproxy-work
tcp 0 0 127.0.0.1:22793 127.0.0.1:443 ESTABLISHED 38692 newreno python
tcp 0 0 127.0.0.1:5988 127.0.0.1:29238 FIN_WAIT_2 34764 newreno sfcb-HTTP-Daemo
tcp 0 0 127.0.0.1:29238 127.0.0.1:5988 CLOSE_WAIT 33913 newreno hostd-worker
tcp 0 0 127.0.0.1:5988 127.0.0.1:11160 TIME_WAIT 0
tcp 0 0 127.0.0.1:10181 127.0.0.1:8307 TIME_WAIT 0
tcp 0 0 127.0.0.1:59698 127.0.0.1:443 TIME_WAIT 0

How to check the neighbor information?

~ # esxcli network ip neighbor list


Neighbor Mac Address Vmknic Expiry State Type
————- —————– —— ——– —– ——-
192.168.111.1 00:50:56:c0:00:08 vmk0 1191 sec Unknown
192.168.112.9 00:0c:29:5d:74:7a vmk1 930 sec Unknown

*******************************VSwitch*****************************

How to see the standard vswitch information ?

~ # esxcli network vswitch standard list


vSwitch0
Name: vSwitch0
Class: etherswitch
Num Ports: 1536
Used Ports: 5
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: 1536
Used Ports: 4
Configured Ports: 128
MTU: 1500
CDP Status: listen
Beacon Enabled: false
Beacon Interval: 1
Beacon Threshold: 3
Beacon Required By:
Uplinks: vmnic1
Portgroups: VMkernel
How to check the port Groups present on server ?

~ # esxcli network vswitch standard portgroup list


Name Virtual Switch Active Clients VLAN ID
—————— ————– ————– ——-
Management Network vSwitch0 1 0
StorageNW vSwitch1 1 0
VM Network vSwitch0 1 0

~ # esxcfg-vswitch -l
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitch0 1536 5 128 1500 vmnic0

PortGroup Name VLAN ID Used Ports Uplinks


VM Network 0 1 vmnic0
Management Network 0 1 vmnic0

Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitch1 1536 4 128 1500 vmnic1

PortGroup Name VLAN ID Used Ports Uplinks


StorageNW 0 1 vmnic1

Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitch2 1536 4 128 1500 vmnic2

PortGroup Name VLAN ID Used Ports Uplinks


VMkernel 0 1 vmnic2

******************************ISCSI information
******************************

How to see the iscsi adapter information ?

~ # esxcli iscsi adapter list


Adapter Driver State UID Description
——- ——— —— ———————————— ———————-
vmhba33 iscsi_vmk online iqn.1998-01.com.vmware:esx1-6aa0b3dc iSCSI Software Adapter

How to get the attributes of adapter ?

~ # esxcli iscsi adapter get -A vmhba33


vmhba33
Name: iqn.1998-01.com.vmware:esx1-6aa0b3dc
Alias:
Vendor: VMware
Model: iSCSI Software Adapter
Description: iSCSI Software Adapter
Serial Number:
Hardware Version:
Asic Version:
Firmware Version:
Option Rom Version:
Driver Name: iscsi_vmk
Driver Version:
TCP Protocol Supported: false
Bidirectional Transfers Supported: false
Maximum Cdb Length: 64
Can Be NIC: false
Is NIC: false
Is Initiator: true
Is Target: false
Using TCP Offload Engine: false
Using ISCSI Offload Engine: false

How to Check the iqn detail for ISCSI server?

~ # esxcli iscsi adapter target list


Adapter Target Alias Discovery Method Last Error
——- —————————————— —– —————- ———-
vmhba33 iqn.2006-01.com.openfiler:tsn.99dbad416dbd STATIC No Error

How to see the IP address of SAN server ?

~ # esxcli iscsi adapter target portal list


Adapter Target IP Port Tpgt
——- —————————————— ————- —- —-
vmhba33 iqn.2006-01.com.openfiler:tsn.99dbad416dbd 192.168.112.9 3260 1

Command to check the information related to connection between iscsi target


and initiator ?

~ # esxcli iscsi session connection list


vmhba33,iqn.2006-01.com.openfiler:tsn.99dbad416dbd,00023d000002,0
Adapter: vmhba33
Target: iqn.2006-01.com.openfiler:tsn.99dbad416dbd
ISID: 00023d000002
CID: 0
DataDigest: NONE
HeaderDigest: NONE
IFMarker: false
IFMarkerInterval: 0
MaxRecvDataSegmentLength: 131072
MaxTransmitDataSegmentLength: 131072
OFMarker: false
OFMarkerInterval: 0
ConnectionAddress: 192.168.112.9
RemoteAddress: 192.168.112.9
LocalAddress: 192.168.112.10
SessionCreateTime: 07/15/14 18:00:07
ConnectionCreateTime: 07/15/14 18:00:07
ConnectionStartTime: 07/15/14 18:00:07
State: logged_in

How to see the physical adapters used for adapter?

~ # esxcli iscsi physicalnetworkportal list


Adapter Vmnic MAC Address MAC Address Valid Current Speed Max Speed Max Frame
Size
——- —— —————– —————– ————- ——— ————–
vmhba33 vmnic0 00:0c:29:f8:9b:93 true 1000 1000 1500
vmhba33 vmnic1 00:0c:29:f8:9b:9d true 1000 1000 1500
vmhba33 vmnic2 00:0c:29:f8:9b:a7 true 1000 1000 1500

How to see the Logical adapters used for adapter?

~ # esxcli iscsi logicalnetworkportal list


Adapter Vmknic MAC Address MAC Address Valid Compliant
——- —— —————– —————– ———
vmhba33 vmk0 00:0c:29:f8:9b:93 true true
vmhba33 vmk1 00:50:56:6f:57:99 true true
vmhba33 vmk2 00:50:56:78:eb:70 true true

**************************Storage*************************

~ # esxcli storage vmfs extent list


Volume Name VMFS UUID Extent Number Device Name Partition
———— ———————————– ————- ——————- ———
esx1:local-1 53c033b3-b6a7b6f3-e8bf-000c29f89b93 0 mpx.vmhba1:C0:T0:L0 1

~ # esxcli storage filesystem list


Mount Point Volume Name UUID Mounted Type Size Free
————————————————- ———— ———————————– ——-
—— ———– ———–
/vmfs/volumes/53c033b3-b6a7b6f3-e8bf-000c29f89b93 esx1:local-1 53c033b3-b6a7b6f3-
e8bf-000c29f89b93 true VMFS-5 42681237504 27310161920
/vmfs/volumes/5bba5c75-aadf80d0-d554-c0ac58729550 5bba5c75-aadf80d0-d554-
c0ac58729550 true vfat 261853184 96395264
/vmfs/volumes/f437c379-825b7d55-84bd-fce072eded7b f437c379-825b7d55-84bd-
fce072eded7b true vfat 261853184 261844992
/vmfs/volumes/53bf119b-f4a646b6-e139-000c29f89b93 53bf119b-f4a646b6-e139-
000c29f89b93 true vfat 299712512 97705984

~ # esxcli storage core adapter list


HBA Name Driver Link State UID Description
——– ——— ———-
———————————— —————————————————————————
—–
vmhba0 ata_piix link-n/a ide.vmhba0 (0:0:7.1) Intel Corporation PIIX4 for
430TX/440BX/MX IDE Controller
vmhba1 mptspi link-n/a pscsi.vmhba1 (0:0:16.0) LSI Logic / Symbios Logic 53c1030 PCI-X
Fusion-MPT Dual Ultra320 SCSI
vmhba32 ata_piix link-n/a ide.vmhba32 (0:0:7.1) Intel Corporation PIIX4 for
430TX/440BX/MX IDE Controller
vmhba33 iscsi_vmk online iqn.1998-01.com.vmware:esx1-6aa0b3dc iSCSI Software Adapter

~ # esxcli storage san iscsi stats get


Adapter: vmhba33
Total Number of Sessions: 1
Total Number of Connections: 1
IO Data Sent: 14644
IO Data Received: 34820
Command PDUs: 119
Read Command PDUs: 109
Write Command PDUs: 0
Bidirectional Command PDUs: 0
No-data Command PDUs: 10
Response PDUs: 119
R2T PDUs: 0
Data-in PDUs: 0
Data-out PDUs: 0
Task Mgmt Request PDUs: 0
Task Mgmt Response PDUs: 0
Login Request PDUs: 1
Login Response PDUs: 1
Text Request PDUs: 0
Text Response PDUs: 0
Logout Request PDUs: 0
Logout Response PDUs: 0
NOP-Out PDUs: 176
NOP-In PDUs: 176
Async Event PDUs: 0
SNACK PDUs: 0
Reject PDUs: 0
Digest Errors: 0
Timeouts: 0
No Tx Buf Count: 0
No Rx Data Count: 0

******************Command for VM operation******************

How to see the VMs running on ESXi ?

~ # esxcli vm process list


Red-Linux1
World ID: 35867
Process ID: 0
VMX Cartel ID: 35864
UUID: 56 4d 2e ed 17 d1 b4 f3-ba d4 72 1d ac ed 77 0f
Display Name: Red-Linux1
Config File: /vmfs/volumes/53c033b3-b6a7b6f3-e8bf-000c29f89b93/Red-Linux1/Red-
Linux1.vmx

You can directly access command line in ESXi 5.x either through the console (so called ESXi
Shell) or SSH, but you need to first enable it through vSphere Client (Configuration ->
Security Profile -> Services -> ESXi shell / SSH -> Options -> Start) or console menu (F2 ->
login as user with root privileges -> Troubleshooting Options -> Enable ESXi Shell / Enable
SSH).

Show services on the host and their default state upon boot (on/off)
cat /etc/chkconfig.db

Restart all services on the host


/sbin/services.sh restart

Show config file of vCenter vpxa agent


cat /etc/vmware/vpxa/vpxa.cfg

Enter maintenance mode


vim-cmd hostsvc/maintenance_mode_enter

Virtual machine operations

vim-vmd solo/registervm <path to VM's .vmx file> - register VM on a host


vim-cmd vmsvc/getallvms - list all VMs registered on the host and provides vmid.

* in the following commands replace <vmid> with virtual machine ID obtained by running
the previous command
vim-cmd vmsvc/power.getstate <vmid> - show power state of a VM
vim-cmd vmsvc/power.shutdown  <vmid>  - shutdown a VM (shutdown guest)
vim-cmd vmsvc/power.reset  <vmid>  - reset a VM
vim-cmd vmsvc/power.off <vmid>  - power off a VM
vim-cmd vmsvc/power.on <vmid> - power on a VM
vim-cmd vmsvc/power.reboot <vmid> - reboot a VM
vim-cmd vmsvc/get.summary  <vmid>  - get summary information for a VM

vim-cmd solo/registervm /vmfs/vol/datastore/dir/vm.vmx


Registers vm in hypervisor inventory
vim-cmd vmsvc/unregister vmid
Unregisters vm with hypervisor
vim-cmd vmsvc/destroy vmid
Deletes the vmdk and vmx files from disk
vim-cmd hostsvc/maintenance_mode_enter
Puts hypervisor into maintenance mode
vim-cmd hostsvc/maintenance_mode_exit
Takes hypervisor out of maintenance mode
vim-cmd vmsvc/tools.install vmid
Starts vmware tools installation for VM

vim-cmd hostsvc/net/info
Provides information about hypervisor networking

chkconfig -l
Shows daemons running on hypervisor. Can also be used for configuration.

esxtop
Same as linux top for vmware

vmkerrcode -l
List of vmkernel errors

esxcfg-info
Lists a LOT of information about the esx host

esxcfg-nics -l
Lists information about NIC's. Can also be used for configuration.

esxcfg-vswitch -l
Lists information about virtual switching. Can also be used for configuration.

dcui
Provides console screen to ssh session

vsish
Vmware interactive shell

decodeSel /var/log/ipmi_sel.raw
Read System Event Log of server

You might also like