Allow me to introduce you to a member of the VMware CLI family that you may have not yet met, the Ruby vSphere Console, also called RVC for short. The Ruby vSphere Console is a console user interface for VMware ESXi and Virtual Center. You may already know of the Ruby vSphere Console, as it has actually been an open source project for the past 2-3 years and is based on the popular RbVmomi Ruby interface to the vSphere API. RbVmomi was created with the goal to dramatically decrease the amount of coding required to perform simple tasks, as well as increase the efficiency of task execution, all while still allowing for the full power of the API when needed. The Ruby vSphere Console comes bundled with both the vCenter Server Appliance (VCSA) and the Windows version of vCenter Server. Most importantly, RVC is one of the primary tools for managing and troubleshooting a Virtual SAN environment.
RVC has a lot of the capabilities you’d expect from a modern command-line interface.
- Tab Completion
- Ruby Mode
- Python Mode
- VMODL Introspection
- Multiple Connections
- Single line Ruby scripts
RVC Setup and Configuration
The Ruby vSphere Console comes bundled with the vCenter Server Appliance (VCSA) and the Windows version of vCenter Server. It is free of charge and is fully supported. We recommend deploying a vCenter Server Appliance (minimum version 5.5u1b) to act as a dedicated server for the Ruby vSphere Console and Virtual SAN Observer. This will remove any potential performance or security issues from the primary production vCenter Server. After deploying the vCenter Server Appliance, no additional configuration is required to begin using the Ruby vSphere Console to manage your vSphere infrastructure. To begin using the Ruby vSphere Console, simply ssh to the dedicated vCenter Server Appliance and login as a privileged user.
Note: In light of the recommendation to leverage a dedicated vCenter Server Appliance for the Ruby vSphere Console and Virtual SAN Observer, we will use this recommendation as the context for the rest of this article and ensuing blog series.
See the link below for a walkthrough on deploying the vCenter Server Appliance 5.x
The Ruby vSphere Console contains 29 namespaces (vSphere areas on which commands can be executed) and a total of 197 commands in the current version (v1.8.0). It also has the ability for single line ruby code to be executed at the command line as well as options for more advanced custom scripting using Ruby or another language of your choice. See below for a full list of namespaces.
Below you will find the steps to login and begin using the Ruby vSphere Console:
1. SSH to the vCenter Server Appliance and login as a privileged user.
2. Login to the Ruby vSphere Console
rvc [options] [username[:password]@]hostname
login as: root
VMware vCenter Server Appliance
administrator<a href="mailto:firstname.lastname@example.org's">@192.168.1.100's</a> password:
Last login: Thu Jul 17 22:29:15 UTC 2014 from 10.113.230.172 on ssh
Last failed login: Fri Jul 18 06:31:16 UTC 2014 from 192.168.1.20 on ssh:notty
There was 1 failed login attempt since the last successful login.
Last login: Fri Jul 18 06:31:35 2014 from 192.168.1.20
vcsa:~ # rvc administrator:email@example.com
3. Type help at the Ruby vSphere Console command prompt to obtain a list of namespaces. To see detailed help for a command: help namespace_name.command_name
To see commands in a namespace: help namespace_name
To see detailed help for a command: help namespace_name.command_name
All RVC commands exist in Ruby modules and some of the more commonly used commands may have aliases. For example, the command to power off a VM is “vm.off”. This command exists within the Ruby module named “vm”. Since it is a rather common operation, it has been aliased to simply “off” for the sake of brevity.
In the next article in this series, we will begin taking a deeper look into using the Ruby vSphere Console in the context of a Virtual SAN implementation. Throughout this series we will be looking at Virtual SAN installation and configuration, management, and reporting through the eyes of the Ruby vSphere Console and Virtual SAN Observer. Stay tuned, you won’t want to miss this!