Rich Lane the creator of Ruby vSphere Console just recently released RVC 1.6 which includes some new features and bug fixes. If you are a current RVC user, you can update to the latest version by using the "gem" utility. For those of you who are not familiar with RVC, it is console UI for vCenter Server and ESX(i) host and it provides a way to interact with your vSphere infrastructure like the vSphere Client but using a console shell. RVC can be installed on a Windows, Linux or Mac OSX system and it's built on RbVmomi which is an open source Ruby library/bindings to the vSphere API.
I recently spent sometime revising RVC as it has gotten a significant amount of new features from the last time I looked at it. RVC currently has over 120+ commands that simplify some of the most common tasks such as cloning a VM (Full & Linked Clone), vDS Management, Cluster/Host/VM Management and many many others.
There are so many cool and unique features that RVC offers that I could not name them all, but I thought I share with you my top 5 favorite features of RVC.
1. vSphere Virtual Filesystem
RVC presents the vSphere infrastructure as a virtual filesystem, this allows you to quickly navigate your Hosts, Cluster, Datacenter, VMs, etc. in a very user friendly and intuitive manner. It also allows for tab completion of commands and the use of wild cards when referring to objects.
Here is an example of connecting to a vCenter Server and quickly building out a new infrastructure by creating a new datacenter, cluster, adding an ESXi host and then creating a Linked Clone VM in just seconds:
Here is another example of what can be done with the virtualFS that Rich has created, you can easily view or edit files within the datastores (e.g. .vmx,.vmdk,vmware.log).
2. Multi-vCenter Support
You can connect to multiple vCenter Server(s) at once and quickly navigate to any of your vCenter Servers to perform various operations. Each vCenter will have it's own constructed virtual filesystem that will show up when you login.
Here is an example of connecting to 4 different vCenter Servers:
3. Performance Graphs
You can view performance charts using RVC similar to the vSphere Client. RVC quickly allows you to see what performance metrics are relevant for an object and displaying the graph using gnuplot:
Here is an example of displaying the live "cpu.usagemhz.average" metric for an ESXi host:
4. Marks
You can think of marks like an alias, RVC allows you to quickly save your favorite paths for later use and also include them within commands. This can be really helpful if you do not want to keep typing out a super long path and just give it a short and easy name to remember.
Here is an example of creating a mark called "favVM" to a particular VM in my vSphere infrastructure and perform a linked clone operation using the mark I created:
RVC as Rich stated does not (yet) have every single capability that the vSphere Client has, but is extremely extensible. Anyone with a bit of Ruby and vSphere API knowledge can extend or create new commands for RVC. It it modular in nature and when you create/extend a new command, you do not necessary need to add it to the original RVC source code. You can actually add your *.rb files into the .rvc directory in your home directory and RVC will automatically pickup the commands you added. If you create some cool and useful new commands, be sure to send them to Rich via the github project so he can include it in the main branch.
Here is an example of extending two new commands for "cluster" object. There are currently only three cluster commands by default: add, configure_ha and create. You may have noticed that configuring DRS is not one of the available commands, but wouldn't it be nice to have it? I created two new commands called "configure_drs" and "configure_automationlevel" which allows you to enable/disable DRS for a cluster and also specifying the DRS automation level.
Here is the source code for two commands that were added in .rvc/cluster.rb
# William Lam # http://www.virtuallyghetto.com/ ## Command to Enable/Disable DRS ## opts :configure_drs do summary "Configure DRS on a cluster" arg :cluster, nil, :lookup => VIM::ClusterComputeResource opt :disabled, "Disable DRS", :default => false end def configure_drs cluster, opts spec = VIM::ClusterConfigSpecEx( :drsConfig => { :enabled => !opts[:disabled], } ) one_progress(cluster.ReconfigureComputeResource_Task :spec => spec, :modify => true) end ## Command to Configure DRS Automation Level ### opts :configure_automationlevel do summary "Configure DRS Automation level on a cluster" arg :cluster, nil, :lookup => VIM::ClusterComputeResource arg :level, "DRS Automation Level [fullyAutomated|manual|partiallyAutomated]" end def configure_automationlevel cluster, level spec = VIM::ClusterConfigSpecEx( :drsConfig => { :defaultVmBehavior => level, } ) one_progress(cluster.ReconfigureComputeResource_Task :spec => spec, :modify => true) end
Note: This was my first time writing any Ruby code, I'm sure I could have combined the two operations with some conditionals and then create the property drsConfig object.
If these five features of RVC seems really cool, I would highly recommend you go download and install RVC and give the rest a spin. If you have any feedback, questions or want to submit a patch for the RVC project, be sure to check out the RVC github project page for all the details.
id says
Hi there William,
I´ve just discovered your post on this after you mentioned your site at the How to guide in the community and saw the little but annoying readline thing at the start of rvc. I had that too once and I wonder if you would like to get it sorted out.
Do you use rvm (http://beginrescueend.com/) ? The Ruby Version Manager? If so it´s kinda simple.
Just install libreadline with your favorite package manager.
Then do the rvm install side:
rvm package install readline
Then install your version of choice:
rvm install 1.9.2 --with-readline-dir=$rvm_path/usr
And use it:
rvm --default use 1.9.2
Hope this helps =)
Greetings,
Kjellski
William says
@Kjellski,
Thanks for the tip, I don't use RVM, but I'll take a look as I've noticed that minor warning message. I've also reported it to Rich as well, perhaps he can document or find an alternative.
Thanks