Вы находитесь на странице: 1из 41

VMware Management Resources

Module 2

© 2014 VMware Inc. All rights reserved


You Are Here

Course Introduction Storage Optimization

VMware Management Resources


CPU Optimization
Performance in a Virtualized
Environment
Memory Performance
Network Scalability
Virtual Machine and Cluster
Network Optimization Optimization

Storage Scalability Host and Management Scalability

VMware vSphere: Optimize and Scale 2-2

© 2014 VMware Inc. All rights reserved


Importance

Performing configuration and troubleshooting tasks from the


command line is a very useful skill that a VMware vSphere®
administrator should have.
VMware vSphere® Command-Line Interface (vCLI), which is available
with VMware vSphere® Management Assistant, provides the
administrator with these command-line capabilities.

VMware vSphere: Optimize and Scale 2-3

© 2014 VMware Inc. All rights reserved


Learner Objectives

By the end of this module, you should be able to meet the following
objectives:
 Understand the purpose of the vCLI commands
 Discuss options for running commands
 Deploy and configure vSphere Management Assistant
 Use vmware-cmd for virtual machine operations

VMware vSphere: Optimize and Scale 2-4

© 2014 VMware Inc. All rights reserved


Methods to Run Commands

Ways to get command-line access on a VMware® ESXi™ host:


 VMware vSphere® ESXi™ Shell
 vCLI
 vSphere Management Assistant (which also includes vCLI)

VMware vSphere: Optimize and Scale 2-5

© 2014 VMware Inc. All rights reserved


vSphere ESXi Shell

vSphere ESXi Shell includes a set of fully supported ESXCLI


commands and a set of commands for diagnosing and repairing ESXi
hosts.
Use vSphere ESXi Shell only at the request of VMware® technical
support.
 You should be familiar with how vSphere ESXi Shell works in case
VMware technical support directs you to use it.
vSphere ESXi Shell can be accessed:
 Locally, from the direct console user interface (DCUI)
 Remotely, from an SSH session

VMware vSphere: Optimize and Scale 2-6

© 2014 VMware Inc. All rights reserved


Accessing vSphere ESXi Shell Locally

To access vSphere ESXi Shell locally, you must have access to the
DCUI and administrator privileges.
By default, the local vSphere ESXi Shell is disabled:
 Enable the local vSphere ESXi Shell from either the DCUI or VMware
vSphere® Web Client.
After you enable the vSphere ESXi Shell access, you can access the
local shell:
 In the main DCUI screen, press Alt+F1 to open a virtual console
window to the host.
 To return to the DCUI, press Alt+F2.
Local and domain users that have been assigned administrator
privileges on the host have root-equivalent permissions in the local
vSphere ESXi Shell.

VMware vSphere: Optimize and Scale 2-7

© 2014 VMware Inc. All rights reserved


Accessing vSphere ESXi Shell Remotely

You can access vSphere ESXi Shell remotely with a secure shell
client like SSH or PuTTY.
By default, the local vSphere ESXi Shell is disabled:
 Enable the local vSphere ESXi Shell from either the DCUI or vSphere
Web Client.
Disable SSH access when you finish using it.

Enable SSH on an ESXi host only as a last resort for


troubleshooting. Enabling SSH creates a potential
security vulnerability and reduces ESXi resources.

VMware vSphere: Optimize and Scale 2-8

© 2014 VMware Inc. All rights reserved


About vCLI

 The vCLI command set enables you to run common system


administration commands against ESXi hosts.
 You can run most vCLI commands against a VMware® vCenter
Server™ system and target the ESXi hosts that it manages.
 vCLI commands normally require the following options to connect and
log in to a server:
• --server name
• --username user
• --password string
 vCLI commands run on top of the VMware vSphere® SDK for Perl.
 You can install a vCLI package on a Linux or a Microsoft Windows
system, or deploy the vSphere Management Assistant on an ESXi host.

VMware vSphere: Optimize and Scale 2-9

© 2014 VMware Inc. All rights reserved


vSphere Management Assistant

vSphere Management Assistant is a virtual appliance that includes


