In our first article in this series, we looked at the history, features, and setup of the Ruby vSphere Console. Built upon the Ruby interface to the vSphere API (RbVmomi), the Ruby vSphere Console is a powerful management utility for the vSphere infrastructure, as well as an efficient integration option for third party applications and cli-based automation.

In today’s article, we will begin digging further into the features and usage of the Ruby vSphere Console by leveraging it to explore the vSphere and Virtual SAN infrastructure. Within RVC, the vSphere infrastructure is presented to the user as a virtual file system. This allows us to navigate its managed entities and even execute commands against them as well.

RVC Setup and Configuration

RVC comes bundled with vCenter server and does not require any additional setup or configuration to begin using. It is recommended to deploy a dedicated Virtual Center Server Appliance (VCSA) to act as a dedicated server for RVC and Virtual SAN Observer server in order to offload the additional resource consumption from effecting the production vCenter server(s). See Part 1 of this series for a more in depth explanation of the installation and configuration process.

Accessing RVC

1. SSH to the vCenter Server Appliance and login as a privileged user.
2. Login to the Ruby vSphere Console


Example: = My workstation = Dedicated vCenter Server Appliance for RVC and Virtual SAN Observer = Primary vCenter Server Appliance

Navigating the vSphere and Virtual SAN infrastructure

The vSphere and Virtual SAN infrastructure is presented to the user as a virtual file system that can be navigated with traditional directory listing (ls) and change directory (cd) commands. This virtual file system mirrors the hierarchy of the vSphere infrastructure and allows RVC commands to be issued on each of the manageable entities and their individual components (i.e. vCenter, Datacenter, Cluster, Storage, Hosts, Networks, Datastores, VMs).

In the example below, we have completed the steps detailed above and logged in via SSH to the dedicated vCenter Server Appliance (VCSA). We then launched RVC from the dedicated VCSA and pointed it to the production vCenter server as a data source. Afterwards we issued the ls command to obtain a directory listing from the root directory. Below we see a “/” for the root directory and then “” illustrating the directory for our production vCenter server.

RVC can even connect to more than one vCenter or ESXi server at the same time. There are two options to connect to multiple servers. First, if you are outside of the RVC shell, simply add more hosts to the command line and separate them by a space (e.g. “rvc root@localhost root@”). If you are inside of the RVC shell use the command “connect”. Each server connection will be represented as a top-level node in the virtual file system. This will allow you to interact with multiple environments simultaneously which can be useful for reporting, comparing configurations, etc. Remember that the rvc command is looking to connect to an active vCenter installation so if you deploy a dedicated VCSA for RVC and Virtual SAN Observer management and follow the suggestion of not configuring vCenter, the command “rvc root@localhost” will fail with errors because there is no active vCenter server.

Note: Depending upon your security requirements, you can also avoid the password prompt by including the password in your connect command (e.g. “rvc root:vmware@localhost root:vmware@”).

Notice that each line of output in the directory listing above contains a single digit number to the left of the item listed almost as though it is a line number. This number actually serves as a variable that can be used to issue commands against rather than requiring the full line item text to be entered. In the example below, instead of typing out “cd” to change directories and drill down into that vCenter, I simply typed “cd 1” and achieved the same results. This can quickly speed up interacting with RVC as it significantly cuts down the number of keystrokes required while it also cuts down on the number of my fat finger typing errors.

The vSphere and Virtual SAN infrastructure is presented to the user as a virtual file system that can be navigated with traditional directory listing (ls) and change directory (cd) commands. These commands are actually functions within the RVC Ruby module “basic” and in their formal form would be “” and “”. As these are very common commands, they have been aliased to “ls” and “cd” for ease of use. In the example below you will see how to drill down through the vSphere and Virtual SAN infrastructure to begin interacting with their manageable components.

The RVC virtual file system mirrors the hierarchy of the vSphere infrastructure. It displays the vSphere infrastructure as vCenter ⇒ Datacenter ⇒ (Storage, Hosts, Networks, Datastores, VMs).

The vSphere environment is broken up into 5 areas:
vSphere Storage Profiles
Computers: ESXi Hosts
Networks: Networks and network components
Datastores: Datastores and datastore components
VMs: Virtual Machines and virtual machine components

In the 1.8.0 release of RVC there are 29 Namespaces and 197 commands built-in to interact with the managed entities. In the event you do not have ready access to an RVC installation or would like to view the help offline, I have included a pdf containing a listing of each command and its help dialogue in the Resources section at the end of this article.

RVC Command Examples for Virtual SAN

Below are a few initial commands that I would like to highlight to help get you started using RVC. Remember, to obtain a listing of namespaces, simply type “help” at the RVC command line. To obtain a listing of commands within a particular namespace, simply type “help <namespace>” at the RVC command line.

“Basic” Namespace (” and ““)
The “” and “” commands are aliased as “info” and “show” respectively. These are great commands to use when you would like to get a simple overview of a managed entity.

Viewing SPBM Information: “show vmprofiles”
In my environment, I have 2 Storage Policies configured. In the example below, I have used the “ls” and “show” commands to list all of the Storage Policies I have configured in my environment. Note: When listing the contents of the vmprofiles directory, I had to include the trailing “/” character for the results to display. Without it you may see the “Errno::EPIPE: Broken pipe” message. Keep this in mind when navigating through the vSphere infrastructure using the RVC shell as I have run up against this in other directories as well.

Viewing Virtual SAN Datastore Capacity: “show vsanDatastore”
Here is an example of using “ls” to list out datastores within the infrastructure and then using “show” to obtain high level information on the “vsanDatastore”. Notice the capacity and free space of the vsanDatastore.

In the following example, we can see the navigation of the datastore directory. Within it we can find listings of all of the datastores in the vSphere infrastructure. By drilling down into a specific datastore, we can then see all of the files and virtual machines along with the hosts consuming storage as well. The capabilitysets directory does not currently list out its contents.

As you can see, the Ruby vSphere Console can be a great tool in the VMware Administrator’s toolbelt. If you have not yet had any hands on experience with RVC, try drilling down into each area with the “cd” and “ls” commands and use the “show” and “info” commands to obtain more information on the entities within. It is a great way to familiar yourself with RVC and even perhaps grow your knowledge of the vSphere and Virtual SAN infrastructures.

Stay Tuned…
In the next few articles in this series, we will be digging in to more advanced RVC commands and syntax while also looking at Virtual SAN installation and configuration, management, and reporting. Stay tuned, there is much more to uncover!

RVC CLI Help Output

Managing Virtual SAN with RVC Series:
Part 1 – Introduction to the Ruby vSphere Console


About the Author

Joe Cook

Joe Cook is a Senior Technical Marketing Manager at VMware, currently focusing on automation of current and future VMware software-defined storage products, with specific emphasis on automating datacenter operations. Joe has over 20 years of industry experience in the design, implementation, and operation of complex IT environments ranging in size from Enterprise to SMB. Stay in touch with Joe via @CloudAnimal on Twitter for information on: vSphere Storage Policy Based Management Virtual Virtual SAN Monitoring and Troubleshooting VVOLs