Getting Started with Ruby vSphere Console (RVC)

Ruby vSphere Console (RVC) - If you do not know what that is, you should definately give it a try. RVC is a Ruby based command line interface for vSphere and can be used to manage VMware ESXi and vCenter. Initially published as Fling, it grew into a fully implemented feature in vSphere 5.5. The vSphere inventory is presented in a tree structure, allowing you to navigate and run commands against vCenter objects. Many basic administrativ tasks can be done much more efficiently than clicking through the vSphere Client.

This guide covers some basic tasks and the procedure of how to use RVC with:

  • vCenter Server Appliance (VCSA)
  • Windows-based vCenter Server
  • vMA
  • Windows
  • Linux

Installation

RVC on vCenter Server Appliance (VCSA)
RVC is fully implemented in the vCenter Server Appliance since vSphere 5.5. Just open a SSH connection to the Appliance and use it:

vcsa:~ # rvc root@localhost

rvc-vcsa


RVC on Windows-based vCenter Server

Since vSphere 5.5, RVC is included in the vCenter Server installation.

  1. Press Start -> Run...
  2. Enter
    %PROGRAMFILES%\VMware\Infrastructure\VirtualCenter Server\support\rvc\rvc.bat
  3. Press OK
  4. Login

rvc-vcenter

RVC on vMA
Install Ruby and RVC (Taken from Howto install Ruby vSphere Console (RVC) on vMA 5.x):

vma:~ # sudo su
vma:~ # zypper install rubygems
vma:~ # \curl -L https://get.rvm.io | bash -s stable
vma:~ # source /etc/profile.d/rvm.sh
vma:~ # zypper install patch automake bison gcc gcc-c++ libtool patch gdbm-devel glibc-devel libffi-devel libopenssl-devel readline-devel zlib-devel
vma:~ # rvm install 1.9.2
vma:~ # gem install rvc
vma:~ # gem install ffi

Connect to a vCenter

vma:~ # rvc user@vcenter

rvc-vcsa

RVC on Windows
There is no direct download or installation package available at the moment. A working version is included on each vCenter Server 5,5, so you can copy it from there:

  1. Copy the entire support directory to you Windows machine:
    %PROGRAMFILES%\VMware\Infrastructure\VirtualCenter Server\support\
  2. Open \support\rvc\rvc.bat in Notepad
  3. Remove Administrator@localhost at the end of the line and save
    rvc-remove-auth
  4. Run rvc.bat

RVC on Linux
There are several Linux Distributions out there, so it is hard to write a guide that is applicable on all systems. You have to install rubygems on your system ([zypper/apt-get/yum] install rubygems). Than you can install RVC:

gem install rvc

Usage Basics

Getting Help
You can use the help command to get a list of all all available namespaces. To get help for a specific namespace, type help <NAMESPACE>
rvc-help

Navigate and Find Objects
RVC presents the vCenter in a tree structure. You can use ls and cd like you know it from a Linux console. The find command can display all sub-objects from a datacenter (VMs, Datastores,...)
rvc-find

Mark Objects
Marks allow you to save a path for later use. You can mark an objects with mark <KEY> <PATH>. To run commands against the objects, use ~<KEY>
rvc-mark

Multiple Connects
RVC can connect to more than one vCenter server at the same time by use of the connect command. Each connection is represented as folder at the top-level.
rvc-connect

Special Objects
RVC has a lot of special Objects that allow faster navigation:
"~1" represents the first object of the listing. You can use ~1 instead of the objects name. All objects are numbered and can be accessed faster by their number.
"~" refers to the Datacenter. cd ~/vms/ is a quick way to change to the current Datacenters VM Folder.
"~~" always points to the previous directory. Use cd ~~ to quickly toggle between two directories.

  1. Hey Florian, I'm trying to access RVC on a Windows vCenter. Do you know if DOMAIN\USER@hostname logon format works? Failed to parse URI is what I'm getting. When I do user@hostname I get prompted for password, but the login with "administrator" is failing, even though I'm sure the local administrator account is fine and the credentials are correct. Was your windows vCenter a domain joined machine?

  2. Manage Virtual SAN with RVC – Complete Guide | Virten.net - pingback on January 4, 2015 at 12:27 pm

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>