the following:
 SUSE Linux Enterprise Server 11 SP1
 VMware® Tools™
 vCLI
 vSphere SDK for Perl
 Java JRE version 1.6
 vi-fastpass, an authentication component for
the appliance that creates two users:
• vi-admin with administrator privileges
• vi-user with read-only privileges

VMware vSphere: Optimize and Scale 2-10

© 2014 VMware Inc. All rights reserved


Hardware and Software Requirements

Hardware requirements for vSphere Management Assistant:


 AMD Opteron, rev E or later
 Intel processors with EM64T support with VT enabled
vSphere Management Assistant can be deployed on the following:
 vSphere 5.5
 vSphere 5.1 and later
 vSphere 5.0 and later
By default, vSphere Management Assistant uses the following:
 One virtual processor
 600MB of RAM
 3GB virtual disk

VMware vSphere: Optimize and Scale 2-11

© 2014 VMware Inc. All rights reserved


Setting Up a vSphere Management Assistant Appliance

Deploy Configure Add Targets Authenticate

To set up a vSphere Management Assistant appliance:


1. Deploy vSphere Management Assistant from a URL or a downloaded
file.
2. Configure vSphere Management Assistant virtual machine and time-
zone network settings.
3. Add target servers to vSphere Management Assistant. Target servers
include the vCenter Server system or ESXi hosts or both.
4. Initialize vi-fastpass authentication.

VMware vSphere: Optimize and Scale 2-12

© 2014 VMware Inc. All rights reserved


Connecting to the Infrastructure

vSphere Management Assistant command paths

vCenter Server

vSphere Management
Assistant
vSphere SDK for Perl API (port 443)
vCenter Server protocol (port 902) ESXi host

.
VMware vSphere: Optimize and Scale 2-13

© 2014 VMware Inc. All rights reserved


Deploying vSphere Management Assistant

Deploy vSphere Management


Assistant like any other virtual
appliance.

VMware vSphere: Optimize and Scale 2-14

© 2014 VMware Inc. All rights reserved


Configuring vSphere Management Assistant

Configure vSphere Management Assistant at the command prompt or


through the Web interface:
 https://appliance_name_or_IP_address:5480
 Log in as vi-admin.
From the Web interface, you can do the following:
 Configure https://vma.vclass.local:5480
time-zone
settings
 Configure
network and
proxy server
settings
 Update to the
latest version

VMware vSphere: Optimize and Scale 2-15

© 2014 VMware Inc. All rights reserved


Adding a Target Server

A target server is a server that you access from vSphere


Management Assistant:
 Either a vCenter Server system or ESXi host
To add a vCenter Server system as a target server:
1. Log in as vi-admin.
2. Run vifp addserver vCenter_Server_system.
a. Type a vCenter Server user name with administrator privilege.
b. Type the user’s password.
c. Agree to store this information in the credential store.
3. Run vifp listservers to verify that the vCenter Server system has
been added as a target.
4. Run vifptarget -s vCenter_Server_system to set the target
as the default for the current vSphere Management Assistant session.
5. Test operation by running vicfg-nics –l –vihost ESXi_host.

VMware vSphere: Optimize and Scale 2-16

© 2014 VMware Inc. All rights reserved


vSphere Management Assistant Authentication

The vi-fastpass authentication component vSphere


Management
supports unattended authentication to Assistant
vCenter Server system or ESXi host
targets: Authenticated
Logging
 Prevents the user from continually adding
Commands

login credentials to every command being


executed
ESXi
 Facilitates unattended scripted operations
vCenter
Server

VMware vSphere: Optimize and Scale 2-17

© 2014 VMware Inc. All rights reserved


Joining vSphere Management Assistant to Active Directory

vSphere Management Assistant can be configured for Active Directory (AD). The
ESXi hosts and vCenter Server systems can be added without storing passwords
in the vSphere Management Assistant credential store.

Active
Directory

vCenter Server

vSphere Management ESXi host


Assistant

VMware vSphere: Optimize and Scale 2-18

© 2014 VMware Inc. All rights reserved


Command Structure

vCLI syntax on a vSphere Management Assistant appliance:


