Beruflich Dokumente
Kultur Dokumente
You can run the esxcli command directly in ESXi BusyBox Shell. For that
you will need to have either direct access to the ESXi console, or SSH to the
ESXi (you need to turn on the SSH Shell access). Should you have multiple
ESXi servers to run the commands simultaneously, try the free
DoubleCloud ICE I developed.
Time to learn how to "Google" and manage your VMware and clouds in a fast and secure
HTML5 App
Alternatively, you can install vCLI on Windows or Linux from where you
want to remotely manage ESXi servers. If you don’t want to install the
package by yourself, you can download the vMA virtual appliance which
has everything pre-installed and pre-configured. When you run the
command this way, there is additional parameters for remote ESXi server
address and credential. Other than that, the command syntax should be the
same as native esxcli command.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 1 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
VMware.
This tutorial will guide you through all functionalities with samples and
tips/tricks assuming we are using the native esxcli command. Given the
complexity of the command, I cannot run all the combinations of
parameters, please feel free to use the help and try by yourself when you
cannot find exact sample. Should you find something worth sharing, please
feel free to post them in the comments.
Where Is It Installed?
The esxcli command utility comes with the ESXi installation. If you type in
the following commands you will find where it’s installed. Even more is
that you will uncover the a little secret of esxcli – it’s essentially a Python
script. If you are interested in what is in the script, you can simply check it
out with vi command. We’ll not dig deeper there, but focus on the usage of
the command as a user.
~ # which esxcli
/sbin/esxcli
~ # ls -l /sbin/esxcli
lrwxrwxrwx 1 root root 15 Aug 2 2012 /sbin/esxcli -> /sbin
Typing the esxcli command without any argument will displays the
command usage. With the options, you can control the format of the
output to be xml, csv, key/value pair, or json.
The esxcli command is a very complex command that achieve a lot given
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 2 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
it’s a single command. To help user to use the command without getting
confused, the namespaces are used to group the commands. The
namespaces can be further divided into sub-namespaces depending the
complexity.
The following command shows the top level namespaces, each of which can
be nicely mapped to a group of functionality. Just reading description of
these commands should give you an idea on what esxcli can do for you.
We’ll dig deeper into each of them in the following sections.
~ # esxcli
Usage: esxcli [options] {namespace}+ {cmd} [cmd options]
Options:
--formatter=FORMATTER
Override the formatter to use for a given command.
Available formatter: xml, csv, keyvalue
--debug Enable debug or internal use options
--version Display version information for the script
-?, --help Display usage information for the script
Available Namespaces:
esxcli Commands that operate on the esxcli system itself
allowing users to get additional information.
fcoe VMware FCOE commands.
hardware VMKernel hardware properties and commands for
configuring hardware.
iscsi VMware iSCSI commands.
network Operations that pertain to the maintenance of
networking on an ESX host. This includes a wide
variety of commands to manipulate virtual networking
components (vswitch, portgroup, etc) as well as local
host IP, DNS and general host networking settings.
sched VMKernel system properties and commands for
configuring scheduling related functionality.
software Manage the ESXi software image and packages
storage VMware storage commands.
system VMKernel system properties and commands for
configuring properties of the kernel core system.
vm A small number of operations that allow a user to
Control Virtual Machine operations.
A bit more on the format. In the interactive mode, the default format of
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 3 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
output is perfect. If you use the esxcli command for automation, other
formats may be preferred. For example, the CSV can be easily imported
into Excel or other spreadsheet for reporting and analytics. The XML is
very good for data exchange. The key and value pairs are good shell script
to consume. There are actually undocumented formats as I blogged about a
while back.
* list – retrieve a list of the objects that are represented by the namespace
* get – get information like property
* set – set a value
* load/unload – load/unload configuration
Note that they are not necessarily available in all the namespaces. When in
double, always checkout the command line.
Interestingly, the esxcli can also be a sub command to the esxcli command
itself. What it does is very simple — list all the available namespaces and
their commands. Because there are so many lines in the output, I will just
show you the first few lines. You can easily find out in your SSH to ESXi.
Available Commands:
list This command will list all of the esxcli commands with their na
object, command name and description.
~ # esxcli esxcli command list
Namespace Command
------------------------------------------------------ -----------
esxcli.command list
fcoe.adapter list
fcoe.nic disable
fcoe.nic discover
fcoe.nic list
hardware.bootdevice list
hardware.clock get
hardware.clock
...
Now, let’s take a look how to interpret the output. For each line, there is a
corresponding esxcli command. Let’s pick up the second line
“fcoe.adapter.” The related command is like the following:
The rule of thumb is to replace the dot with space and combine string
together with top esxcli command and last command. For some
commands, there are additional parameters, you may need to add there.
For the list command, it’s mostly fine without additional parameters except
the format as we discussed earlier.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 5 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
(FCOE)
We will not cover FCOE here as there are many good introduction already.
Check out Cormac’s blog.
The following command shows it has two name spaces: adapter and nic.
~ # esxcli fcoe
Usage: esxcli fcoe {cmd} [cmd options]
Available Namespaces:
adapter Operations that can be performed on FCOE-type storage HBAs
nic Operations that can be performed on FCOE-capable CNA devices
I don’t have a FCOE adapter in my home lab, but got a sample out from
VMware KB article here for each adapter:
vmhba35
Source MAC: bc:30:5b:01:82:3c
FCF MAC: 00:05:73:bf:48:33
VNPort MAC: 0e:fc:00:47:02:24
Physical NIC: vmnic8
User Priority: 3
VLAN id: 2008
Available Commands:
disable Disable rediscovery of FCOE storage on behalf of an FCOE-capabl
next boot.
discover Initiate FCOE adapter discovery on behalf of an FCOE-capable CN
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 6 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Here are the sample commands: (Again, the output sample from above KB
article)
vmnic4
User Priority: 3
Source MAC: FF:FF:FF:FF:FF:FF
Active: false
Priority Settable: false
Source MAC Settable: false
VLAN Range Settable: false
Managing Hardware
All the hardware related commands fit in the hardware namespace. As you
can see the following output, you can retrieve information or manage
various aspects of the hardware including cpu, ipmi, boot device, clock,
memory, pci, platform (a little vague term, but will elaborate more soon),
trusted boot.
Because hardware is hard, you cannot do much about it but retrieving the
information about these components or aspects. So the list command is the
most commonly used in this category.
~ # esxcli hardware
Usage: esxcli hardware {cmd} [cmd options]
Available Namespaces:
cpu CPU information.
ipmi IPMI information.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 7 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
The following command lists the CPU related information. There are 8
cores, but I just show 2 core inforation here – the rest 6 is pretty much the
same.
CPU:1
Id: 1
Package Id: 0
Family: 6
Model: 58
Type: 0
Stepping: 9
Brand: GenuineIntel
Core Speed: 3392293892
Bus Speed: 99773344
APIC ID: 0x1
Node: 0
L2 Cache Size: 262144
L2 Cache Associativity: 8
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 8 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Available Namespaces:
fru Information from IPMI Field Replaceable Unit inventory (
sdr Information from IPMI Sensor Data Respository (SDR).
sel Information from IPMI System Event Log (SEL).
My server in use does not have the IPMI support, so the following
commands return nothing or empty values. If you have enabled servers,
you will see more with the same commands.
Available Commands:
get Get IPMI Field Replaceable Unit (FRU) device details.
list List IPMI Field Replaceable Unit (FRU) inventory.
~ # esxcli hardware ipmi fru list
~ # esxcli hardware ipmi fru get
Device IDs:
Features:
Raw:
Sizebytes:
~ # esxcli hardware ipmi sdr get
Feature:
Free Space:
Last Added:
Last Cleared:
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 9 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Raw:
Total Records:
Version:
~ # esxcli hardware ipmi sdr list
~ # esxcli hardware ipmi sel get
Enabled:
Last Added:
Last Cleared:
Maximum Records:
Overflow:
Raw:
Sel Clock:
Total Records:
Version:
~ # esxcli hardware ipmi sel list
Every computer has a clock. With esxcli command, you can get the time on
the clock, and change the time on the clock. The parameters to set up new
time is a little tricky, but using the help should be very easy. You can set
individual component of the time, say year, month, etc.
Description:
set Set the hardware clock time. Any missing parameters will defaul
current time.
Cmd options:
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 10 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
-d|--day= Day
-H|--hour= Hour
-m|--min= Minute
-M|--month= Month
-s|--sec= Second
-y|--year= Year
~ # esxcli hardware clock set -y 2015
Retrieving the physical memory of ESXi server is very simple with the
following command. It also shows the NUMA node count.
PCI information can be retrieved with the pci name space as follows. The
output is pretty long, so I just include the first device. With the long output,
you can pipeline it to grep command for exact information you are
interested in.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 11 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Now it’s time for the vague platform namespace. Let’s start with the
command itself. With that, I don’t need to explain what the platform is.
Last one in the hardware is the trusted boot. Again, my server does not
have the feature. For more details on the technology, check out this wiki
page: http://en.wikipedia.org/wiki/Trusted_Execution_Technology
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 12 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Available Commands:
get Get current state of the options of the system-wide shared
swap space.
set Change the configuration of system-wide shared swap space.
~ # esxcli sched swap system get
Datastore Active: false
Datastore Enabled: false
Datastore Name:
Datastore Order: 0
Hostcache Active: false
Hostcache Enabled: true
Hostcache Order: 1
Hostlocalswap Active: false
Hostlocalswap Enabled: true
Hostlocalswap Order: 2
The changing of properties is through the set command. You can change
one or more properties at a time with the switches as listed below.
Description:
set Change the configuration of system-wide shared swap space.
Cmd options:
-d|--datastore-enabled
If the datastore option should be enabled or not.
-n|--datastore-name=
The name of the datastore used by the datastore option.
-D|--datastore-order=
The order of the datastore option in the preference of the
options
-c|--hostcache-enabled
If the host cache option should be enabled or not.
-C|--hostcache-order=
The order of the host cache option in the preference of
the options.
-l|--hostlocalswap-enabled
If the host local swap option should be enabled or not.
-L|--hostlocalswap-order=
The order of the host local swap option in the preference
of the options.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 13 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
For that purpose, VMware created VIB format based on a Linux package
system. It has related SDK for others to build the VIB. The commands in
this section is about how to manage the VIBs with command line.
~ # esxcli software
Usage: esxcli software {cmd} [cmd options]
Available Namespaces:
sources Query depot contents for VIBs and image profiles
acceptance Retrieve and set the host acceptance level setting
profile Display, install, update or validates image profiles
vib Install, update, remove, or display individual VIB
packages
You can use the sources namespace to “browse” the VIB packages in a VIB
depot. Before running the command, you want to modify firewall to allow
HTTP client.
In this sample, I used the v-front.de which has a rich collection of VIBs. In
your company, you may have your own VIB depot.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 14 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
If you use the get command, you will get a lot more details than the list.
The following shows one part of the long output.
This blog post has excellent introduction and more sample commands.
You can list the image profiles as follows. I intentionally used ESXi-6.0 for
grep, or will get a lot more lines in output. Again, it connects to external
site and you want to open firewall before this.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 15 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Supposedly you can download a zip and point the depot to it as follows.
Somehow it does not work even though I had the full path to the zip file as
recommended by a few bloggers.
The error message is not true because the zip file seems a valid zip file (not
all output lines are listed)
~ # unzip -l /vmfs/volumes/datastore1/ESXi510-201406001.zip
Archive: /vmfs/volumes/datastore1/ESXi510-201406001.zip
Length Date Time Name
-------- ---- ---- ----
319 06-14-14 15:45 index.xml
207 06-14-14 15:45 vendor-index.xml
80403 06-14-14 15:45 metadata.zip
177231686 04-14-14 07:31 vib20/tools-light/VMware_locker_tools-light_5.1.0-2.28.1743
63758 08-01-12 20:49 vib20/scsi-bnx2i/VMware_bootbank_scsi-bnx2i_1.9.1d.v50.1-5v
ESXi has different level of acceptance for installing new VIBs. Changing
acceptance levels enables installing VIBs from other vendors possible.
Available Commands:
get Gets the host acceptance level. This controls what VIBs will be
set Sets the host acceptance level. This controls what VIBs will be
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 16 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Available Commands:
get Display the installed image profile.
install Installs or applies an image profile from a depot to this host.
completely replaces the installed image with the image defined
profile, and may result in the loss of installed VIBs. The comm
and image profile will be skipped. To preserve installed VIBs,
instead. WARNING: If your installation requires a reboot, you n
first.
update Updates the host with VIBs from an image profile in a depot. In
upgraded (or downgraded if --allow-downgrades is specified
removed. Any VIBs in the image profile which are not related to
will be added to the host. WARNING: If your installation requir
to disable HA first.
validate Validates the current image profile on the host against an imag
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 17 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Available Commands:
get Displays detailed information about one or more installed VIBs
install Installs VIB packages from a URL or depot. VIBs may be installe
downgraded. WARNING: If your installation requires a reboot, yo
first.
list Lists the installed VIB packages
remove Removes VIB packages from the host. WARNING: If your installati
you need to disable HA first.
update Update installed VIBs to newer VIB packages. No new VIBs will b
updates. WARNING: If your installation requires a reboot, you n
first.
It’s quite easy to list all the VIBs installed on the system. The following
shows the command and part of output.
To get more details of a specific VIB, you can use the get command as
follows with the VIB name.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 18 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
To install a VIB, you should install command with VIB locations. For the
VIB not signed, you want to turn off the signature checking with –no-sig-
check option. WARNING: If your installation requires a reboot, you need
to disable HA first.
iSCSI Management
iSCSI allows ESXi to use storages on remote iSCSC servers. The esxcli
command can help to manage this feature on different layers in the stack.
Again, I don’t have the set up with iSCSI support. Instead of real
commands, the following commands shows mostly the help so that you can
see what are theree.
~ # esxcli iscsi
Usage: esxcli iscsi {cmd} [cmd options]
Available Namespaces:
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 19 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Available Namespaces:
auth Operations that can be performed on iSCSI adapter authenticatio
discovery Operations that can be performed on iSCSI adapter discovery
target Operations that can be performed on iSCSI targets
capabilities Operations that can be performed on iSCSI adapter capabilities
firmware Operations that can be performed on iSCSI adapter firmware
param Operations that can be performed on iSCSI adapter parameters
Available Commands:
get List the iSCSI information for the iSCSI Host Bus Adapter.
list List all the iSCSI Host Bus Adapters on the system.
set Set the iSCSI name and alias for the iSCSI Host Bus Adapter.
~ # esxcli iscsi software
Usage: esxcli iscsi software {cmd} [cmd options]
Available Commands:
get Software iSCSI information.
set Enable or disable software iSCSI.
~ # esxcli iscsi software get
false
Network Management
ESXi has a rich set of features in networking. All the network related
commands are grouped in the network namespace. To take a look at what
are available there, simply type in:
~ # esxcli network
Usage: esxcli network {cmd} [cmd options]
Available Namespaces:
fence Commands to list fence information
firewall A set of commands for firewall related operations
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 20 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
As you can find there are more sub-namespaces, each of which is still a big
topic of itself.
Firewall Management
To find out the current firewall status, get command is the way to go:
Firewall module can be unloaded or loaded using the unload and load
command as follows:
When firewall working, you can enable and disable the firewall as follows.
You want to keep the firewall enabled all the time.
You can also set the default action of firewall to let pass everything or block
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 21 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
After you change firewall configuration, the ruleset may be out of sync with
the active. To keep in sync, you can simply run the refresh command.
Above is the overall control of firewall. You can fine tune each individual
rule set within the ruleset namespace.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 22 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
DVSSync false
syslog false
IKED false
WOL true
vSPC false
remoteSerialPort false
vprobeServer false
Each ruleset consists of a collection of rules. You can list them using rule
namespace. If you don’t provide ruleset-id as follows, you will get a long
list of rules from all the rulesets.
Note that even with the powerful esxcli command, you can not modify
much of the firewall configurations. For all the configurations, you want to
go directly edit the configuration file then refresh the firewall:
~ # vi /etc/vmware/service/service.xml
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 23 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
To get all fence network bridge table entries information, you can use the
following command.
To get all fence port info on the fence network, you can use the following
command:
To turn off or turn on IPv6 support, you can use the set command. Note:
you have to restart the ESXi for the configuration to take effect.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 24 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
To change the IP address for ESXi on an existing interface is easy too, but
be careful with this operation because your SSH session may be terminated
immediately.
The ESXi depends on the DNS setting to resolve server names. The
following commands help manage the DNS.
You also change the default search domain for the DNS settings.
Network Security
There are two aspects you can manage the security: security association,
and security policy. There are quite a few options you can tune. Combined
together, they can cover a lot of cases.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 25 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Description:
add Add a Security Association.
Cmd options:
-e|--encryption-algorithm=
Encryption algorithm for the Security Association. Should be on
cbc, aes128-cbc]. (required)
-k|--encryption-key=
Encryption key(ASCII or hex). Length of hex key is dependent up
Required when a encryption algorithm has been specified.
-i|--integrity-algorithm=
Integrity algorithm for the Security Association. Should be one
hmac-sha2-256]. (required)
-K|--integrity-key=
Integrity key(ASCII or hex). Length of hex key is dependent upo
(required)
-d|--sa-destination=
Ipv6 address of Security Association destination. Can be specif
correct IPv6 address. (required)
-m|--sa-mode= Security Association mode. Should be one in set [transport, tunnel
-n|--sa-name= Name for the Security Association to be added. (required)
-s|--sa-source= Ipv6 address of Security Association source. Can be specified
IPv6 address. (required)
-p|--sa-spi= SPI value for the Security Association(hex). (required)
Description:
add Add a Security Policy.
Cmd options:
-A|--action= Action for Security Policy. Should be one in set [none, discard, ip
-P|--destination-port=
Destination Port for Security Policy. '0' stands for 'any'
-w|--flow-direction=
Flow direction for Security Policy. Should be one in set
-a|--sa-name= Name for the Security Association. Not being Specified lets vmkernel
choose an Security Association. If no applicable Security Assoc
vmkernel may request one using IKE.
-p|--source-port=
Source Port for Security Policy. '0' stands for 'any' (required
-d|--sp-destination=
Ipv6 address and prefix length of Security Policy destination.
'any' or a correct Ipv6 network address. (required)
-m|--sp-mode= Security Policy mode. Should be one in set [transport, tunnel
-n|--sp-name= Name for the Security Policy to be added. (required)
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 26 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
-s|--sp-source= Ipv6 address and prefix length of Security Policy source. Can be spe
a correct IPv6 network address. (required)
-u|--upper-layer-protocol=
Upper layer protocol for Security Policy, Should be one
icmp6].
Managing Gateways
You can manage both IPv4 and IPv6 networks. I first show the IPv4 here
because the IPv6 is very similar.
To change the gateway, try the following command. Again, you session may
be terminated with invalid parameter.
To remove a route, you can use remove command with same parameters as
the add command. Again, be careful as your session may be terminated
right away.
For the IPv6 listing of routes, you can see something similar as follows:
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 27 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
At any given time, you can find out what live connections are there.
You can use the esxcli command to list the network neighbors on the same
network.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 28 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Description:
set Set the general options for the specified ethernet device.
Cmd options:
-a|--auto Set the speed and duplexity settings to autonegotiate.
-D|--duplex= The duplex to set this NIC to. Acceptable values are : [full, half
-l|--message-level=
Sets the driver message level. Meaning differ per driver.
-n|--nic-name= The name of the NIC to configured. This must be one of the cards lis
list command. (required)
-P|--phy-address=
Set the PHY address of the device
-p|--port= Selects device port. Available device ports are aui: Select aui
port bnc: Select bnc as the device port fibre: Select m
mii: Select mii as the device port tp: Select tp as the dev
-S|--speed= The speed to set this NIC to. Acceptable values are : [10, 100
-t|--transceiver-type=
Selects transeiver type. Currently only internal and external c
future future types might be added. Available transeiver types
the transceiver type to external internal: Set the transcei
-w|--wake-on-lan=
Sets Wake-on-LAN options. Not all devices support this. The arg
a string of characters specifying which options to enable. p W
wake on unicast messages m Wake on multicast messages b wake on
Wake on ARP g Wake on MagicPacket(tm) s Enable SecureOn(
MagicPacket(tm)
To turn on NIC VLAN stats, we can use set command as follows, and then
we can check the VLAN stats.
For each NIC, you can get its stats with the stats namespace.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 29 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
To get the current configuration of a network interface, you can use the get
command with the name of the interface.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 30 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
You can set the NIC with different parameters like speed, duplex mode. For
easy life, you can simply use the –auto option which let the ESXi
automatically negoatiate these with other system. When you have –auto
option, you must not specify the speed and duplex mode. NOTE: if you use
SSH to your ESXi server, be careful not to mess up the NIC underlying.
For a particular NIC adapter, you can also turn it on and off. Be careful not
to turn off the NIC underlying your SSH session, or you have to have
physical access or IPMI.
Further down the port namespace, we can get more details of ports used by
a specific virtual machine which is identified by the world id. Please note
that you can also find the uplink port ID, which can used as normal VM
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 31 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
To get port filter related stats, run the following command. Somehow I
don’t have filter therefore nothing is shown in output.
Managing SR-IOV
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 32 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
SR-IOV stands for Single Root I/O Virtualization. It allow one PCI device
appears as multiple NIC cards to the hypervisor. Scott Lowe has a nice blog
post on this topic.
To list the NICs that support SR-IOV, and list the virtual functions (VF) on
a nic, run the following commands.
To list all the virtual switches, use the list command as follows:
To create a new virtual switch, use the add command with port number
and name.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 33 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
The newly created virtual switch takes default for mtu, and cdp, but you
can change them using the set command with the options below.
Cmd options:
-c|--cdp-status= The CDP status of the given virtual switch. It can be 'down',
'both'
-m|--mtu= The MTU size of the given virtual switch.
-v|--vswitch-name=
The name of virtual switch to apply the configurations.
There are many policies you can change with esxcli command, namely
failover, security, shaping. You can set these policies using the set
command under the corresponding namespace. The name for the virtual
switch is case sensitive.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 34 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
To add a new uplink to a virtual switch, you can run the following
command. The uplink name must be a valid pnic name.
You can change the VLAN ID with set command. Note that this may affect
the network connectivity.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 35 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
There are similar policies that are associated with port groups as with the
virtual switch. The following shows 3 commands and you can see what are
included in the policy.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 36 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Available Namespaces:
lacp A set of commands for LACP related operations
vxlan A set of commands for VXLAN related operations
Available Commands:
list List the VMware vSphere Distributed Switch currently configured on
the ESXi host.
Cmd options:
-c|--count= Specify the number of packets to send.
-D|--debug VMKPing debug mode.
-d|--df Set DF bit on IPv4 packets.
-H|--host= Specify the host to send packets to. (required)
-I|--interface= Specify the outgoing interface.
-i|--interval= Set the interval for sending packets in seconds.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 37 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Managing Storage
The storage is another heavy aspect of ESXi management. It includes 6
different sub namespaces, each of which is a big topic by itself.
~ # esxcli storage
Usage: esxcli storage {cmd} [cmd options]
Available Namespaces:
core VMware core storage commands.
nmp VMware Native Multipath Plugin (NMP). This is the VMware defaul
Pluggable Storage Architecture.
san IO device management operations to the SAN devices on the syste
vmfs VMFS operations.
filesystem Operations pertaining to filesystems, also known as datastores,
nfs Operations to create, manage and remove Network Attached Storag
Managing NFS
To list all the NFS volumes that are already mounted on the host, just run
the list command.
To add a new NFS volume, you want to use the add command:
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 38 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
With changes on the file system, you can also run the following command
to rescan and automatically mount those unmounted.
Description:
unmount Disconnect and unmount and existing VMFS or NAS volume. This wi
remove the volume from the list of mounted volumes.
Cmd options:
-n|--no-persist Unmount the volume non-peristently; the volume will be automoun
-l|--volume-label=
The label of the volume to unmount.
-p|--volume-path=
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 39 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
There are also snapshot feature that can be managed by a few commands.
Available Namespaces:
extent Manage VMFS snapshot extents.
Available Commands:
list List unresolved snapshots/replicas of VMFS volume.
mount Mount a snapshot/replica of a VMFS volume.
resignature Resignature a snapshot/replica of a VMFS volume.
Available Namespaces:
fc IO Device Management operations to the FC adapters on the syste
fcoe IO Device Management operations to the FCoE adapters on the sys
iscsi IO Device Management operations to the Software iSCSI adapters
sas IO Device Management operations to the SAS adapters on the syst
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 40 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
sata.vmhba0-sata.0:0-t10.ATA_____Hitachi_HDS723020BLA642___________LENOVO______MN1240FA
Runtime Name: vmhba0:C0:T0:L0
Device: t10.ATA_____Hitachi_HDS723020BLA642___________LENOVO______MN1240FA09DU5D
Device Display Name: Local ATA Disk (t10.ATA_____Hitachi_HDS723020BLA642___________L
Group State: active
Array Priority: 0
Storage Array Type Path Config: SATP VMW_SATP_LOCAL does not support path configurat
Path Selection Policy Path Config: {current: yes; preferred: yes}
mpx.vmhba35:C0:T0:L0
Device Display Name: Local PLDS CD-ROM (mpx.vmhba35:C0:T0:L0)
Storage Array Type: VMW_SATP_LOCAL
Storage Array Type Device Config: SATP VMW_SATP_LOCAL does not support device config
Path Selection Policy: VMW_PSP_FIXED
Path Selection Policy Device Config: {preferred=vmhba35:C0:T0:L0;current=vmhba35:C0:
Path Selection Policy Device Custom Config:
Working Paths: vmhba35:C0:T0:L0
Is Local SAS Device: false
Is Boot USB Device: false
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 41 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Multipath policy can also be configured using different plugins, which are
listed as follows:
To list all the storage array plugin (SATP), the following command is
handy.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 42 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Description:
set Set the default Path Selection Policy for a given Storage Array
Cmd options:
-b|--boot This is a system default rule added at boot time. Do not modify
-P|--default-psp=
The default path selection policy to set for a given --satp
-s|--satp= The SATP name for the Storage Array Type Plugin on which this
Core Storage
The following command lists all the storage adapters on the host,
To make sure the adapters are found, run the rescan all command.
IO statistics are also available with the following command. More lines are
actually there, but skipped here to save space.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 43 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 44 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
mpx.vmhba35:C0:T0:L0
Device: mpx.vmhba35:C0:T0:L0
Successful Commands: 0
Blocks Read: 0
Blocks Written: 0
Read Operations: 0
Write Operations: 0
Reserve Operations: 0
Reservation Conflicts: 0
Failed Commands: 17197
Failed Blocks Read: 0
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 45 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
To get a list of the worlds that are currently using devices on the ESX host,
the following command is used:
To list all devices that were detached manually by changing their state on
the system, run the following command. This is related to the ESXi feature
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 46 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
For the VAAI feature, we can get their status. In my case, it’s not used at all
therefore no much to show.
mpx.vmhba35:C0:T0:L0
VAAI Plugin Name:
ATS Status: unsupported
Clone Status: unsupported
Zero Status: unsupported
Delete Status: unsupported
To list all the SCSI paths on the system, use the following command:
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 47 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
For each path, it can be set active, or off using the set command.
Description:
set Provide control to allow a user to modify a single path's state
enable or disable SCSI paths. The user is not able to change th
toggle between 'active' and 'off'. Please NOTE changing the Pat
to a given device is likely to fail. The VMkernel will not chan
would cause an 'All paths down' state or the device is currentl
Cmd options:
-p|--path= Select the path to set path state on. This can be a Runtime Name or
--state= Set the SCSI path state for a the specific path given. Valid values
state to active. This may be immediately changed by the system
not appropriate. off: Administratively disable this path.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 48 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
----------- ------------
NMP MP
For the automatic claiming, rules can be used. The following command lists all the rule
~ # esxcli storage core claimrule list
Rule Class Rule Class Type Plugin Matches
---------- ----- ------- --------- --------- ---------------------------------
MP 0 runtime transport NMP transport=usb
MP 1 runtime transport NMP transport=sata
MP 2 runtime transport NMP transport=ide
MP 3 runtime transport NMP transport=block
MP 4 runtime transport NMP transport=unknown
MP 101 runtime vendor MASK_PATH vendor=DELL model=Universal Xport
MP 101 file vendor MASK_PATH vendor=DELL model=Universal Xport
MP 65535 runtime vendor NMP vendor=* model=*
New rules can also be added into the rule set. The command expects a few
parameters, but the help is probably the best – it comes with a few
examples.
Description:
add Add a claimrule to the set of claimrules on the system.
Cmd options:
-A|--adapter= Indicate the adapter of the paths to use in this operation.
-u|--autoassign The system will auto assign a rule id.
-C|--channel= Indicate the channel of the paths to use in this operation.
-c|--claimrule-class=
Indicate the claim rule class to use in this operation [
-d|--device= Indicate the Device Uid to use for this operation.
-D|--driver= Indicate the driver of the paths to use in this operation.
-f|--force Force claim rules to ignore validity checks and install the rul
--if-unset= Execute this command if this advanced user variable is not set
-i|--iqn= Indicate the iSCSI Qualified Name for the target to use in this oper
-L|--lun= Indicate the LUN of the paths to use in this operation.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 49 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Examples:
Add rule #321 for the Filter plugin type that will claim the given device for the VAA
# esxcli storage core claimrule add -r 321 -t device -P VAAI_FILTER --claimrule-class=F
Add rule #321 for the VAAI plugin type that will claim the given device for the VMW_V
# esxcli storage core claimrule add -r 321 -t device -P VMW_VAAIP_SYMM --claimrule-clas
Add rule #321 that will claim the path on adapter vmhba0, channel 0, target 0, LUN 0
# esxcli storage core claimrule add -r 321 -t location -A vmhba0 -C 0 -T 0 -L 0 -P NMP
Add rule #429 for the MP claim rule type that will claim all paths provided by an ada
# esxcli storage core claimrule add -r 429 -t driver -D mptscsi -P MASK_PATH --claimrul
Add rule #914 to claim all paths with a vendor string matching "VMWARE" and a model s
# esxcli storage core claimrule add -r 914 -t vendor -V VMWARE -M Virtual -P NMP
Add rule #1015 to claim all paths provided by Fibre Channel type adapters for the NMP
# esxcli storage core claimrule add -r 1015 -t transport -R fc -P NMP
Add rule #429 to claim all paths provided by Fibre Channel Target on given WWNN and W
# esxcli storage core claimrule add -r 429 -P NMP -t target -R fc --wwnn 50:06:01:60:ba
Add rule #429 to claim paths to LUN 5 provided by iSCSI Target on given IQN.
# esxcli storage core claimrule add -r 429 -P NMP -t target -R iscsi --iqn iqn.2001-04.
Add a rule with a system assigned rule id to claim all paths provided by Fibre Channe
# esxcli storage core claimrule add --autoassign -t transport -R fc -P NMP
Core can aso be dumped into local partition and that involves another sub
namespace – partition.
You can also change the configuration with the set command.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 51 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Description:
set Set the specific VMkernel dump partition for this system. This
partition for the next boot. This command will change the activ
partition specified.
Cmd options:
-e|--enable Enable or disable the VMkernel dump partition. This option cann
setting or unconfiguring the dump partition.
-p|--partition= The name of the partition to use. This should be a device name with
at the end. Example: naa.xxxxx:1
-s|--smart This flag can be used only with --enable=true. It will cause th
partition to be selected using the smart selection algorithm.
-u|--unconfigure Set the dump partition into an unconfigured state. This will re
configured dump partition for the next boot. This will result
algorithm being used at the next boot.
Module Management
To list the modules in ESXi server, you can use the module sub namespace
with list command. There are many lines of output not listed here.
To get details about a module, you can use the get command
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 52 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Signature FingerPrint: cb44 247a 1614 cea1 2079 362d ec86 9d0e
Provided Namespaces: com.vmware.vmkapi@v2_1_0_0
Required Namespaces: com.vmware.vmkapi@v2_1_0_0, vmkernel@nover
You can also list parameters of a module as follows. There are actually
more lines but omitted. It’s also highly possible that there is no line at all
because there is no parameter to change for that module.
Userworld Process
To list these processes, you can use the following command. Again, it’s not
fully list due to space limit.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 53 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
To get the system workload, run the following command and get the load
in 1, 5, and 15 minute period. You will get more from esxtop command
anyway.
Security Policy
As usual, you can list all the security policies using the list command. With
each policy, you can see its enforcement level.
To change the level of enforcement, use the set command. Other than the
enforcing level, I haven’t seen other level and I even tried none and a few
others with no luck. The help doesn’t help neither – something for VMware
to improve.
Description:
set Set the enforcement level for a domain in the system. Any optio
persistent and will not survive a reboot of the system.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 54 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Cmd options:
-a|--all-domains All domains.
-l|--level= The enforcement level. (required)
-n|--name= The domain name.
Kernel Settings
There are many parameters with which you can tune the ESXi. For a
complete list of these parameters, you can use the list command as follows.
As you expect, there are so many of them, I just show first two. The name
of the setting is self explanatory with the description field.
There are many parameters you can fine tune the ESXi. The following
shows the commands you can list them, change them.
Path: /Irq/IRQRebalancePeriod
Type: integer
Int Value: 50
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 55 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Description:
set Set the value of an advanced option.
Cmd options:
-d|--default Reset the option to its default value.
-i|--int-value= If the option is an integer value use this option.
-o|--option= The name of the option to set the value of. Example: "/Misc/HostName
-s|--string-value=
If the option is a string use this option.
ESXi is like an operating system which can interactive with users. One way
of interaction is via keyboard. The esxcli command allows changing the
keyboard configuration.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 56 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Polish
Portuguese
Russian
Slovenian
Spanish
Swedish
Swiss French
Swiss German
Turkish
US Default
US Dvorak
Ukrainian
United Kingdom
~ # esxcli system settings keyboard layout get
US Default
To change the keyboard layout, the following command can be used. It’s
not persisted across reboot with the no-persist option.
Syslog management
You can mark the syslog by adding a unique message in the log. Why is it
needed? You can use it to mark start of new period for testing something,
so that you can later easily locate the start point.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 57 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
You can reload the log daemon to apply any new configuration options as
follows:
If you want to export the syslog to a remote syslog server, you can use the
set command as follows. You want to make sure the FQDN is resolvable,
which may involve the configuration of DNS as described earlier.
To list all the loggers, run the following command. There are many other
loggers not listed due to limit of space.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 58 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
To change a specific logger configuration like the rotation size and how
many rotations to keep, you can run the following command. The id must
be one in the above list output. The unit for the size is KiB.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 59 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
When you set the hostname, you can use fqdn option or domain plus host.
They are mutually exclusive. I find fqdn is easy and straightforward.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 60 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
The default timeout for the set command is 60 seconds so the timeout can
be omitted in above command.
Power Management
You can either power off or reboot ESXi from the esxcli command. But
wait, why isn’t there a power on command? You will need a IPMI interface
for that.
Both reboot and power off operation requires the same parameters.
Description:
poweroff Power off the system. The host must be in maintenance mode.
Cmd options:
-d|--delay= Delay interval in seconds
-r|--reason= Reason for performing the operation (required)
Configuring SNMP
There are a few parameters you can configure on ESXi. The following help
shows these parameters with some descriptions.
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 61 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Description:
set This command allows the user to set up ESX SNMP agent.
Cmd options:
-a|--authentication=
Set default authentication protocol. Values: none, MD5, SHA1
-c|--communities=
Set up to ten communities each no more than 64 characters. Form
community1[,community2,...] (this overwrites previous settings
-e|--enable Start or stop SNMP service. Values: [yes|no, true|false,
-E|--engineid= Set SNMPv3 engine id. Must be at least 5 to 32 hexadecimal character
if found as well as colons (:)
-y|--hwsrc= Where to source hardware events from IPMI sensors or CIM Indications
indications|sensors
-l|--loglevel= System Agent syslog logging level: debug|info|warning|error
-n|--notraps= Comma separated list of trap oids for traps not to be sent by agent.
to clear setting
-p|--port= Set UDP port to poll snmp agent on. The default is udp/161
-x|--privacy= Set default privacy protocol. Values: none, AES128
-R|--remote-users=
Set up to five inform user ids. Format is: user/auth-proto
/-|priv-hash/engine-id[,...] Where user is 32 chars max. auth-p
priv-proto is none|AES. '-' indicates no hash. engine-id is hex
to 32 chars max.
-r|--reset Return agent configuration to factory defaults
-C|--syscontact= System contact string as presented in sysContact.0. Up to 255
-L|--syslocation=
System location string as presented in sysLocation.0. Up to
-t|--targets= Set up to three targets to send SNMPv1 traps to. Format is: ip-or-
hostname[@port]/community[,...] The default port is udp/
settings)
-u|--users= Set up to five local users. Format is: user/-|auth-hash/-|priv-hash
user is 32 chars max. '-' indicates no hash. Model is one of
-i|--v3targets= Set up to three SNMPv3 notification targets. Format is: ip-or-hostna
user/security-level/trap|inform[,...].
~ # esxcli system snmp set --communities=system-monitor
~ # esxcli system snmp get
Authentication:
Communities: system-monitor
Enable: false
Engineid:
Hwsrc: indications
Loglevel: info
Notraps:
Port: 161
Privacy:
Remoteusers:
Syscontact:
Syslocation:
Targets:
Users:
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 62 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
V3targets:
Retrieving UUID
The following command retrieves the UUID for the host.
~ # esxcli system uuid get
50cdca40-8c57-2ee2-af75-8c89a5d2b40f
Description:
set Set the system clock time. Any missing parameters will default
Cmd options:
-d|--day= Day
-H|--hour= Hour
-m|--min= Minute
-M|--month= Month
-s|--sec= Second
-y|--year= Year
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 63 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
Update: 0
You can use the following command to list all the running virtual machine.
Instead of process id, each VM is identified by its world ID.
There are other options as listed below, for example, soft type, hard type,
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 64 of 65
VMware ESXi esxcli Command: A Quick Tutorial | DoubleCloud => Private Cloud + Public Cloud 31/03/19, 1(47 PM
and the ultimate force type. With the force option, you can almost stop any
virtual machine.
Description:
kill Used to forcibly kill Virtual Machines that are stuck and not responding to normal
stop operations.
Cmd options:
-t|--type= The type of kill operation to attempt. There are three types of VM kills tha
attempted: [soft, hard, force]. Users should always attempt 'soft' kills first,
which will give the VMX process a chance to shutdown cleanly (like kill or kill
-SIGTERM). If that does not work move to 'hard' kills which will shutdown the process
immediately (like kill -9 or kill -SIGKILL). 'force' should be used as a last resort
attempt to kill the VM. If all three fail then a reboot is required. (required)
-w|--world-id= The World ID of the Virtual Machine to kill. This can be obtained from t
list' command (required)
http://www.doublecloud.org/2015/05/vmware-esxi-esxcli-command-a-quick-tutorial/ Page 65 of 65