Command-Line Management in vSphere 5.0 for Service Console Users Technical Note ESXi 5.0


Add to my manuals
28 Pages

advertisement

Command-Line Management in vSphere 5.0 for Service Console Users Technical Note ESXi 5.0 | Manualzz

Technical Note

Command-Line Management in vSphere 5.0 for Service Console Users

ESXi 5.0

Starting with vSphere 5.0, the service console (also called console OS or COS) with its associated Linux installation is no longer available. If you are currently using ESX service console commands, scripts, agents, or logs, this technical note helps you transition to an off-host implementation or to use the ESXi Shell in special cases.

“Introduction” on page 1

“Transitioning Service Console Commands” on page 2

“ESXi Shell Access” on page 5

“Replacing Agents” on page 9

“Logging in vSphere 5.0” on page 10

“Retrieving Networking Information” on page 12

“Adding Third-Party Extensions to Hosts” on page 13

“Reference to Replacements for Service Console Commands” on page 13

I MPORTANT Changes made to the host using the DCUI, the vSphere Client, ESXCLI, or other administrative tools are committed to permanent storage every hour or upon graceful shutdown. Changes might be lost if the host fails before they are committed.

Introduction

In vSphere 5.0, VMware offers the following tools, CLIs, and APIs that replace ESX 4.x service console components.

CLI or Tool vCLI

PowerCLI

Description

Includes ESXCLI commands, vicfg- commands, and a few other commands for managing vSphere.

PowerCLI cmdlets for managing ESXi hosts and virtual machines.

Availability

Install a vCLI package on a Windows or Linux system or run commands from vMA.

Install Microsoft PowerShell on a Windows system, and install vSphere PowerCLI to run both PowerShell and PowerCLI cmdlet from the

PowerCLI prompt.

VMware, Inc.

1

Command-Line Management in vSphere 5.0 for Service Console Users

CLI or Tool vMA

ESXi Shell commands

Description

A Linux virtual appliance that includes the vSphere SDK for Perl and the vCLI package.

Also supports the vi-fastpass authentication component.

Set of troubleshooting commands to use when vCLI cannot access your ESXi system. Includes

ESXCLI commands and esxcfg- commands

(deprecated).

Availability

Deploy vMA on an ESXi system and run commands against authenticated target servers from vMA.

The ESXi Shell is disabled by default. You can enable the Shell for local or remote access.

Transitioning Service Console Commands

If you are currently managing your environment with service console commands, you can perform the same management tasks in vSphere 5.0 in one of the following ways.

 Use one of the vSphere Client interfaces.

 Install vCLI or PowerCLI on a management server, write scripts with those commands, and run the scripts

against target hosts. See “Running vCLI or PowerCLI Commands from Remote Hosts” on page 3.

 For certain troubleshooting and advanced management commands, use commands from the ESXCLI command set directly the ESXi Shell. See

“Using the ESXi Shell” on page 5.

ESX 4.x Service Console

Service console commands Off-host management with vCLI.

Service console commands vSphere 5.0

Install on Windows or Linux or use vMA.

Off-host management with VMware

PowerCLI cmdlets from a Windows system.

Service console commands On-host management in the ESXi Shell is possible if system failures or other issues prevent you from using off-host management commands.

ESXi Shell is disabled by default

Agents If you run agents in the ESX 4.x service console, you can replace them with infrastructure services in many cases.

Running third-party agents in the ESXi Shell is not supported.

Linux networking commands.

Service console logs

Not available in the ESXi Shell. Use ESXCLI commands instead.

Fine-grained control over system logs is available. You can send logs to the local system or to a remote host.

See

“Transitioning Service Console

Commands” on page 2.

“Reference to

Replacements for Service Console

Commands” on page 13 lists vCLI or

ESXCLI replacements for service console commands and points to migration lists in this technical note.

Getting Started with vSphere

Command-Line Interfaces vSphere Command-Line Interface Solutions and Examples

See “ESXi Shell Local Access” on page 5

and

“Remote Access to ESXi Shell Using

SSH” on page 7.

“Replacing Agents” on page 9

.

See “Retrieving Networking

Information” on page 12.

“Logging in vSphere 5.0” on page 10

Figure 1 illustrates the differences between CLIs in ESXi 4.1 and ESXi 5.0.

 In ESX 4.1, a fairly large set of service console commands is available. A small set of ESXCLI commands is available in both the service console and as part of the vCLI package. The vCLI package includes, in addition to ESXCLI commands, a set of vicfg- commands and other commands for host management.

 ESXi 5.0 does not include a service console. In the ESXi Shell, you can run a much expanded set of ESXCLI commands and a small set of other commands. The same ESXCLI commands, as well as a few other commands, are included in the vCLI package for off-host management.

VMware, Inc.

2

Command-Line Management in vSphere 5.0 for Service Console Users

Figure 1. Command-Line Interfaces in ESX 4.1 and ESXi 5.0

Commands running on host vCLI

ESX 4.1

ESXi 5.0

Service console commands

Commands running on host

ESXCLI ESXCLI vicfg-and other commands vCLI esxcfg-

(deprecated)

POSIX

(subset)

ESXCLI ESXCLI vicfg-and other commands

Using vSphere Client Interfaces

Most tasks you perform in the ESX Service Console can be performed by one of the graphical user interfaces to ESXi or vCenter Server systems. The interfaces allow you to manage your infrastructure, and to perform operations on multiple hosts at the same time.

 Install the vSphere Client on the Windows system of your choice and connect to an ESXi or vCenter Server system. Perform management operations using the client.

 Use the vSphere Web Client from one of the supported browsers. The vSphere Web Client is a new interface and supports primarily operations on virtual machines. vSphere 5.0 documentation explains how to perform tasks by using one of the client UIs. Online help is available from both client UIs.

Running vCLI or PowerCLI Commands from Remote Hosts

If you have scripts that use ESX 4.x service console commands or run commands in the ESX 4.x service console directly, running vCLI commands or PowerCLI cmdlets from the host on which you installed those packages gives the best results. Running off-host is highly recommended because it facilitates scripting.

You can use vCLI even if hosts are in lockdown mode by targeting the vCenterServer system and specifying the target ESXi host with the --vihost parameter, for example: esxcli --server <my_vc> --vihost <my_esxi> [<authentication>] storage nfs list

If you do not specify additional authentication parameters, the vCLI infrastructure prompts for a username and password for the vCenter Server system specified by --server.

vCLI Command Set

The vCLI command set includes common system administration commands which you can run against ESXi systems from any machine with network access to those systems. You can also run most vCLI commands against a vCenter Server system and target any ESXi system that vCenter Server system manages.

Install the vCLI command set on a supported versions of Windows or Linux. The user running a command against a server must be authenticated for that server. The vCLI package includes several command sets.

VMware, Inc.

3

VMware, Inc.

Command-Line Management in vSphere 5.0 for Service Console Users

Command Set

ESXCLI vCLI commands vicfg- (esxcfg-) vCLI commands

Management commands

Description

Extensible command framework for managing many aspects of vSphere.

Run esxcli --help to see all top-level namespaces. You can run --help at any level of the hierarchy.

The esxcli command set in the ESXi Shell and the esxcli vCLI command set support the same functionality. When running vCLI commands, you must specify the target server and authentication options.

Set of commands for managing many aspects of vSphere. For each vicfg- vCLI command, the package includes an esxcfg- vCLI command that is equivalent of the vicfg- vCLI command.

Important: esxcfg- vCLI commands are not always equivalent to corresponding esxcfg- service console or ESXi Shell commands.

vicfg commands will be deprecated in future releases. Use esxcli commands instead where possible.

A small set of management commands is available. Commands include vifs for file migration, vmware-cmd for managing virtual machines, and vmkfstools for VMFS file management.

The following documentation helps you work with vCLI commands.

Getting Started with vSphere Command-Line Interfaces gives overviews of available commands and includes instructions for installing vCLI on Widows or Linux and detailed information about connection options.

vSphere Command-Line Interface Concepts and Examples presents usage examples for many commands, such as setting up software and hardware iSCSI, adding virtual switches, setting up Active Directory authentication, and so on. The document includes the same example with the vicfg- command and the

ESXCLI command where supported.

vSphere Command-Line Interface Reference is a reference to both vicfg- commands and ESXCLI commands.

