Hi All ...
In the last part of our series, we'll go through vSphere CLI. A powerful tool that helps with many advanced configurations can't be done with regular vSphere Java Client or vSphere Web Client.
vSphere CLI is on two levels: either using ESXi Shell and SSH or using vSphere CLI which is installed separately. The following notes are including both levels. For more information, visit the following web portal of VMware:
https://www.vmware.com/support/developer/vcli/
Credits:
- Paul Grevink
Now, Let's Start...
1. ESXCLI Full Tree:
This nice blog post by Paul Grevink is nice starter guide for using ESXCLI command tree which is available through either ESXi Shell, SSH or vCLI. It introduces ESXCLI command and also summarize all the subsidiary trees in a nice diagram:
http://paulgrevink.wordpress.com/2012/06/24/mindmapping-the-esxcli-command/#more-866
2. Some Scattered Commands:
The following table explains and summarizes some dozens of commands used through CLI (Items in BLUE are user input):
CMD | General Description | Syntax | Description |
esxcfg-mpath | Managing multi-pathing options on ESXi Host. | -b -d Device_ID | Listing all available paths to the device Device_ID. |
esxcfg-vmknic | Managing Vmkernel ports of ESXi Host. | -a -i IPv4_Address -n Netmask -p Portgroup_Name | Adding a new Vmkernel port with IPv4_Address, Netmask & inside a vSS in Portgroup_Name portgroup. |
-d -s vDS_Name -v Port_ID | Deleting Vmkernel port from vDS_Name from port Port_ID. | ||
-l | Listing all Vmkernel ports on this ESXi host. | ||
esxcli | Managing ESXi host from different aspects. | storage core adapter list | Listing all storage adapters on this host. |
storage core adapter rescan --all | Rescanning on all storage adapters on this host for any new added storage. | ||
storage core device list | Listing all available devices connected to that host. | ||
storage core device vaai status get | Listing the status of all datastores VAAI. | ||
storage core claimrule list | Listing all Claim Rules available on that host. | ||
storage core claimrule add –r Rule_ID–t Type…. | Adding a new Claim Rule with Rule_ID and Type and additional parameters (requires [storage core claimrule load] after). | ||
storage core claimrule load | Loading newly added Claim Rules into VMKernel. | ||
storage core claimrule run | Running newly added Claim Rules. | ||
storage core claimrule remove –r Rule_ID | Remove the Claim Rule with certain Rule_ID (requires [storage core claimrule load] after). | ||
storage core claiming reclaim –d Device_ID | Rescanning ESXi’s adapters connected to device Device_ID for newly applied Claim Rules. | ||
storage core claiming unclaim –t Type…. | Unclaiming for resetting and reclaiming according to newly added Claim Rule. | ||
storage core path list –d Device_ID | Listing all paths available to the device Device_ID. | ||
storage filesystem unmounts –l Datastore_Name | Unmounting datastore Datastore_Name from the host even if some VMs reside on it but powered-off. | ||
storage nmp satp rule add –t Type…. –o=Option | Adding new SATP Rule with Type, additional parameters and certain option (like enable_ssd). | ||
storage nmp satp rule list | Listing all installed and loaded SATP rules on ESXi Host. | ||
storage nmp satp rule remove –t Type… | Removing an added SATP Rule with Type and additional paramters. | ||
storage nmp satp set –s SATP_Rule–P PSP_Rule | Setting certain default PSP_Rule for certain SATP_Rule. | ||
system module get –m Module_Name | Getting all information about Module_Name module (driver) loaded. | ||
system module list | Listing all modules (drivers) loaded within ESXi. | ||
system settings advanced list | Listing all advanced settings descriptions and values on this host. | ||
system settings advanced list –o Advanced_Setting_Path(/Branch/Adv_Option_Name) | Listing certain advanced setting’s description and value on this host. | ||
system snmp –e ‘0/1 or true/false or yes/no’ -c SNMP_Target_Community–t Target_Name_or_IP@UDP_Port/Community | Enabling and setting SNMP v1 for a Host to a target Target_Name_or_IP on port UDP_Port with community SNMP_Target_Community (overridden by –t /Community ). | ||
system snmp get | Listing all SNMP configured settings. | ||
system snmp test | Sending a test SNMP trap. | ||
system syslog config get | Getting all Network Syslog Collector settings configured. | ||
system syslog config set --loghost=Collector_Name_or_IPv4 --logdir-unique=1 | Configuring Remote Syslog Collector with Collector_Name_or_IPv4 and configuring that each ESXi host will log to unique directory with its Hostname. | ||
system syslog reload | Reloading all new configured Network Syslog Collector settings. | ||
system syslog mark –s=Message | Sending test message (Message) to the Network Syslog Collector to be logged as a test. | ||
esxtop | Monitoring tool for performance metrics of ESXi hosts | -b –a –d Duration_in_Secs–n Iterations_No. | Batch Mode: Recording all performance metrics of ESXi host every Duration_in_Secs for Iterations_No. number of times, i.e. that will give me for every metric Iteration_No. of records. |
vmkfstools | Managing VMs disks and datastores FS. | -c Size‘/vmfs/volumes/Datastore_Hashed_Name/VM_Directory/Disk_Name.vmdk’ -a ‘Adapter_Type’ -d ‘Disk_Type’ | Creating a Disk with certain size, name, adapter type and disk type. |
-U ‘/vmfs/volumes/Datastore_Hashed_Name/VM_Directory/Disk_Name.vmdk’ | Deleting certain disk. | ||
vscsiStats | Performance monitoring tool on all VMS’ disk. | -l | Listing all available VMs (Worlds) and disks (Handles). |
-s | Starting monitoring on all VMs (Worlds) and disks (Handles). | ||
-s -w World_ID -i Handle_ID | Starting monitoring on certain VM (World) and disk (Handle). | ||
-c > ‘Path/Name.csv’ | Creating Name.csv file in Path of all the outputs. | ||
-p ‘Histo_Type’ | Drawing the Histo Type selected for states collected from –s command. Histo Types are: (all, ioLength, seekDistance, outstandingIOs, latency, interarrival) | ||
-x | Stopping monitoring on all VMs (Worlds) and disks (Handles). | ||
-x –w World_ID–i Handle_ID | Stopping monitoring on certain VM (World) and disk (Handle). |
Share the knowledge ...
Previous: vSphere 5.x Notes & Tips - Part XXIII: