Professional Documents
Culture Documents
Introduction
InvSphere5.0,VMwareoffersthefollowingtools,CLIs,andAPIsthatreplaceESX4.xserviceconsole components.
CLI or Tool vCLI Description IncludesESXCLIcommands,vicfg- commands,andafewothercommandsfor managingvSphere. PowerCLIcmdletsformanagingESXihostsand virtualmachines. Availability InstallavCLIpackageonaWindowsorLinux systemorruncommandsfromvMA. InstallMicrosoftPowerShellonaWindows system,andinstallvSpherePowerCLItorun bothPowerShellandPowerCLIcmdletfromthe PowerCLIprompt.
PowerCLI
VMware, Inc.
ESXiShell commands
Serviceconsolecommands
OffhostmanagementwithVMware PowerCLIcmdletsfromaWindowssystem.
Serviceconsolecommands
OnhostmanagementintheESXiShellis possibleifsystemfailuresorotherissues preventyoufromusingoffhostmanagement commands. ESXiShellisdisabledbydefault IfyourunagentsintheESX4.xservice console,youcanreplacethemwith infrastructureservicesinmanycases. RunningthirdpartyagentsintheESXiShell isnotsupported.
Agents
ReplacingAgentsonpage 9.
Figure 1illustratesthedifferencesbetweenCLIsinESXi4.1andESXi5.0.
VMware, Inc.
ESX 4.1
ESXCLI ESXCLI
ESXi 5.0
ESXCLI ESXCLI
vSphere5.0documentationexplainshowtoperformtasksbyusingoneoftheclientUIs.Onlinehelpis availablefrombothclientUIs.
Ifyoudonotspecifyadditionalauthenticationparameters,thevCLIinfrastructurepromptsforausername andpasswordforthevCenterServersystemspecifiedby--server.
VMware, Inc.
Management commands
Asmallsetofmanagementcommandsisavailable.Commandsincludevifsforfilemigration, vmware-cmdformanagingvirtualmachines,andvmkfstoolsforVMFSfilemanagement.
ThefollowingdocumentationhelpsyouworkwithvCLIcommands.
GettingStartedwithvSphereCommandLineInterfacesgivesoverviewsofavailablecommandsandincludes instructionsforinstallingvCLIonWidowsorLinuxanddetailedinformationaboutconnectionoptions. vSphereCommandLineInterfaceConceptsandExamplespresentsusageexamplesformanycommands,such assettingupsoftwareandhardwareiSCSI,addingvirtualswitches,settingupActiveDirectory authentication,andsoon.Thedocumentincludesthesameexamplewiththevicfg-commandandthe ESXCLIcommandwheresupported. vSphereCommandLineInterfaceReferenceisareferencetobothvicfg-commandsandESXCLIcommands. Thevicfg-commandhelpisgeneratedfromthePODavailableforeachcommand,runpod2htmlfor anyvicfg-commandtogenerateindividualHTMLfilesinteractively.TheESXCLIreferenceinformation isgeneratedfromtheESXCLIhelp.
IfyouruncommandsagainstESXi4.xhosts,ESXCLI4.xcommandsaresupported. IfyouruncommandsagainstESXi5.0hosts,ESXCLI5.0commandsaresupported.
VMware, Inc.
localclicommands
VMware, Inc.
To enable the ESXi Shell from the Direct Console 1 2 3 AccessthedirectconsoleoftheESXihost,pressF2,andprovidecredentialswhenprompted. ScrolltoTroubleshootingOptions,andpressEnter. SelectEnableESXiShellandpressEnter. Ontheleft,EnableESXiShellchangestoDisableESXiShell.Ontheright,ESXiShellisDisabled changestoESXiShellisEnabled. 4 (Optional)Configurethetime-outfortheESXiShell a b 5 SelectModifyESXiShelltimeoutandpressEnter. Enterthetime-outvalueinminutesandpressEnter.
PressEscuntilyoureturntothemaindirectconsolescreen.
YoucanenabletheESXiShellfromthevSphereClient. To enable the local or remote ESXi Shell from the vSphere Client 1 2 3 4 Selectthehost,clicktheConfigurationtab,andclickSecurityProfileintheSoftwarepanel. IntheServicessection,clickProperties. SelectESXiShellandclickOptions. ChangetheESXiShelloptions.
5 6
AfteryouhaveenabledtheESXiShell,youcanuseitfromthatmonitororthroughanout-of-bandnetwork connection.
YoucanenableremotecommandexecutionfromthevSphereClient. To enable SSH from the vSphere Client 1 2 3 4 5 SelectthehostandclicktheConfigurationtab. ClickSecurityProfileintheSoftwarepanel. IntheServicessection,clickProperties. SelectSSHandclickOptions. ChangetheSSHoptions.
ClickOK.
AfteryouhaveenabledSSH,youcanuseanSSHclienttologintotheESXiShellandrunESXiShell commands.
VMware, Inc.
esxcfg-commands
ESXCLI Commands
TheESXiShellinESXi5.0includesalargesetofnewESXCLInamespacesandcommands.Thecomplete ESXCLIcommandsetisalsopartofthevCLIpackage.TheESXCLIcommandsyntaxinESXi5.0ismore flexiblethanthesyntaxinESXi4.xandsupportsmultiplenamespaces.
esxcli [dispatch_option] <namespace> [namespace, ...] <cmd> [cmd_options]
Eachgetcommandreturnssinglevalues.
esxcli hardware memory get
Thelistcommandsareusedformultiplereturnvalues.
esxcli hardware cpu list
Manycommandshaveoptions.Useanequalsignoraspacebetweentheoptionandtheoptionvalue.
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>
VMware, Inc.
Shell Commands
IncontrasttoVMwareESX,VMwareESXidoesnotincludeaconsoleOSwithalargesetofshellcommands andothersoftware.However,asmallsetofshellcommandsisavailableintheESXiShell. IMPORTANTThecommandsarenottestedorsupportedbyVMware.UseVMwarecommandssuchas ESXCLI,vicfg-commands,andsoon,instead. Youcanseealistofcommandsin/usr/bin.Whenyoulistthecommandswithls -al,noticethatseveralof theutilitiesareredirectedtocommandsappropriateinthevSphereenvironment.Thefollowingcommands producedifferentresultsthantypicalshellcommands.
Goto/usr/binandrunls -atoseeacompletelist.
Replacing Agents
WithESX4.x,managementagentsandhardwaremonitoringandmanagementagentsrunintheservice console.WithESXi5.0,agentsareimplementedinotherways.
Managementagents.VMwarepartnerscreatemanagementagentsbyusingoneofthevSphereAPIs. Hardwareagents.DevelopersuseCIM(CommonInformationModel)agents.CIMisastandards-based approachtomonitoringhardwareresources.CIMoutputisreadablebythird-partymanagementtools. TheVMkernelcanincludebothVMwareCIMprovidersandPartnerCIMproviders.UseavSphereClient loggedintoavCenterServersystemtoviewhardwareinformationincludingalarms.UsethevSphere ClientextensionframeworkorthevSphereCIMSDKforcustomization. Infrastructureserviceagents.AdministratorscanuseagentsavailableintheESXiShell.Agentsinclude hostd(hostdaemon),vpxa,NTP,syslog,SNMP,andsoon.UsethevSphereSDK,vCLIcommands,or ESXCLIcommandstomanagetheagents. Table 2. Infrastructure Services for Production Environments
Function Timesynchronization Centralizedlogcollection ESX NTPagentinservice console Syslogagentinservice console SNMPagentinservice console ActiveDirectory(AD) agentinserviceconsole BuiltinActiveDirectory service ESXi Built-inNTPservice Built-inSyslogservice Management vicfg-ntpcommand esxcli system syslog commands vSphereClient SNMPmonitoring Localaccess authentication Built-inSNMPservice Built-inActiveDirectory service vicfg-snmpcommand vSphereClient vicfg-authconfigvCLI command.
VMware, Inc.
Showcurrentlyconfiguredsub-loggers. Setconfigurationoptionsforaspecificsublogger.Useoneofthefollowingoptions:
VMware, Inc.
10
Setalllogstokeeptwentyversions,thenstartoverwritingtheoldestlog.
esxcli system syslog config set --default-rotate=20
SettherotationpolicyforVMkernellogsto10rotations,rotatingat2MB.
esxcli system syslog config logger --id=vmkernel --size=2048 --rotate=10
Sendlogstoremotehostmyhost.mycompany.com.ThelogswillusethedefaultUDPport,514.
esxcli system syslog config set --loghost='myhost.mycompany.com'
Sendlogs/scratch/mylogsontheremotehostmyhost.mycompany.comusingTCP/IPport1514.
esxcli system syslog config set --loghost='tcp://myhost.mycompany.com:1514' --logdir='/scratch/mylogs'
Sendalogmessageintoalllogssimultaneously.
esxcli system syslog mark --message="this is a message!"
Reloadthesyslogdaemonandapplyconfigurationchanges.
esxcli system syslog reload
VMware, Inc.
11
Youcanuseesxcli system coredumptoconfigurearemoteorlocalcoredumppartition.Youcanalsouse theNetworkConfigurationhostprofiletosetuphoststouseESXiDumpCollector.Foreithercase,youcan applythehostprofileofahostthatusesESXiDumpCollectortootherhosts. To use ESXi Dump Collector 1 InstalltheESXiDumpCollectorserviceonthevCenterServersystemoraWindowsorLinuxsystemof yourchoice. ESXiDumpCollectorisoneoftheservicesyoucaninstallusingthevCenterServersysteminstallation package.SeevSphereInstallationandSetup. IfyouusethevCenterServeronLinuxappliance,ESXiDumpCollectorispreinstalled. 2 SetupESXisystemsthatshoulduseESXiDumpCollectorwithcommandsintheesxcli system coredumpnamespace. Twonamespacesaresupportedinsidethisnamespace.
ThefollowingexamplesetsupthenetworkandenablesESXiDumpCollectorwiththeESXCLIvCLI 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
YouarepromptedforausernameandpasswordfortheESXihost.
ForinformationcorrespondingtotheLinuxnetstatcommand,usethefollowingESXCLIcommand.
esxcli network ip connection list
VMware, Inc.
12
TheVIBsystemrefreshesthehostdaemonafteryourebootyoursystem.IftheVIBrequiresanexceptionto thefirewallrules,rebootingalsoupdatesthefirewallruleset. Youcaninsteaduseafirewallconfigurationfiletospecifyportrulesforhostservicesyouwanttoenablefor theextension. vSphereSecuritydocumentationdiscusseshowtoadd,apply,andrefreshafirewallrulesetandliststheesxcli network firewallcommands.TheESXi5.0ruleset.xmlformatisthesameasinESX/ESXi4.x,buthastwo additionaltags,enabledandrequired.TheESXi5.0firewallstillsupportstheoldformat. vSphereUpgradedocumentationdiscussesusingesxcli software sourcesandesxcli software vibto exploreandinstallpatchesandextensions. Insomesituations,youmightusevSphereUpdateManagerinsteadoftheesxclicommandtoinstall third-partyextensions.Theextensionvendorprovidesinformationontheinstallorupgradeprocess.
esxcfg-ipsec
No
VMware, Inc.
13
esxupdate
esxupdateonpage 27
Yes
vmkping vmware-cmd
No Yes
vm-support
No
InESXi5.0,theESXCLIcommandsyntaxismoreflexible.Eachcommandcanuseanarbitrarynumberof namespaces.Differentcommandshaveadifferentnumberofelements.
esxcli <conn_options> <namespace> [namespace, ...] <cmd> [cmd_options]
IMPORTANTYoumustupdateallESXCLIcommandsexplicitly;noscriptsareavailableforthetask.Starting withvSphere5.0,mostmanagementcommandswillbeESXCLIcommands.
VMware, Inc.
14
VMware, Inc.
15
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]
VMware, Inc.
16
vms vm list
vm process list
esxcfg-advcfg Insteadofesxcfc-advcfg,useesxcli system settings advanced.Thefollowingcommandsare supported. Table 9. esxcfg-advcfg Replacement Commands
esxcfg-advcfg option -g|--get ESXCLI Command system settings advanced list -o=option Description GetthevalueoftheVMkerneladvanced configurationoption.Us--optionto retrieveinformationforasingleoption,or --treetolimitthelisttoaspecificsubtree. SetthevalueoftheVMkerneladvanced configurationoption. ResetaVMkerneladvancedconfiguration optiontodefault. ListallVMkerneladvancedconfiguration options.
system settings advanced set system settings advanced set -d|--default system settings advanced list Nolongersupported system settings kernel set system settings kernel list Notsupported system welcomemsg set
Setthewelcomemessageforthedirect console.Youcanretrievethemessagewith system welcomemsg get. EnsuretheVMkernelsystemUUIDisset andprintit. Getthevalueofauser-specifiedgeneric value. Setthevalueofauser-specifiedgeneric value.
system uuid get system settings advanced list | grep <var> system settings advanced set
VMware, Inc.
17
-V|--has-option <name>
-r|--restore
Nolongeravailable.Internaluseonlyin previousversions.
IMPORTANTYoucannolongeruseesxcfg-dumpparttoenablecoredumps.UseESXCLIinstead. Thefollowingtableliststheesxcfg-dumppartcommandoptionsandcorrespondingESXCLIcommands.
VMware, Inc.
18
-t | --get-active
-c | --get-config -S | --smart-activate
system coredump partition get system coredump partition set --smart --enable= true
Gettheconfigureddiagnosticpartition forthesystem. Runthesmartactivatealgorithmto activatetheconfigureddump partition,orifnopartitionis configured,selectthebestpossible candidatebasedonthemediaofthe availabledumppartitions. Makethespecifiedpartitionthe currentdiagnosticpartition. Deactivatetheactivediagnostic partitionordeactivateESXiDump Collector. CAUTION:Ifyourunthiscommand, yoursystemcannotwriteerrorstoa fileuntilanotherpartitionisactivated. Youloseanyerrorrecordiferrors occur.
-a | --activate -d | --deactivate
system coredump partition set --enable=true system coredump partition set --enable=false
-s <naa.xx:1> | --set <naa.xxxxxxxx:1> -C | --copy [-n | --newonly] [-z | --zdumpname] [-o | --slot] -L --log
NocorrespondingESXCLIcommand.
VMware, Inc.
19
esxcfg-swiscsi and esxcfg-hwiscsi TheESX4.xserviceconsoleincludestwocommandsforiSCSImanagement. Theesxcfg-swiscsicommandmanagessoftwareiSCSI.EquivalentESXCLIcommandsareavailablein vSphere5.0. Table 12. esxcfg-swiscsi Replacement Commands
esxcfg-swiscsi Option -e --enable -D --disable -q --query -s --scan ESXCLI Command iscsi software set --enabled=true iscsi software set --enabled=false iscsi software get iscsi adapter discovery rediscover -A <adapter_name> storage core adapter rescan [-A <adapter_name> | -all] -k --kill -r --restore Notsupported Notsupported Description EnableSoftwareiSCSIonthesystem,if disabled. DisableSoftwareiSCSIonthesystem,if enabled. CheckifSoftwareiSCSIisenabledor disabledonthesystem. Scanthesystemfordisksavailablethrough SoftwareiSCSIinterface.Callthetwo commandsinorder.
Theesxcfg-hwiscsicommandmanagedhardwareiSCSI.
VMware, Inc.
20
-c -u
-m -f
ESXCLIdoesnothaveequivalentoptionsforthe--device,--vfat,and--hba-device-listfiltering options. The-o|--offline-cos-devand-n|--online-cos-devoptionsareserviceconsolespecificoptionsandnot applicabletoESXi5.0. esxcfg-module Theesxcfg-modulecommandsupportsmanipulationoftheVMkernelloadablemodulesanddevice drivers.Forthefollowingesxcfg-moduleoptions,ESXCLIcommandsareavailable. Table 15. esxcfg-module Replacement Commands
esxcfg-module Option --get-options <module_name> -g <module_name> --set-options <options> <module_name> -s <options> <module_name> ESXCLI Command system module parameters list system module parameters set Description Returnstheoptionstringconfiguredtobe passedtothemodulewhenthemoduleis loaded. Specifiestheoptionstringtobepassedtothe modulewhenthemoduleisloaded.
VMware, Inc.
21
system module list --enabled=[true|false] Notsupported. Notsupported. system module list --loaded=[true|false] system module get system module parameters list
-s --state
VMware, Inc.
22
storage nfs add --host storage nfs add --readonly storage nfs add --share=<share>
network nic list network nic get <adapter> network nic set --speed=<long>
VMware, Inc.
23
-u|--update <vmhba#>
Inaddition,ESXCLIsupportsseveralotherrescancommand.Runesxcli storage core adapter rescan --help. esxcfg-vmknic Theesxcfg-vmkniccommandadds,deletes,andmodifiesVMkernelnetworkinterfaces.InvSphere5.0, equivalentESXCLIcommandsareavailable. Table 20. esxcfg-vmknic Replacement Commands
esxcfg- option --add --ip<address> --netmask <netmask> <port-group-name> --delete <nic_name> --disable -D ESXCLI Command network ip interface add Description AddaVMkernelNICtothesystem. Whenthecommandcompletes successfully,thenewlyaddedVMkernel NICisenabled. RemoveaVMkernelNIC. TheESXCLIcommandenablesordisables thespecifiedVMkernelNIC.
network ip interface remove network ip interface set --interface-name=<NIC> --enabled=[true|false] Notsupported. Notsupported. 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>
TheIPaddresstobeusedforthe VMkernelNIC. IfyousetastaticIPv4address,youmust specifythe--netmaskoptioninsame command. ListVMkernelnetworkinterfaces. ListIPv4addressesassignedtothe system. ListIPv6addressesassignedtothe system.
--list -l
network ip interface list network ip interface ipv4 list network ip interface ipv6 list
--mtu <mtu>
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>
--netmask <netmask> -n
VMware, Inc.
24
esxcfg-volume Theesxcfg-volumecommandmanagesLVMsnapshotorreplicavolumes.InvSphere5.0,equivalentESXCLI commandsareavailableintheesxcli storage filesystemandintheesxcli storage vmfsnamespaces. Table 21. esxcfg-volume Replacement Commands
esxcfg-volume Option --list -l --mount -m --persistent -M --resignature <VMFS-UUID|label> --umount -u <VMFS-UUID|label> ESXCLI Command storage vmfs snapshot list storage vmfs snapshot mount storage vmfs snapshot resignature storage vmfs snapshot unmount Description ListunresolvedsnapshotLUNsorreplicasofVMFSvolumes. MountasnapshotorreplicaofaVMFSvolume.Usethe --nopersistoptiontomountthevolumenon-persistently. Resignatureasnapshotorreplicavolume. DisconnectandunmountanexistingVMFSorNASvolume. Thecommanddoesnotdeletetheconfigurationforthe volume,butremovesthevolumefromthelistofmounted volumesandhaltsallI/Oornetworktrafficforthisvolume.
VMware, Inc.
25
--del-dvp-uplink | -Q <adapter_name> --dvp <DVPort_id> <dvswitch_name> --del-pg-uplink | -N <adapter_name> <port_group> <dvswitch_name> --dvp | -V
ESXCLIdoesnotsupportdistributedswitches. UsethevSphereClienttoconfiguredistributed switches. network vswitch standard portgroup policy failover set --active-uplinks=vmnic1,vmnic6,vminic7 ESXCLIdoesnotsupportdistributedswitches. UsethevSphereClienttoconfiguredistributed switches. network vswitch standard listincludes CDPinformation. network vswitch standard uplink add --uplink --vswitch PrintthecurrentCDP(CiscoDiscovery Protocol)settingforthisvirtualswitch (validforvSphere4.0andlater). Addanuplinkadapter(physicalNIC)to avirtualswitch.Runningthecommand withthisoptionattachesanewunused physicalnetworkadaptertoavirtual switch. Listallvirtualswitchesandtheirport groups. SettheMTU(maximumtransmission unit)ofthevirtualswitch.Thisoption affectsallphysicalNICsassignedtothe virtualswitch. Providethenameoftheportgroupfor the--vlanoption.SpecifyALLtoset VLANIDsonallportgroupsofavirtual switch. SettheCDPstatusforagivenvirtual switch(validforvSphere4.0andlater). Toset,specifydown,listen,advertise, orboth. Removeanuplinkadapterfromavirtual switch.Anuplinkadaptercorresponds toaphysicalEthernetadaptertowhich thevirtualswitchisconnected.Ifyou removethelastuplinkadapter,youlose physicalnetworkconnectivityforthat switch. Updatethelistofactiveuplinksforthe portgroup.
--pg | -p <port_group>
If you have comments about this documentation, submit your feedback to: docfeedback@vmware.com 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
26
-X --set-maxactive
esxtop TheesxtopcommandisavailableandsupportedintheESXiShell.SearchthevSphereDocumentationCenter, orseethevSphereResourceManagementdocumentation. esxupdate TheesxupdatecommandallowsyoutomanageESX4.0andlatersystems.Usethecommandsintheesxcli softwarenamespacetoinstall,update,remove,ordisplayindividualVIBs(softwarepackages).Use commandsintheesxcli software sourcesnamespacetoquerydepotcontentsforVIBsandimageprofiles. AnimageprofiledefinesanESXiimageandconsistsofVIBs. IMPORTANTTheupdateprocessinthevSphere5.0environmenthasbeensimplifiedanddifferssignificantly fromtheprocessinvSphere4.1.Severalcommandoptionsdonothavedirectequivalents.SeetheUpgrade Guide. Table 23. esxupdate Replacement Commands
esxupdate Command query info ESXCLI Command esxcli software vib list vSphere5.0doesnotsupportbulletins.Instead, youupdateyoursystemwithindividualVIBsor imageprofiles.SeetheUpgradedocumentation. esxcli software vib get --vibname=<str> esxcli software profile get update esxcli software vib update esxcli software profile update esxcli software vib install esxcli software profile install remove esxcli software vib remove TheupdatecommandupdatesVIBpackages butdoesnotinstallnewVIBs. TheinstallcommandinstallsVIBpackages fromaURLordepot.Thecommandinstalls, upgrades,ordowngradesVIBs. RemoveselectedVIBsfromthehost. Description ListallinstalledVIBpackages. DisplayinformationononeormoreVIBs.
VMware, Inc.
27
vmkfstools vmkfstoolsissupportedintheESXiShellandasavCLIcommand.SomedifferencesexistbetweentheESXi Shellvmkfstoolscommandandthevmkfstools.plvCLIcommand. NoequivalentESXCLIcommandexists.Someofthevmkfstoolsfunctionalityissupportedbyesxcli filesystem vmfs. vmware-cmd Thevmware-cmdcommandisincludedinthevCLIpackage,butisnotavailableintheESXiShell. vm-support Thevm-supportcommandisavailableintheESXiShell.Thevm-supportcommandisnotincludedinthe vCLIpackage. IMPORTANTThevSphereClientnowsupportsalloptionstovm-support.IfyoucannotusethevSphere ClienttoaccessyourESXisystem,youcanusethevm-supportcommand.
VMware, Inc.
28