The vicfg- command help is generated from the POD available for each command, run pod2html for any vicfg- command to generate individual HTML files interactively. The ESXCLI reference information is generated from the ESXCLI help.

Running ESXCLI Commands Against ESXi 4.x Hosts

When you run an ESXCLI vCLI command, you must know the commands supported on the target host specified with --server or as a vMA target.

 If you run commands against ESXi 4.x hosts, ESXCLI 4.x commands are supported.

 If you run commands against ESXi 5.0 hosts, ESXCLI 5.0 commands are supported.

VMware partners might develop custom ESXCLI commands that you can run on hosts where the partner VIB has been installed.

Run esxcli --server <target> --help for a list of namespaces supported on the target. You can drill down into the namespaces for additional help.

I MPORTANT ESXCLI on ESX 4.x hosts does not support targeting a vCenter Server system. You can therefore not run commands with --server pointing to a vCenter Server system even if you install vCLI 5.0.

PowerCLI Cmdlet Set

VMware offers a comprehensive set of PowerCLI cmdlets. You can install the PowerCLI package on a

Windows system on which Microsoft PowerShell is installed and use PowerCLI cmdlets to manage hosts and virtual machines. PowerCLI cmdlets and vCLI commands overlap in functionality. The PowerCLI focus is on virtual machine management. The vCLI focus is on host management.

See the vSphere PowerCLI documentation set, available in the VMware Administration Automation Products section of http://www.vmware.com/support/pubs .

4

Command-Line Management in vSphere 5.0 for Service Console Users

Using the ESXi Shell

Each ESXi host includes an ESXi Shell, which is disabled by default. Administrators can use that shell to perform troubleshooting and advanced tasks such as testing scripts in non production environments.

You can access the shell as follows:

 Enable local access and use the local shell on the physical console or using a serial port. See

Local Access” on page 5.

“ESXi Shell

Enable SSH access and use the shell over a management network with SSH. See page 5.

“ESXi Shell Access” on

I MPORTANT ESXi Shell is intended for experienced CLI users. Minor errors in the shell can result in serious problems. Instead of running commands directly in the ESXi Shell, use vCLI commands or PowerCLI cmdlets.

The ESXi Shell includes the following command sets.

Command Set Description

ESXCLI commands esxcfg commands

(deprecated)

Other commands

Extensible command framework for managing many aspects of vSphere.

Run esxcli --help to see all top-level namespaces. You can run --help at any level of the hierarchy.

The esxcli command set in the ESXi Shell and the esxcli vCLI command set support the same functionality. When running vCLI commands, you must specify the target server and authentication options.

Set of commands for managing many aspects of vSphere. Most esxcfg- commands available in the ESX 4.x service console are available in the ESXi Shell but are deprecated in ESXi 5.0 and will be removed in a future release.

Use ESXCLI commands instead of esxcfg- commands. If no ESXCLI command exists, use the vicfg commands in the vCLI command set.

A small set of POSIX-style commands is included in the shell (see

“Shell Commands” on page 9). These commands are not supported by VMware but are included for use in

troubleshooting situations. Use the vSphere Client or VMware commands instead where possible. localcli commands Set of troubleshooting commands for use with VMware Technical Support. localcli commands equivalent to ESXCLI commands but bypass the host daemon (hostd).

Warning: localcli commands are only for situations when hostd is unavailable and cannot be restarted. After you run a localcli command, you must restart hostd. Using localcli commands in other situations is not supported. An inconsistent system state and potential failure can result.

ESXi Shell Access

An ESXi system includes a direct console that allows you to start and stop the system and to perform a limited set of maintenance and troubleshooting tasks. The direct console includes the ESXi Shell. The ESXi Shell includes a set of fully supported ESXCLI commands and a set of commands for troubleshooting and remediation. You must enable access to the ESXi Shell from the direct console of each system. You can enable access to the local ESXi Shell or access to the ESXi Shell with SSH.

ESXi Shell Local Access

The ESXi Shell is disabled by default. You can enable the ESXi Shell for troubleshooting from the direct console.

All ESXCLI commands that are available in the ESXi Shell are also included in the vCLI package. Install the vCLI package or deploy the vMA virtual appliance, and run commands against your ESXi hosts, instead of running commands in the ESXi Shell itself. See Getting Started with vSphere Command-Line Interfaces.

Enabling the ESXi Shell

You can enable the ESXi Shell from the direct console and from the vSphere Client. Enabling the ESXi Shell means making it accessible as a local console available directly or over an out-of-band network.

VMware, Inc.

5

Command-Line Management in vSphere 5.0 for Service Console Users

VMware, Inc.

To enable the ESXi Shell from the Direct Console

1 Access the direct console of the ESXi host, press F2, and provide credentials when prompted.

2 Scroll to Troubleshooting Options, and press Enter.

3 Select Enable ESXi Shell and press Enter.

On the left, Enable ESXi Shell changes to Disable ESXi Shell. On the right, ESXi Shell is Disabled changes to ESXi Shell is Enabled.

4 (Optional) Configure the time-out for the ESXi Shell a Select Modify ESXi Shell timeout and press Enter.

b Enter the time-out value in seconds and press Enter.

5 Press Esc until you return to the main direct console screen.

You can enable the ESXi Shell from the vSphere Client.

To enable the local or remote ESXi Shell from the vSphere Client

1 Select the host, click the Configuration tab, and click Security Profile in the Software panel.

2 In the Services section, click Properties.

3 Select ESXi Shell and click Options.

4 Change the ESXi Shell options.

 To temporarily start or stop the service, click the Start or Stop button.

 To enable access permanently, click Start and stop with host. The change will take effect the next time you reboot the host.

5 Click OK.

6 (Optional) Configure the time-out for the ESXi Shell from the vSphere Client. a In the Configuration tab’s Software panel, click Advanced Settings.

b In the left panel, click UserVars. c Locate UserVars.ESXiShellTimeOut and enter the timeout value in minutes.

d Click OK.

After you have enabled the ESXi Shell, you can use it from that monitor or through an out-of-band network connection.

Accessing the ESXi Shell with the Direct Console

After you enable ESXi Shell access, you can access the local shell.

To access the local ESXi Shell

1 At the main direct console screen, press Alt-F1 to open a virtual console window to the host.

2 Provide credentials when prompted.

When you type the password, characters are not displayed on the console.

3 To log out, type exit in the shell.

4 To return to the direct console, press Alt-F2.

Setting ESXi Shell Timeout

The ESXi Shell timeout setting specifies how long you can leave an unused session open. By default, the timeout for the ESXi Shell is 0, which means the session remains open even if it is unused. If you change the timeout, for example, to 30 minutes, you have to log in again after the timeout period has elapsed.

6

Command-Line Management in vSphere 5.0 for Service Console Users

The unit of measurement for the timeout is seconds in the ESXi Shell and minutes in the vSphere Client.

N OTE If you are logged in when the timeout period elapses, your session will persist. However, the ESXi Shell will be disabled, preventing other users from logging in.

You can modify the timeout from the Direct Console (in seconds) or from the vSphere Client (in minutes).

To modify the ESXi Shell Timeout

In the Direct Console, follow these steps. a Select Modify ESXi Shell timeout and press Enter.

b Enter the time-out value in seconds and press Enter.

In the vSphere Client, follow these steps.

a In the Configuration tab’s Software panel, click Advanced Settings.

b In the left panel, click UserVars. c Locate UserVars.ESXiShellTimeOut and enter the timeout value in minutes.

d Click OK.

Remote Access to ESXi Shell Using SSH

If Secure Shell is enabled for the ESXi Shell, you can run shell commands by using a Secure Shell client such as SSH or PuTTY.

Enabling SSH for the ESXi Shell

By default, you cannot access the ESXi Shell using a SSH client. You can enable SSH from the direct console.

To enable SSH access in the direct console

1 At the direct console of the ESXi host, press F2 and provide credentials when prompted.

2 Scroll to Troubleshooting Options, and press Enter.

3 Select Enable SSH and press Enter once.

On the left, Enable SSH changes to Disable SSH. On the right, SSH is Disabled changes to SSH is

Enabled.

4 Press Esc until you return to the main direct console screen.

You can enable remote command execution from the vSphere Client.

To enable SSH from the vSphere Client

1 Select the host and click the Configuration tab.

2 Click Security Profile in the Software panel.

3 In the Services section, click Properties.