command conn_options target_option command_options

A vCLI command targeted directly at an ESXi host:


vicfg-nics --server esx01 --username esxadm --password vmware -l

A vCLI command targeted at an ESXi host through a vCenter Server


instance:
vicfg-nics --server vC1 --username vcadmin --password vmware --vihost esx01 -l

.
VMware vSphere: Optimize and Scale 2-19

© 2014 VMware Inc. All rights reserved


vSphere Management Assistant Commands

vSphere Management Assistant includes the following commands:


 esxcli
 resxtop
 svmotion
 vicfg- commands
 esxcfg- commands (deprecated)
 vifs
 vihostupdate
 vmkfstools
 vmware-cmd

VMware vSphere: Optimize and Scale 2-20

© 2014 VMware Inc. All rights reserved


esxcfg- Commands

Many vCLI commands used esxcfg- commands in scripts to


manage VMware® ESX®/ESXi 3.x and 4.x hosts:
 In vCLI many vicfg- commands are equivalent to esxcfg-
commands.
 Commands with the esxcfg prefix are available mainly for
compatibility reasons and might become obsolete.
 Use vicfg- commands when developing new scripts.

VMware vSphere: Optimize and Scale 2-21

© 2014 VMware Inc. All rights reserved


esxcfg Equivalent vicfg Command Examples

Legacy esxcfg- Command Equivalent vicfg- Command

esxcfg-advcfg vicfg-advcfg

esxcfg-cfgbackup vicfg-cfgbackup

esxcfg-nics vicfg-nics

esxcfg-vswitch vicfg-vswitch

VMware vSphere: Optimize and Scale 2-22

© 2014 VMware Inc. All rights reserved


Managing Hosts with vSphere Management Assistant

Host Management Task Command

Reboot and shut down hosts. vicfg-hostops

Enter and exit maintenance mode. vicfg-hostops

Back up and restore host


vicfg-cfgbackup
configuration settings.

Add ESXi hosts to an AD domain. vicfg-authconfig

VMware vSphere: Optimize and Scale 2-23

© 2014 VMware Inc. All rights reserved


Common Connection Options for vCLI Execution

Connection Option Description

--server The ESXi or vCenter Server host.

--username User name to log in to the system.

--password Login password.


Name of the ESXi host to run the
--vihost
command against.
--savesessionfile Saves a session to the specified file.

--sessionfile Loads a previously saved session.


Displays additional debugging
--verbose
information.

VMware vSphere: Optimize and Scale 2-24

© 2014 VMware Inc. All rights reserved


vicfg Command Example

Use the vicfg-hostops command with the shutdown or reboot


operation:
 vicfg-hostops conn_options --operation shutdown cmd_options
 vicfg-hostops conn_options --operation reboot cmd_options

Examples:
 vicfg-hostops –-server esxi01 –-username esxadmin
-–password vmware1! –-operation shutdown
 vicfg-hostops –-server esxi01 –-username esxadmin
-–password vmware1! –-operation reboot --force
 vicfg-hostops –-server vc_dev –-username esxadmin
–-operation shutdown –-cluster “Lab Cluster”
The command prompts for user names and passwords if you do not
specify them.

VMware vSphere: Optimize and Scale 2-25

© 2014 VMware Inc. All rights reserved


Entering and Exiting Host Maintenance Mode

Use the vicfg-hostops command with the enter, exit, or info


operations:
 vicfg-hostops conn_options --operation enter cmd_options
 vicfg-hostops conn_options --operation exit cmd_options
 vicfg-hostops conn_options --operation info cmd_options

Examples:
 vicfg-hostops --server vc01 --username vcadmin
--operation info --cluster “Lab Cluster”
 vicfg-hostops --server esxi01 --username esxadmin
--operation enter --action poweroff

vicfg-hostops:
 Does not coordinate with VMware vSphere® Distributed Resource Scheduler™
 Suspends the virtual machines by default:
• Use the --action poweroff option to power off virtual machines.

VMware vSphere: Optimize and Scale 2-26

© 2014 VMware Inc. All rights reserved