4 Select SSH and click Options.

5 Change the SSH options.

 To temporarily start or stop the service, click the Start or Stop button.

 To enable SSH permanently, click Start and stop with host. The change takes effect the next time you reboot the host.

6 Click OK.

After you have enabled SSH, you can use an SSH client to log in to the ESXi Shell and run ESXi Shell commands.

VMware, Inc.

7

Command-Line Management in vSphere 5.0 for Service Console Users

Accessing the ESXi Shell with SSH

If SSH is enabled on your ESXi host, you can use an SSH client to run commands on that shell.

To access the ESXi Shell with SSH

1 Open an SSH client.

2 Specify the IP address or domain name of the ESXi host.

Precise directions vary depending on the SSH client you use. See vendor documentation and support.

3 Provide credentials when prompted.

ESXi Shell Commands

The ESXi Shell includes several sets of commands.

Table 1. ESXi Shell Commands

Command Set Description

ESXCLI commands esxcfg commands

A large set of new ESXCLI commands supports many administrative tasks. The commands are fully supported and tested by VMware and include command-line help. See Getting Started with

vSphere Command-Line Interfaces.

The esxcfg- commands available in the service console are deprecated. The commands will be removed from the ESXi Shell in a future release. See

“Reference to Replacements for Service

Console Commands” on page 13.

See “Shell Commands” on page 9.

POSIX-like commands localcli commands Set of troubleshooting commands for use with VMware Technical Support. localcli commands are equivalent to ESXCLI commands but bypass the host daemon (hostd).

Warning: localcli commands are only for situations when hostd is unavailable and cannot be restarted. After you run a localcli command, you must restart hostd. Using localcli commands in other situations is not supported. An inconsistent system state and potential failure can result.

ESXCLI Commands

The ESXi Shell in ESXi 5.0 includes a large set of new ESXCLI namespaces and commands. The complete

ESXCLI command set is also part of the vCLI package. The ESXCLI command syntax in ESXi 5.0 is more flexible than the syntax in ESXi 4.x and supports multiple namespaces. esxcli [dispatch_option] <namespace> [namespace, ...] <cmd> [cmd_options]

Each command can use an arbitrary number of namespaces, and different commands have a different number of elements. All commands have also been reviewed for consistency and most commands have been renamed.

For example:

 Each get command returns single values.

 esxcli hardware memory get

The list commands are used for multiple return values.

esxcli hardware cpu list

Many commands have options. Use an equal sign or a space between the option and the option value. esxcli filesystem nfs add --host=<host_name> --share=<share_name> --volume=<volume_name> esxcli filesystem nfs add --host <host_name> --share <share_name> --volume <volume_name>

I MPORTANT For a complete list of ESXCLI commands, see the vSphere Command-Line Interface Reference. The

vSphere Command-Line Interface Concepts and Examples document illustrates how to perform common tasks with

ESXCLI or vicfg- commands.

VMware, Inc.

8

Command-Line Management in vSphere 5.0 for Service Console Users

Shell Commands

In contrast to VMware ESX, VMware ESXi does not include a console OS with a large set of shell commands and other software. However, a small set of shell commands is available in the ESXi Shell.

I MPORTANT The commands are not tested or supported by VMware. Use VMware commands such as

ESXCLI, vicfg- commands, and so on, instead.

You can see a list of commands in /usr/bin. When you list the commands with ls -al, notice that several of the utilities are redirected to commands appropriate in the vSphere environment. The following commands produce different results than typical shell commands.

 Several commands are redirected to vmkvsitools.

I MPORTANT vmkvsitools is intended for use with VMware Technical Support. Do not use vmkvsitools to manage your system.

 Ping commands are redirected to vmkping.

 Some additional commands are available in the ESXi Shell for certain troubleshooting tasks. Use these commands when instructed by a VMware Knowledge Base article or VMware Technical Support staff.

 User management commands are deprecated.

Go to /usr/bin and run ls -a to see a complete list.

Replacing Agents

With ESX 4.x, management agents and hardware monitoring and management agents run in the service console. With ESXi 5.0, agents are implemented in other ways.

Management agents. VMware partners create management agents by using one of the vSphere APIs.

Hardware agents. Developers use CIM (Common Information Model) agents. CIM is a standards-based approach to monitoring hardware resources. CIM output is readable by third-party management tools.

The VMkernel can include both VMware CIM providers and Partner CIM providers. Use a vSphere Client logged in to a vCenter Server system to view hardware information including alarms. Use the vSphere

Client extension framework or the vSphere CIM SDK for customization.

Infrastructure service agents. Administrators can use agents available in the ESXi Shell. Agents include hostd (host daemon), vpxa, NTP, syslog, SNMP, and so on. Use the vSphere SDK, vCLI commands, or

ESXCLI commands to manage the agents.

Table 2. Infrastructure Services for Production Environments

Function ESX ESXi

Built-in NTP service Time synchronization NTP agent in service console

Centralized log collection Syslog agent in service console

Built-in Syslog service

SNMP monitoring

Local access authentication

SNMP agent in service console

Active Directory (AD) agent in service console

Built in Active Directory service

Built-in SNMP service

Built-in Active Directory service

Management vicfg-ntp command esxcli system syslog commands vSphere Client vicfg-snmp command vSphere Client vicfg-authconfig vCLI command.

VMware, Inc.

9

Command-Line Management in vSphere 5.0 for Service Console Users

Logging in vSphere 5.0

Logging in vSphere 5.0 has been significantly enhanced. You now have fine-grained control over system logs, the location where logs are sent, and, for each log, default size and rotation policy. You can set up logging with the vSphere Client or with the esxcli system syslog command. You can also set up logging behavior for a host by using the Host Profiles interface in the vSphere Client and can then import that host profile into other hosts.

Remote Logging Setup in ESXi

You can move most ESXi logging information off the host. Collecting data to a central location is especially useful for hosts provisioned with Auto Deploy. You can perform these tasks:

 Set up NTP on the ESXi hosts you are monitoring and on the systems that host the logging services or store the logs. You can use the vSphere Client or the vicfg-ntp vCLI command to set up NTP.

 Configure syslog to save logs to a remote host. You can send logs to a specific directory, and configure subloggers. See

“Using ESXCLI for Syslog Configuration” on page 10.

 vCenter Server and ESXi have SNMP agents. You can set up the vCenter Server SNMP agent with the vSphere Client. You can set up the ESXi SNMP agent with the vSphere Client or the vicfg-snmp command. See vSphere Command-Line Interface Solutions and Examples.

 Listen for CIM indications.

Using ESXCLI for Syslog Configuration

The esxcli system syslog command allows you to configure the logging behavior of your ESXi system.

You can perform the same customizations with the vSphere client, as discussed in the vCenter Server and Host

Management documentation. The command has the following options:

Table 3. esxcli syslog Options

Option Description mark reload config get config set config logger list config logger set

Mark all logs with the specified string.

Reload the configuration and update any configuration values that have changed.

Retrieve the current configuration.

Set the configuration. Use one of the following options.

 --logdir=<path> – Save logs to a given path.

 --loghost=<host> below)

– Send logs to a given host (see discussion on loghost format

 --logdir-unique=<true|false> – Specify whether the log should go to a unique subdirectory of the directory specified in logdir.

 --default-rotate=<int> – Default number of log rotations to keep

 --default-size=<int> – Size before rotating logs, in kilobytes.

Show currently configured sub-loggers.

Set configuration options for a specific sublogger. Use one of the following options:

 --id=<str> – ID of the logger to configure (required)

 --reset=<str> – Reset values to default

 --rotate=<long>

--id )

– Number of rotated logs to keep for a specific logger (requires

 --size=<long>

(requires --id)

– Set size of logs before rotation for a specific logger, in kilobytes

VMware, Inc.

10

Command-Line Management in vSphere 5.0 for Service Console Users esxcli system syslog Examples

The following workflow illustrates how you might use esxcli system syslog for log configuration.

1 Show configuration options. esxcli system syslog config get

Default Rotation Size: 1024

Default Rotations: 8

Log Output: /scratch/log

Logto Unique Subdirectory: false

Remote Host: <none>

2 Set all logs to keep twenty versions, then start overwriting the oldest log. esxcli system syslog config set --default-rotate=20

3 Set the rotation policy for VMkernel logs to 10 rotations, rotating at 2MB. esxcli system syslog config logger --id=vmkernel --size=2048 --rotate=10

4 Send logs to remote host myhost.mycompany.com. The logs will use the default UDP port, 514. esxcli system syslog config set --loghost='myhost.mycompany.com'

5 Send logs /scratch/mylogs on the remote host myhost.mycompany.com using TCP/IP port 1514. esxcli system syslog config set --loghost='tcp://myhost.mycompany.com:1514'

--logdir='/scratch/mylogs'

6 Send a log message into all logs simultaneously. esxcli system syslog mark --message="this is a message!"

7 Reload the syslog daemon and apply configuration changes. esxcli system syslog reload

Viewing Logs in the ESXi Shell

In the ESX 4.x shell, the location for logs is /var/log. In the ESXi Shell, you can also find all current logs in the

/var/log directory. Some of the logs are symbolic links to the /var/run/log directory.

Most logs are at top level and not inside a directory under /var/run/log. Available logs depend on which plugins are installed and what other changes might have been made to the system. The following table lists some frequently used logs in the ESXi Shell.

ESX 4.x shell

/var/log/vmware/hostd.log

/var/log/vmkwarning

/var/log/vmksummary

/var/log/messages

ESXi 5.0 shell

/var/log/hostd.log

/var/log/vmkwarning.log

/var/log/vmksummary.log

/var/log/vmkernel.log

Description

Log for the host daemon.

/var/log/vmware/vpx/vpxa.log

/var/log/vpxa.log

VMkernel warnings and VMkernel events. vCenter Server agent log.

Core Dump Setup for ESXi

A core dump can be used to determine the reason for system failure. With ESX, the core dump was placed on the local disk in many cases. With ESXi, you have two options for managing core dumps.

Create a diagnostic partition on SAN storage. Each host must have a diagnostic partition of 100MB. If multiple hosts share a SAN, configure a diagnostic partition with 100MB for each host.

Install and configure ESXi Dump Collector. New in ESXi, the Dump Collector service allows you to send core dumps to a network server. ESXi Dump Collector is especially useful for determining reasons for failure of ESXi hosts provisioned with Auto Deploy.

VMware, Inc.

11

Command-Line Management in vSphere 5.0 for Service Console Users

You can use esxcli system coredump to configure a remote or local core dump partition. You can also use the Network Configuration host profile to set up hosts to use ESXi Dump Collector. For either case, you can apply the host profile of a host that uses ESXi Dump Collector to other hosts.

To use ESXi Dump Collector

1 Install the ESXi Dump Collector service on the vCenter Server system or a Windows or Linux system of your choice.

ESXi Dump Collector is one of the services you can install using the vCenter Server system installation package. See vSphere Installation and Setup.

If you use the vCenter Server on Linux appliance, ESXi Dump Collector is preinstalled.

2 Set up ESXi systems that should use ESXi Dump Collector with commands in the esxcli system coredump namespace.

Two namespaces are supported inside this namespace.

 esxcli system coredump partition

 get : Retrieve one of the dump partition values. list : List all partitions on the system that have a partition type matching the VMware Core partition type. set : Set the core dump partition for this system. esxcli system coredump network

 get : Get the currently configure parameters for ESXi Dump Collector (network coredump), if enabled. set : Set the parameters used for network coredump.

The following example sets up the network and enables ESXi Dump Collector with the ESXCLI vCLI command. esxcli --server MyESXiHost system coredump network set --interface-name vmk0 --server-ipv4 10XX...

--port 6500 esxcli --server MyESXiHost system coredump network get --enable true --type network

You are prompted for a user name and password for the ESXi host.

Retrieving Networking Information

Linux commands for retrieving networking information are not included in the ESXi Shell. You can instead use ESXCLI commands.

On ESXi 5.0, ifconfig information is the information for the VMkernel NIC that attaches to the Management

Network port group. You can retrieve that information by using ESXCLI commands. esxcli network ip interface list esxcli network ip interface ipv4 get -n vmk<X> esxcli network ip interface ipv6 get -n vmk<X> esxcli network ip interface ipv6 address list

You can retrieve information about DNS with the esxcli network ip dns command in the following two namespaces: esxcli network ip dns search esxcli network ip dns server

For information corresponding to the Linux netstat command, use the following ESXCLI command. esxcli network ip connection list

VMware, Inc.

12

Command-Line Management in vSphere 5.0 for Service Console Users

Adding Third-Party Extensions to Hosts

The process of adding patches is simplified in ESXi 5.0. All patches and third-party extensions can be made available as VIB packages. When a VMware partner releases a third-party extension as a VIB package, the partner can make the package available as a ZIP depot (offline depot).

1 Download the ZIP depot to your ESXi system but do not unpack it.

2 Run esxcli software vib to add the package to your system.

3 Reboot your ESXi system

The VIB system refreshes the host daemon after you reboot your system. If the VIB requires an exception to the firewall rules, rebooting also updates the firewall ruleset.

You can instead use a firewall configuration file to specify port rules for host services you want to enable for the extension.

vSphere Security documentation discusses how to add, apply, and refresh a firewall rule set and lists the esxcli network firewall commands. The ESXi 5.0 ruleset.xml format is the same as in ESX/ESXi 4.x, but has two additional tags, enabled and required. The ESXi 5.0 firewall still supports the old format.

vSphere Upgrade documentation discusses using esxcli software sources and esxcli software vib to explore and install patches and extensions.

In some situations, you might use vSphere Update Manager instead of the esxcli command to install third-party extensions. The extension vendor provides information on the install or upgrade process.

Reference to Replacements for Service Console Commands

Table 4

lists common ESX/ESXi 4.x service console commands and corresponding ESXi 5.0 shell commands.

I MPORTANT This document does not present a complete list of ESXCLI commands. The focus is on replacing existing service console commands. See the vSphere Command-Line Interface Reference for a complete list of commands.

The links in the Command column of the table point to more detailed information for each command, with corresponding ESXCLI commands for each option where available. Click the link in the More Information column for a table with detailed information about that command.

Table 4. Replacements for Service Console Commands

Service Console

Command esxcli esxcfg-advcfg esxcfg-dumppart esxcfg-firewall esxcfg-info esxcfg-ipsec

ESXi 5.0 Replacement

Syntax for most ESXCLI commands has changed. esxcli system settings advanced esxcli system coredump

More Information

Deprecated

ESXi Shell

“ESXCLI Command

Syntax” on page 14

No

“esxcfg-advcfg” on page 17

Yes

“esxcfg-dumppart” page 18

on

Yes

vSphere Security documentation.

N.A.

In ESX 4.x, protects the service console. In ESXi 5.x, esxcfg-firewall is not necessary because no service console exists.

The esxcli network firewall command is available for

ESXi firewall management.

Provides a view of the internal state of the VMkernel and service console components. Some of the functionality is covered by certain ESXCLI commands. vicfg-ipsec vCLI command

“esxcfg-info” on page 19

vSphere Command-Line

Interface Concepts and

Examples

No

No

VMware, Inc.

13

Command-Line Management in vSphere 5.0 for Service Console Users

Table 4. Replacements for Service Console Commands (Continued)

Service Console

Command ESXi 5.0 Replacement esxcli iscsi esxcfg-swiscsi esxcfg-hwiscsi esxcfg-module esxcli system module esxcfg-mpath esxcfg-nas esxcfg-nics esxcfg-rescan esxcfg-route esxcfg-scsidevs esxcfg-vmknic esxcfg-volume esxcfg-vswif esxcfg-vswitch esxtop esxupdate vmkfstools vmkping vmware-cmd vm-support

More Information

“esxcfg-swiscsi and esxcfg-hwiscsi” on page 20

Deprecated

ESXi Shell

Yes esxcli storage core path commands. esxcli storage nfs esxcli network nic esxcli storage core commands.

vicfg-route vCLI command

Use esxcli storage core and esxcli storage core filesystem commands. esxcli network interface covers most options and includes a number of options not available in the esxcfg-vmknic command. esxcli storage filesystem

“esxcfg-module” on page 21

“esxcfg-mpath”

“esxcfg-nas”

on page 22

on page 22

“esxcfg-nics” on page 23

Yes

Yes

Yes

Yes

“esxcfg-rescan” on page 23

Yes

“esxcfg-scsidevs” on page 21

“esxcfg-vmknic” on page 24

“esxcfg-volume” on page 25

Used to configure service console networking in 4.x systems.

Not needed and not available in the ESXi 5.0 ESXi Shell. esxcli network vswitch standard for standard switches. esxcli network vswitch dvs for distributed switches.

Supported in the 5.0 ESXi Shell. If you do not have access to the ESXi Shell, use the resxtop remote vCLI command from a supported Linux system or from vMA.

esxcli software vib

Note: Both esxupdate and vihostupdate are not supported against ESXi 5.0 hosts.

The vmkfstools command is available in the ESXi 5.0 Shell.

The vmkfstools vCLI command options differ slightly from the shell command options.

No change and not deprecated.

“esxcfg-vswitch” page 25

“esxtop”

on

on page 27

“esxupdate” on page 27

“vmkfstools” on page 28

Not available in ESXi Shell. Available in vCLI. In many cases,

VMware PowerCLI cmdlets perform the same tasks as vmware-cmd .

Creates a tar archive containing debugging information for the server.

This command is intended for use with VMware Support. No equivalent vCLI command exists.

Use vmkping --help for information.

Use vmware-cmd --help for information.

Use vm-support --help for more information.

No

Yes

Yes

Yes

Yes

Yes

No

Yes

No

No

Yes

No

ESXCLI Command Syntax

In ESXi 4.x, all ESXCLI commands must follow the same syntax. esxcli <conn_options> <namespace> <app> <cmd> [cmd_options]

In ESXi 5.0, the ESXCLI command syntax is more flexible. Each command can use an arbitrary number of namespaces. Different commands have a different number of elements. esxcli <conn_options> <namespace> [namespace, ...] <cmd> [cmd_options]

I MPORTANT You must update all ESXCLI commands explicitly; no scripts are available for the task. Starting with vSphere 5.0, most management commands will be ESXCLI commands.

VMware, Inc.

14

Command-Line Management in vSphere 5.0 for Service Console Users

The following table lists equivalent commands for esxcli corestorage commands.

Table 5. esxcli 4.x corestorage namespace

ESXCLI in ESXi 4.x corestorage claiming reclaim --<option>

ESXCLI in ESXi 5.0

storage core claiming reclaim --<option> corestorage claiming unclaim --<option> corestorage claimrule add --<options> corestorage claimrule convert --commit storage core claiming unclaim --<option> storage core claimrule add --<options>

Several new options for this command are available. See the

vSphere Command-Line Interface Reference, or run the command with --help. storage core claimrule convert --commit corestorage claimrule delete --<option> corestorage claimrule list --claimrule storage core claimrule remove --<option> corestorage claimrule load --claimrule-class storage core claimrule list --claimrule-class corestorage claimrule move --<option> storage core claimrule load --claimrule-class corestorage claimrule run --<option> storage claimrule move --<option> corestorage device list --device corestorage plugin list --plugin-class storage core claimrule run --<option> storage core device stats get storage core device list --device

Other list commands are included in this namespace.

storage core plugin list --plugin-class

VMware, Inc.

15

Command-Line Management in vSphere 5.0 for Service Console Users

The following table lists equivalent commands for esxcli storage nmp commands.

Table 6. esxcli nmp namespace esxcli storage nmp commands in ESXi 4.x

esxcli storage nmp commands in ESXi 5.0

nmp device list --list nmp device list --device nmp device list nmp device list --device nmp device setpolicy <option> nmp path list [--device|--path] nmp fixed getpreferred <option> nmp psp list nmp psp getconfig [--device|--path] nmp psp setconfig

[--config|--device|--path] nmp roundrobin getconfig <option> nmp roundrobin setconfig <option> nmp satp list nmp satp listrules nmp satp addrule <option> nmp satp deleterule <option> nmp satp getconfig --device nmp satp getconfig --path nmp satp setconfig --config --device nmp satp setconfig --config --path nmp satp setdefaultpsp [--boot | --psp |

--satp] nmp device set <option> nmp psp generic deviceconfig get --device nmp psp fixed deviceconfig set <option> nmp psp generic deviceconfig get [--device] nmp psp generic deviceconfig set

[--config|--path] nmp psp roundrobin deviceconfig get <option> nmp psp roundrobin deviceconfig set <option> nmp satp list nmp satp rule list nmp satp rule add <option> nmp satp rule remove <option> nmp satp generic deviceconfig get --device nmp satp generic pathconfig get --path nmp psp generic deviceconfig set nmp psp generic pathconfig set nmp satp setdefaultpsp [--boot | --psp | --satp]

The esxcli network commands included in ESXCLI 4.1 have been renamed. Many additional networking commands are available in ESXCLI 5.0.

Table 7. esxcli network namespace esxcli 4.x

esxcli 5.0

network neighbors list network connection list network ip neighbor list network ip connection list

Comment

List ARP table entries.

List active TCP/IP connections.

The esxcli swiscsi namespace supports a few management commands for software iSCSI in ESXi 4.1. The commands have been renamed. ESXCLI equivalents have also been added for the esxcfg-swiscsi and esxcfg-hwiscsi commands.

Table 8. esxcli swiscsi namespace

ESXCLI 4.x

swiscsi nic [--add |

--list | --remove] swiscsi vmknic --list esxcli 5.0

Comment iscsi networkportal [add | list

| remove]

Perform operations on the iSCSI network portal (iSCSI VMkernel NIC).

iscsi logicalnetworkportal list Perform operations on the iSCSI logical network portal.

VMware, Inc.

16

Command-Line Management in vSphere 5.0 for Service Console Users

Table 8. esxcli swiscsi namespace (Continued)

ESXCLI 4.x

esxcli 5.0

swiscsi vmnic --list swiscsi session [--add |

--list | --remove] iscsi physicalnetworkportal list iscsi session [add | list | remove]

Comment

Perform operations on the iSCSI physical network portal (uplink).

Perform operations on iSCSI sessions.

Note: The add and remove commands are intended only for use by VMware partners.

Use the iscsi session connection namespace to perform operations on the iSCSI connection.

The 4.1 esxcli vms namespace allows you to list virtual machines and forcibly stop them. The namespace has been renamed. esxcli 4.x

vms vm kill vms vm list esxcli 5.0

vm process kill vm process list

Comment

Forcibly kill virtual machines that are not responding to normal stop operations. Requires the type of kill operation (soft, hard, force) and the world ID of the virtual machine to kill.

Display the world ID of virtual machines on the host. esxcfg-advcfg

Instead of esxcfc-advcfg, use esxcli system settings advanced. The following commands are supported.

Table 9. esxcfg-advcfg Replacement Commands esxcfg-advcfg option ESXCLI Command

-g|--get system settings advanced list

-o= option

-s|--set <value>

-d|--default

-l|--list system settings advanced set system settings advanced set

-d|--default system settings advanced list

Description

Get the value of the VMkernel advanced configuration option. Us --option to retrieve information for a single option, or

--tree to limit the list to a specific subtree.

Set the value of the VMkernel advanced configuration option.

Reset a VMkernel advanced configuration option to default.

List all VMkernel advanced configuration options.

-q|--quiet

-k|--set-kernel

No longer supported system settings kernel set

-j|--get-kernel system settings kernel list

Set a VMkernel load time option value for the next boot.

Get a VMkernel load time option value for the next boot.

-c|--get-config

-m|--set-message

Not supported system welcomemsg set

-u|--uuid system uuid get

-G|--get-user-var system settings advanced list | grep

<var>

-S|--set-user-var system settings advanced set

Set the welcome message for the direct console. You can retrieve the message with system welcomemsg get .

Ensure the VMkernel system UUID is set and print it.

Get the value of a user-specified generic value.

Set the value of a user-specified generic value.

VMware, Inc.

17

Command-Line Management in vSphere 5.0 for Service Console Users

Table 9. esxcfg-advcfg Replacement Commands (Continued) esxcfg-advcfg option ESXCLI Command

-D|--del-user-var Adding or deleting user variables is no longer supported.

-U|--user-var --option=<str>

-A|--add-option

<name>

-T|--add-type

-E|--add-desc

-F|--add-default

-N|--add-min

-M|--add-max

-H|--add-hidden

<val>

-L|--del-option

<name>

-V|--has-option

<name>

-r|--restore

Description

Name of the user variable to use for when retrieving and setting user variables.

No longer supported.

This option was used to add CIM options. Use the CIM SDK instead.

Adding or deleting user variables is no longer supported.

Adding or deleting user variables is no longer supported.

Adding or deleting user variables is no longer supported.

Adding or deleting user variables is no longer supported.

Adding or deleting user variables is no longer supported.

Adding or deleting user variables is no longer supported.

No longer supported.

This option was used to add CIM options. Use the CIM SDK instead.

Use esxcli system settings advanced list to list all options instead.

The ESXCLI command lists the value of the

VMkernel advanced configuration options.

The output includes the current setting for each option.

No longer available. Internal use only in previous versions. esxcfg-dumppart

When using the ESXi Shell, you can configure your system to save core dumps to a local partition or to use the

ESXi Dump Collector and save core dumps to a prespecified local or remote partition.

 Use esxcli coredump partition commands to configure a local dump partition.

 Install ESXi Dump Collector to support sending core dumps to a remote host and run esxcli coredump network commands to configure the remote dump partition.

I MPORTANT You can no longer use esxcfg-dumppart to enable core dumps. Use ESXCLI instead.

The following table lists the esxcfg-dumppart command options and corresponding ESXCLI commands.

VMware, Inc.

18

Command-Line Management in vSphere 5.0 for Service Console Users

Table 10. esxcfg-dumppart Replacement Commands esxcfg-dumppart Option

-l | --list

-t | --get-active

-c | --get-config

-S | --smart-activate

-a | --activate

-d | --deactivate

-s <naa.xx:1> | --set

<naa.xxxxxxxx:1>

ESXCLI Command system coredump partition list system coredump partition get system coredump partition get system coredump partition set

--smart --enable= true system coredump partition set

--enable=true system coredump partition set

--enable=false system coredump partition set

--partition xxx.xxx

Description

List all partitions on the ESXi system that have the appropriate partition type to act as a diagnostic partition.

Important: Execution might take several minutes and slow down your

ESXi host because the command scans all LUNs on the system.

Display the active diagnostic partition for this system. Running the ESXCLI command returns the active configured partition.

If an active partition exists, the command returns the naa number of the LUN and the corresponding partition, in the format naa.xx...:p.

Get the configured diagnostic partition for the system.

Run the smart activate algorithm to activate the configured dump partition, or if no partition is configured, select the best possible candidate based on the media of the available dump partitions.

Make the specified partition the current diagnostic partition.

Deactivate the active diagnostic partition or deactivate ESXi Dump

Collector.

C AUTION : If you run this command, your system cannot write errors to a file until another partition is activated.

You lose any error record if errors occur.

Set and activate the diagnostic partition. Specify the partition using naa.xxx:1 or eui.xxx syntax.

-C | --copy [-n |

--newonly] [-z |

--zdumpname] [-o |

--slot]

-L --log

No corresponding ESXCLI command.

No corresponding ESXCLI command. esxcfg-info

No comprehensive set of equivalent ESXCLI commands corresponding to esxcfg-info is available yet. The following commands are offering some of the esxcfg-info capability.

Table 11. ESXCLI Information Retrieval Commands

Command hardware bootdevice list hardware clock get hardware cpu cpuid get harware cpu cpuid get --cpu=<n>

Description

List the boot device order for this host, if available.

Display the current hardware clock time.

Get information from the CPUID instruction on each

CPU on this host.

Get information from the CPUID instruction on CPU number <n>.

VMware, Inc.

19

Command-Line Management in vSphere 5.0 for Service Console Users

Table 11. ESXCLI Information Retrieval Commands (Continued)

Command Description hardware cpu global get hardware cpu list hardware memory get hardware pci list

List information and configuration global to all CPUs.

List all CPUs on this host.

Get information about memory.

List all the PCI devices on this host. hardware platform get network vswitch standard list

Get information about the platform.

List the virtual switches on the ESXi host.

esxcli network vswitch standard policy shaping get Retrieve the network shaping information for the virtual switch.

esxcli network vswitch standard policy failover get Retrieve the failover policy information for the virtual switch.

esxcli network vswitch standard policy security get Retrieve the security policy information for the virtual switch.

network vswitch standard portgroup policy shaping get

Retrieve the network shaping information for the port group.

network vswitch standard portgroup policy failover get network vswitch standard portgroup policy security get

Retrieve the failover policy information for the port group.

Retrieve the security policy information for the port group.

network nic list network ip interface list network ip dns server list

List the physical NICs currently installed and loaded on the system.

List the VMkernel network interfaces currently known to the system.

Print a list of the DNS server currently configured on the system in the order in which they will be used.

esxcfg-swiscsi and esxcfg-hwiscsi

The ESX 4.x service console includes two commands for iSCSI management.

The esxcfg-swiscsi command manages software iSCSI. Equivalent ESXCLI commands are available in vSphere 5.0.

Table 12. esxcfg-swiscsi Replacement Commands esxcfg-swiscsi Option

-e --enable

-D --disable

-q --query

-s --scan

-k --kill

-r --restore

ESXCLI Command Description iscsi software set --enabled=true Enable Software iSCSI on the system, if disabled.

iscsi software set

--enabled=false

Disable Software iSCSI on the system, if enabled.

iscsi software get iscsi adapter discovery rediscover

-A <adapter_name> storage core adapter rescan [-A

<adapter_name> | -all]

Check if Software iSCSI is enabled or disabled on the system.

Scan the system for disks available through

Software iSCSI interface. Call the two commands in order.

Not supported

Not supported

The esxcfg-hwiscsi command managed hardware iSCSI.

VMware, Inc.

20

Command-Line Management in vSphere 5.0 for Service Console Users

Table 13. esxcfg-hwiscsi Replacement Commands esxcfg-hwiscsi Option

-l

-a [allow | deny]

<vmkernel_SCSI_adapter>

-j [enable | disable]

<vmkernel_SCSI_adapter>

ESXCLI Command iscsi physicalnetworkportal param get

1. Find the adapter.

iscsi adapter list

2. Get ARP redirection information. iscsi physicalnetworkportal param get -A vmhba4

3. Enable ARP redirect. iscsi physicalnetworkportal param set --option

ArpRedirect=true -A vmhba4

1. Find the adapter.

iscsi adapter list

2. Get jumbo frame information.

iscsi physicalnetworkportal param get -A vmhba4

3. Enable jumbo frame support.

iscsi physicalnetworkportal param set --option

ArpRedirect=true --adapter=vmhba4

Description

List current configuration

Allow or deny ARP redirection on the adapter.

Enable or disable jumbo frame support.

esxcfg-scsidevs

The esxcfg-scsidevs command has equivalent ESXCLI commands for some of the options.

Table 14. esxcfg-scsidevs Replacement Commands esxcfg-scsidevs Option ESXCLI Command Description

-a |--hbas

-l | --list

-c

-u

-m

-f storage core adapter list storage core device list storage core device list storage filesystem list

Print the mappings for each SCSI host bus adapter (HBA) to the information about that adapter.

List all the storage devices known to the system, including both SCSI and non-SCSI devices. The list can be filtered using the --device option to limit the output to specific device.

List all the device unique identifiers. Include the mapping from primary identifier to all secondary identifiers. The list can be filtered using the --device option to limit the output to specific device.

Print the mappings from a VMFS volume to the device and partitions used in that VMFS.

ESXCLI does not have equivalent options for the --device, --vfat, and --hba-device-list filtering options.

The -o|--offline-cos-dev and -n|--online-cos-dev options are service console specific options and not applicable to ESXi 5.0.

esxcfg-module

The esxcfg-module command supports manipulation of the VMkernel loadable modules and device drivers.For the following esxcfg-module options, ESXCLI commands are available.

Table 15. esxcfg-module Replacement Commands esxcfg-module Option ESXCLI Command

--get-options <module_name>

-g <module_name> system module parameters list

--set-options <options>

<module_name>

-s <options> <module_name> system module parameters set

Description

Returns the option string configured to be passed to the module when the module is loaded.

Specifies the option string to be passed to the module when the module is loaded.

VMware, Inc.

21

Command-Line Management in vSphere 5.0 for Service Console Users

Table 15. esxcfg-module Replacement Commands (Continued) esxcfg-module Option ESXCLI Command Description

-e --enable

-d --disable

-q --query system module set

--enabled=true system module set

--enabled=false

Enable the given module, indicating that it should load at boot time.

Disable the given module and prevent it from loading at boot. Disabling the module has no immediate effect on the module state on a running system.

Query the system for the modules to load at boot.

-m --mod-name -<name>

-u --unload

--list

-l

-i --show-info

-f --force

-v --verbose -<level> system module list

--enabled=[true|false]

Not supported.

Not supported.

system module list

--loaded=[true|false] system module get system module parameters list system module <cmd>

--force

Not supported

List the set of currently loaded VMkernel modules.

Show information about the module. This command can be run against a module file.

Skip module validation for all options. The get and list commands do not support --force.

Display more verbose information. esxcfg-mpath

The esxcfg-mpath command supports listing information about Fibre Channel or iSCSI LUNs and changing a path’s state. In vSphere 5.0, equivalent ESXCLI commands are available.

Table 16. esxcfg-mpath Replacement Commands esxcfg-mpath Option ESXCLI Command

-l --list <path> |

<device>

-L --list-compact

-m --list-map storage core path list storage core device list

Not supported storage core device list

-b --list-paths

-G --list-plugins

-s --state storage core path list storage core plugin list storage core path setstate

--path=<path>

--state=[active|off]

Description

List detailed information for all paths on the system or for the specified path or device.

For devices currently registered with the PSA, list the filters attached to them. (Not an exact equivalent)

List all devices with their corresponding paths, or list paths for the specified device.

List all multipathing plugins loaded into the system.

At a minimum, this command returns NMP (Native

Multipathing Plugin). If other multipathing plugins have been loaded, they are listed as well.

Set the state of a given LUN path to either active or off. This option requires that the --path options is set and specifies either the path UID or the path runtime name.

If you are changing a path’s state, the change operation fails if I/O is active when the path setting is changed. Reissue the command. You must successfully perform at least one I/O operation before the change takes effect.

esxcfg-nas

The esxcfg-nas command manipulates NAS file systems associated with ESXi systems. In vSphere 5.0, equivalent ESXCLI commands are available.

VMware, Inc.

22

Command-Line Management in vSphere 5.0 for Service Console Users

Table 17. esxcfg-nas Replacement Commands esxcfg-nas Option

--add <name>

-a <name>

--delete <name>

-d <name>

--list

-l

--host <n_host>

-o <n_host>

--readonly

-y

--share <share>

-s <share>

ESXCLI Command storage nfs add storage nfs remove

--volume-name=<NAS_volume_name> storage nfs list storage nfs add --host storage nfs add --readonly

Description

Add a new NAS file system to the ESXi host.

You must specify the host name or IP address of the

NFS volume to add, the share name on the remote system, and the volume name to use for the NFS mount.

Remove an existing NFS volume from the ESXi host.

This command unmounts the NAS file system and removes it from the list of known file systems.

List all known NAS file systems with their mount name, share name, and host name. Indicate the mount status for each file system.

Add or remove a specified NAS host (not ESXi host).

Used with other options.

Add the new NFS file system with read-only access.

storage nfs add --share=<share> Add or remove a specified NAS host (not ESXi host.

Used with other options.

ESXCLI also includes commands to mount and unmount the NAS filesystem. esxcfg-nics

The esxcfg-nics command manages physical NICs (uplink adapters) used by an ESXi host. In vSphere 5.0, equivalent ESXCLI commands are available.

Table 18. esxcfg-nics Replacement Commands esxcfg-nics Option ESXCLI Command Description

--auto

-a

--duplex

[full|half] <nic>

-d [full|half]

<nic>

--list

-l

--speed <speed>

<nic>

-s <speed> <nic> network nic set

--auto network nic set

--duplex network nic list network nic get

<adapter> network nic set

--speed=<long>

Set the specified network adapter to autonegotiate its speed and duplex settings.

Set the duplex value at which a given network adapter should run to either full (transmit data in both directions at the same time) or half (transmit data in one direction at a time).

List information about all the network adapters. Use network nic get <adapter> to list information about one specific adapter, for example esxcli network nic get -n vmnic0

Set the speed at which a given network adapter should run. Valid values for speed are 10, 100, 1000, or 10000.

esxcfg-rescan

The esxcfg-rescan command rescans the storage configuration. In vSphere 5.0, equivalent ESXCLI commands are available.

Table 19. esxcfg-rescan Replacement Commands esxcfg-rescan Option ESXCLI Command

-a|--add storage core adapter rescan

--type=add

-d|--delete <vmhba#> storage core adapter rescan

--type=delete --adapter <vmhba#>

Description

Scan for added devices.

Scan removing dead devices

VMware, Inc.

23

Command-Line Management in vSphere 5.0 for Service Console Users

Table 19. esxcfg-rescan Replacement Commands (Continued) esxcfg-rescan Option ESXCLI Command Description

-A|--all storage core adapter rescan

-u|--update <vmhba#> storage core adapter rescan

--type=update --adapter <vmhba#>

Scan all adapters. By default, the command scans all adapters. You can specify individual adapters by using the --adapter option.

Scan existing paths and update their state.

In addition, ESXCLI supports several other rescan command. Run esxcli storage core adapter rescan

--help . esxcfg-vmknic

The esxcfg-vmknic command adds, deletes, and modifies VMkernel network interfaces. In vSphere 5.0, equivalent ESXCLI commands are available.

Table 20. esxcfg-vmknic Replacement Commands esxcfg- option ESXCLI Command

--add --ip<address>

--netmask <netmask>

<port-group-name> network ip interface add

Description

Add a VMkernel NIC to the system.

When the command completes successfully, the newly added VMkernel

NIC is enabled.

Remove a VMkernel NIC.

The ESXCLI command enables or disables the specified VMkernel NIC.

--delete <nic_name> network ip interface remove

--disable -D network ip interface set

--interface-name=<NIC>

--enabled=[true|false]

--dvs-name <dvs>

-s

Not supported.

--dvport_id

<port_id>

--enable

Not supported.

--enable-ipv6 -6

[true | false]

--ip <address> -i

<address> network ip interface ipv4 set

--interface-name=<NIC> network ip interface ipv6 set

--enable-dhcpv6 network ip interface ipv6 address

[list|add|remove] network ip interface ipv4 set

--interface-name=<NIC> network ip interface ipv6 set

--interface-name=<NIC>

Set and enable the specified VMkernel

NIC if it is disabled.

Enable IPv6 for the next boot; manage the

IPv6 address.

--list -l

--mtu <mtu>

--netmask <netmask>

-n network ip interface list network ip interface ipv4 list network ip interface ipv6 list network ip interface set

--interface-name=<NIC> --mtu=<long> network ip interface ipv4 set

--interface=<NIC> --netmask=<netmask> network ip interface ipv4 set

--interface=<NIC> --netmask=<netmask>

The IP address to be used for the

VMkernel NIC.

If you set a static IPv4 address, you must specify the --netmask option in same command.

List VMkernel network interfaces.

List IPv4 addresses assigned to the system.

List IPv6 addresses assigned to the system.

MTU for the interface being created. Used at the top-level ip namespace, not inside the ipv4 or ipv6 namespace.

IP netmask(X.X.X.X) to be used for the

VMkernel NIC. Setting an IP netmask requires that the --interface option be given in same command.

VMware, Inc.

24

Command-Line Management in vSphere 5.0 for Service Console Users

Table 20. esxcfg-vmknic Replacement Commands (Continued) esxcfg- option ESXCLI Command

--peerdns -p network ip interface ipv4 set

--interface=<NIC>

--peer-dns=[true|false] network ip interface ipv6 set

--interface=<NIC>

--peer-dns=[true|false]

Not needed.

--portgroup

<port_group>

--unset-ip

-U

Not needed.

Description

Set peer DNS. If set, the system uses the host name, IP address and domain returned by DHCP. Valid only for DHCP.

esxcfg-volume

The esxcfg-volume command manages LVM snapshot or replica volumes. In vSphere 5.0, equivalent ESXCLI commands are available in the esxcli storage filesystem and in the esxcli storage vmfs namespaces.

Table 21. esxcfg-volume Replacement Commands esxcfg-volume Option ESXCLI Command Description

--list -l

--mount -m

--persistent -M

--resignature

<VMFS-UUID|label>

--umount -u

<VMFS-UUID|label> storage vmfs snapshot list

List unresolved snapshot LUNs or replicas of VMFS volumes.

storage vmfs snapshot mount storage vmfs snapshot resignature

Mount a snapshot or replica of a VMFS volume. Use the

--nopersist option to mount the volume non-persistently.

Resignature a snapshot or replica volume.

storage vmfs snapshot unmount

Disconnect and unmount an existing VMFS or NAS volume.

The command does not delete the configuration for the volume, but removes the volume from the list of mounted volumes and halts all I/O or network traffic for this volume.

esxcfg-vswitch

The esxcfg-vswitch command manages virtual switches. In vSphere 5.0, equivalent ESXCLI commands are available.

Table 22. esxcfg-vswitch Replacement Commands esxcfg-vswitch Option ESXCLI Command network vswitch standard add --add | -a

<switch_name>

--add-pg | -A

<portgroup>

<vswitch_name>

--add-dvp-uplink |

-P

--add-pg-uplink |

-M

--check | -c

<vswitch_name>

--check-pg | -C

<port_group>

<vswitch_name>

Description

Add a new virtual switch.

network vswitch standard portgroup add portgroup-name=<string> vswitch-name=<string>

Add a port group to the specified virtual switch.

Not supported.

esxcli network vswitch standard portgroup policy failover set

--active-uplinks=vmnic1,vmnic6,vminic7

Add an uplink adapter to a distributed virtual port (DVP).

Update the list of active uplinks for the port group. This command fails silently if the uplink adapter does not exist.

network vswitch standard list Check whether a virtual switch exists.

Print 1 if the switch exists and print 0 otherwise. Use the virtual switch name, e.g. vSwitch0 or vSwitch1, to specify the virtual switch.

network vswitch standard portgroup list Check whether the specified port group exists or not.

VMware, Inc.

25

Command-Line Management in vSphere 5.0 for Service Console Users

Table 22. esxcfg-vswitch Replacement Commands (Continued) esxcfg-vswitch Option ESXCLI Command

--delete | -d

<vswitch_name>

--del-pg | -D

<port_group>

<vswitch_name> network vswitch standard remove

--vswitch-name=<vswitch> network vswitch standard portgroup remove --vswitch-name=<vswitch>

--portgroup-name=<portgroup>

Description

Remove a virtual switch. Running the command with this option fails if any ports on the virtual switch are in use by

VMkernel networks or virtual machines.

Remove a port group from the virtual switch. Running the command with this option fails if the port group is in use, for example, by a virtual machine or a

VMkernel network.

--del-dvp-uplink |

-Q <adapter_name>

--dvp <DVPort_id>

<dvswitch_name>

--del-pg-uplink |

-N <adapter_name>

<port_group>

<dvswitch_name>

--dvp | -V

--get-cdp | -b

<vswitch_name>

--link | -L

<physical_nic>

<vswitch_name>

--list | -l

--mtu | -m

<vswitch_name>

--pg | -p

<port_group>

--set-cdp | -B

<vswitch_name>

[down | listen | advertise | both]

--unlink | -U

<physical_nic>

<vswitch_name>

ESXCLI does not support distributed switches.

Use the vSphere Client to configure distributed switches. network vswitch standard portgroup policy failover set

--active-uplinks=vmnic1,vmnic6,vminic7

Update the list of active uplinks for the port group.

ESXCLI does not support distributed switches.

Use the vSphere Client to configure distributed switches. network vswitch standard list includes

CDP information. network vswitch standard uplink add

--uplink --vswitch network vswitch standard list network vswitch standard set

--mtu=<long> network vswitch standard portgroup set

--vlan-id=<long> network vswitch standard set

--cpd-status=<string> network vswitch standard uplink remove

--uplink=<uplink> --vswitch=<vswitch>

Print the current CDP (Cisco Discovery

Protocol) setting for this virtual switch

(valid for vSphere 4.0 and later).

Add an uplink adapter (physical NIC) to a virtual switch. Running the command with this option attaches a new unused physical network adapter to a virtual switch.

List all virtual switches and their port groups.

Set the MTU (maximum transmission unit) of the virtual switch. This option affects all physical NICs assigned to the virtual switch.

Provide the name of the port group for the --vlan option. Specify ALL to set

VLAN IDs on all port groups of a virtual switch.

Set the CDP status for a given virtual switch (valid for vSphere 4.0 and later).

To set, specify down, listen, advertise, or both.

Remove an uplink adapter from a virtual switch. An uplink adapter corresponds to a physical Ethernet adapter to which the virtual switch is connected. If you remove the last uplink adapter, you lose physical network connectivity for that switch.

VMware, Inc.

26

Command-Line Management in vSphere 5.0 for Service Console Users

Table 22. esxcfg-vswitch Replacement Commands (Continued) esxcfg-vswitch Option ESXCLI Command

--vlan | -v --pg

<port_group> network vswitch standard portgroup set

--portgroup-name=<str>

--vlan-id=<long>

-X --set-maxactive network vswitch standard portgroup policy failover set

--active-uplinks=vmnic1,vmnic6,vminic7

Description

Set the VLAN ID for a specific port group of a virtual switch. Setting the option to 0 disables the VLAN for this port group. If you specify this option, you must also specify the --portgroup option.

Explicitly specify the maximum number of active uplinks.

At any time, there is one port group NIC array, and a corresponding set of active uplinks. For example, assume the portgroup nic array is [vmnic1, vmnic0, vmnic3 , vmnic5, vmnic6, vmnic7] and active-uplinks is set to three uplinks

(vmnic1, vmnic0, vmnic3), and the rest are standby uplinks. If you set the active uplinks with new set [vmnic3, vmnic5], those uplinks override the old set. The

NIC array changes to [vmnic3, vmnic5, vmnic6 , vmnic7] and max-active becomes 2. esxtop

The esxtop command is available and supported in the ESXi Shell. Search the vSphere Documentation Center, or see the vSphere Resource Management documentation. esxupdate

The esxupdate command allows you to manage ESX 4.0 and later systems. Use the commands in the esxcli software namespace to install, update, remove, or display individual VIBs (software packages). Use commands in the esxcli software sources namespace to query depot contents for VIBs and image profiles.

An image profile defines an ESXi image and consists of VIBs.

I MPORTANT The update process in the vSphere 5.0 environment has been simplified and differs significantly from the process in vSphere 4.1. Several command options do not have direct equivalents. See the Upgrade

Guide.

Table 23. esxupdate Replacement Commands esxupdate

Command ESXCLI Command query info update esxcli software vib list vSphere 5.0 does not support bulletins. Instead, you update your system with individual VIBs or image profiles. See the Upgrade documentation. esxcli software vib get --vibname=<str> esxcli software profile get esxcli software vib update esxcli software profile update esxcli software vib install esxcli software profile install remove esxcli software vib remove

Description

List all installed VIB packages.

Display information on one or more VIBs.

The update command updates VIB packages but does not install new VIBs.

The install command installs VIB packages from a URL or depot. The command installs, upgrades, or downgrades VIBs.

Remove selected VIBs from the host.

VMware, Inc.

27

Command-Line Management in vSphere 5.0 for Service Console Users

Table 23. esxupdate Replacement Commands (Continued) esxupdate

Command ESXCLI Command stage scan

No longer necessary.

No longer necessary.

Run esxcli software sources profile to query for image profiles in a depot.

Run esxcli software sources vib to display information about VIB URLs and files.

Description vmkfstools vmkfstools is supported in the ESXi Shell and as a vCLI command. Some differences exist between the ESXi

Shell vmkfstools command and the vmkfstools.pl vCLI command.

No equivalent ESXCLI command exists. Some of the vmkfstools functionality is supported by esxcli filesystem vmfs . vmware-cmd

The vmware-cmd command is included in the vCLI package, but is not available in the ESXi Shell. vm-support

The vm-support command is available in the ESXi Shell. The vm-support command is not included in the vCLI package.

I MPORTANT The vSphere Client now supports all options to vm-support. If you cannot use the vSphere

Client to access your ESXi system, you can use the vm-support command.

If you have comments about this documentation, submit your feedback to: [email protected]

VMware, Inc. 3401 Hillview Ave., Palo Alto, CA 94304 www.vmware.com

Copyright © 2010, 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents . VMware is a registered trademark or trademark of VMware, Inc. in the United States and/or other jurisdictions. All other marks and names mentioned herein may be trademarks of their respective companies.

Item: EN-000544-00

28

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Related manuals

Download PDF

advertisement