vmware-cmd Overview

The vmware-cmd command can be used to perform virtual machine


operations.
 vmware-cmd provides an interface to perform operations on a virtual
machine. Examples of virtual machine operations are the following:
• Retrieve power state
• Register a virtual machine
• Unregister a virtual machine
• Set virtual machine configuration variables
• Manage virtual machine snapshots

VMware vSphere: Optimize and Scale 2-27

© 2014 VMware Inc. All rights reserved


Format for Specifying Virtual Machines with vmware-cmd

A virtual machine path is usually required when you run vmware-cmd.


You can specify the virtual machine path using one of the following
formats:
 “[mystorage] testvms/VM1/VM1.vmx”
 /vmfs/volumes/mystorage/testvms/VM1/VM1.vmx
Examples:
 Register a virtual machine:
• vmware-cmd –s register connection_options
“[mystorage] testvms/VM1/VM1.vmx”
 Power on a virtual machine:
• vmware-cmd -H vc_system -U user -P password
--vihost esxi_host
/vmfs/volumes/mystorage1/testvms/VM1/VM1.vmx start soft

VMware vSphere: Optimize and Scale 2-28

© 2014 VMware Inc. All rights reserved


Connection Options for vmware-cmd

Connection Option Description

-H Specifies an ESXi host or a vCenter Server system.


Specifies the target host if the –H option specifies a
-h | --vihost
vCenter Server system.
-O Specifies an alternate port. The default is 902.

-U Specifies the name of the user who connects to the target.


-P Specifies the password of the user.
Specifies the location of a configuration file that specifies
--config
connection information.
--credstore Specifies the name of a credential store file.
--sessionfile Specifies the name of a session file that was saved earlier.

VMware vSphere: Optimize and Scale 2-29

© 2014 VMware Inc. All rights reserved


Managing Virtual Machines Using vmware-cmd

Virtual machine operations that can be performed with vmware-cmd:


 Listing and registering virtual machines
 Retrieving virtual machine attributes
 Managing virtual machine snapshots
 Powering virtual machine on and off
 Connecting and disconnecting virtual devices
 Working with the AnswerVM API

VMware vSphere: Optimize and Scale 2-30

© 2014 VMware Inc. All rights reserved


Listing and Registering Virtual Machines with vmware-cmd

Registering a virtual machine means adding the virtual machine to


the inventory of the vCenter Server system or the ESXi host.
Examples:
 List all registered virtual machines:
• vmware-cmd –l
 Register a virtual machine:
• vmware-cmd connection_options -s register
/vmfs/volumes/Storage1/testvm/testvm.vmx

VMware vSphere: Optimize and Scale 2-31

© 2014 VMware Inc. All rights reserved


Retrieving Virtual Machine Attributes with vmware-cmd

You can use vmware-cmd to retrieve different virtual machine


attributes.
Examples:
 The getuptime options retrieves the uptime of the guest operating
system:
• vmware-cmd connection_options
/vmfs/volumes/Storage1/testvm/testvm.vmx getuptime
 The getproductinfo option lists the VMware product information.
• getproductinfo product
• getproductinfo platform
• getproductinfo build, majorversion, minorversion
 The getstate option retrieves the execution state of the virtual
machine.
 The gettoolslastactive option indicates whether VMware Tools is
installed.

VMware vSphere: Optimize and Scale 2-32

© 2014 VMware Inc. All rights reserved


Managing Virtual Machine Snapshots with vmware-cmd

You can take a snapshot while a virtual machine is running,


shut down, or suspended.
Examples:
 To take a snapshot, you must specify the name, description, quiesce flag
(0 or 1), and memory flag (0 or 1):
• vmware-cmd connection_options
/vmfs/volumes/Storage1/testvm/testvm.vmx createsnapshot
VMSnap01 “Test Snapshot Feb 12 2014” 0 0
 Check if a virtual machine has a snapshot:
• vmware-cmd connection_options
/vmfs/volumes/Storage1/testvm/testvm.vmx hassnapshot
 Revert to most recent snapshot and remove all snapshots:
• vmware-cmd connection_options
/vmfs/volumes/Storage1/testvm/testvm.vmx revertsnapshot
• vmware-cmd connection_options
/vmfs/volumes/Storage1/testvm/testvm.vmx removesnapshots

VMware vSphere: Optimize and Scale 2-33

© 2014 VMware Inc. All rights reserved


Powering Virtual Machines On and Off with vmware-cmd

You can start, stop, and suspend virtual machines by using


vmware-cmd.
With hard power operations, vmware-cmd immediately and
unconditionally shuts down, resets, or suspends the virtual machine.
Examples:
 Power on a virtual machine:
• vmware-cmd connection_options
/vmfs/volumes/Storage1/testvm/testvm.vmx start
 Power off a virtual machine gracefully:
• vmware-cmd connection_options
/vmfs/volumes/Storage1/testvm/testvm.vmx suspend soft

VMware vSphere: Optimize and Scale 2-34

© 2014 VMware Inc. All rights reserved


Connecting Devices with vmware-cmd

You can connect and disconnect devices using vmware-cmd.


Examples:
 Connect an IDE CDROM to a virtual machine:
• vmware-cmd connection_options
/vmfs/volumes/Storage1/testvm/testvm.vmx
connectdevice “CD/DVD drive 2”
 Disconnect an IDE CDROM from a virtual machine:
• vmware-cmd connection_options
/vmfs/volumes/Storage1/testvm/testvm.vmx
disconnectdevice “CD/DVD drive 2”

VMware vSphere: Optimize and Scale 2-35

© 2014 VMware Inc. All rights reserved


Working with the AnswerVM API

AnswerVM API allows users to provide input to questions.


Some virtual machine operations can be blocked until the question
is answered.
vmware-cmd --answer allows you to access the input.
This option can be used when you want to configure a virtual
machine based on a user’s input.

VMware vSphere: Optimize and Scale 2-36

© 2014 VMware Inc. All rights reserved


esxcli Command Hierarchies

 esxcli namespace
 esxcli fcoe namespace
 esxcli hardware namespace
 esxcli iscsi namespace
 esxcli license namespace
 esxcli network namespace
 esxcli software namespace
 esxcli storage namespace
 esxcli system namespace
 esxcli vm namespace
 esxcli command list for a full listing

VMware vSphere: Optimize and Scale 2-37

© 2014 VMware Inc. All rights reserved


esxcli Command Example

Use the esxcli command with the vm namespace to list all the
virtual machine processes.
 esxcli conn_options vm process list

VMware vSphere: Optimize and Scale 2-38

© 2014 VMware Inc. All rights reserved


Lab 1: Using vSphere Management Assistant

Use vSphere Management Assistant to manage ESXi hosts and


virtual machines
1. Log In to the Control Center Desktop
2. License the vCenter Server System and the ESXi Host
3. Enable SSH and vSphere ESXi Shell Services
4. Log In to the vSphere Management Assistant Appliance
5. Add the vCenter Server System and the ESXi Host as Target Servers
6. Use ESXCLI Commands to Query ESXi Host Properties
7. Use vicfg-ntp Commands to Configure NTP
8. Use vmware-cmd Commands to Manage a Virtual Machine
9. Clean Up for the Next Lab

VMware vSphere: Optimize and Scale 2-39

© 2014 VMware Inc. All rights reserved


Review of Learner Objectives

You should be able to meet the following objectives:


 Understand the purpose of the vCLI commands
 Discuss options for running commands
 Deploy and configure vSphere Management Assistant
 Use vmware-cmd for virtual machine operations

VMware vSphere: Optimize and Scale 2-40

© 2014 VMware Inc. All rights reserved


Key Points

 vCLI is a command-line interface to manage the infrastructure, either by


running commands or by executing scripts.
 vSphere Management Assistant is a virtual appliance that is used to
manage the infrastructure at the command prompt. vSphere
Management Assistant includes vCLI.
 vSphere Management Assistant can be used to monitor, configure, and
manage hosts, storage, and virtual networking.

Questions?

VMware vSphere: Optimize and Scale 2-41

© 2014 VMware Inc. All rights reserved