Ruby vSphere Console
The vCenter appliance contains a ruby
vsphere console. Once you use putty into the vCenter appliance, use the following command to start
using rvc.
myvcenter:~ # rvc administrator@vsphere.local@localhost
0 /
1 localhost/
Learn how to use the built in help.
> help
Namespaces:
basic
vm
vds
issue
esxcli
statsinterval
core
datacenter
vsan
vmrc
connection
alarm
mark
host
role
datastore
device
vim
vm_guest
find
spbm
resource_pool
perf
diagnostics
permissions
syslog
vnc
cluster
snapshot
To see commands in a namespace: help
namespace_name
To see detailed help for a command:
help namespace_name.command_name
> help cluster
Commands:
create: Create a cluster
add_host: Add a host to a cluster
configure_ha: Configure HA on a cluster
configure_drs: Configure DRS on a
cluster
configure_swap: Configure VM Swap
Placement on a cluster
recommendations: List recommendations
apply_recommendations: Apply
recommendations
To see commands in a namespace: help
namespace_name
To see detailed help for a command:
help namespace_name.command_name
Learn to navigate through the rvc and use commands
> ls
0 /
1 localhost/
> cd 1
/localhost> ls
0 Training (datacenter)
/localhost> cd 0
/localhost/Training>
> cd 1
/localhost> ls
0 Training (datacenter)
/localhost> cd 0
/localhost/Training> ls
0 storage/
1 computers [host]/
2 networks [network]/
3 datastores [datastore]/
4 vms [vm]/
/localhost/Training> cd 4
/localhost/Training> cd 4
/localhost/Training/vms> ls
0 Discovered virtual machine/
1 vm1: poweredOn
2 vm2: poweredOn
/localhost/Training/vms> cd 1
/localhost/Training/vms/vm1>
ls
0 datastores/
1 networks/
2 files/
3 snapshots
4 devices/
5 vmprofiles/
6 host [esxi01.vclass.local] (host):
cpu 1*1*2.67 GHz, memory 6.00 GB
7 resourcePool [Resources]: cpu
1.04/1.04/normal, mem 4.40/4.40/normal
/localhost/Training/vms/vm1>
cd snapshots
/localhost/Training/vms/vm1/snapshots>
ls
0 snap1
/localhost/Training/vms/vm1/snapshots>
cd ../../..
/localhost/Training> cd storage
/localhost/Training/storage> ls
0 vmprofiles/
/localhost/Training/storage> cd
vmprofiles
/localhost/Training/storage/vmprofiles>
ls
0 Policy 1 policy
1 Policy 2 policy
/localhost/Training/storage/vmprofiles/Policy 1 policy/datastores> cd /
> ls
0 /
1 localhost/
> cd 1
/localhost> ls
0 Training (datacenter)
/localhost> cd 0
/localhost/Training> ls
0 storage/
1 computers [host]/
2 networks [network]/
3 datastores [datastore]/
4 vms [vm]/
/localhost/Training> cd 1
/localhost/Training/computers> ls
0 Cluster 1 (cluster): cpu 1 GHz,
memory 4 GB
1 Cluster 2 (cluster): cpu 1 GHz,
memory 4 GB
2 esxi04.vclass.local (standalone): cpu
0 GHz, memory 3 GB
3 esxi08.vclass.local (standalone): cpu
0 GHz, memory 3 GB
/localhost/Training/computers>
vsan.check_state "Cluster 1"
2014-05-02 15:29:07 +0000: Step 1:
Check for inaccessible VSAN objects
Detected 0 objects to be inaccessible
2014-05-02 15:29:08 +0000: Step 2:
Check for invalid/inaccessible VMs
2014-05-02 15:29:08 +0000: Step 3:
Check for VMs for which VC/hostd/vmx are out of sync
Did not find VMs for which VC/hostd/vmx
are out of sync
> vsan.cluster_info "Cluster 1"
Host: esxi01.vclass.local
VSAN enabled: yes
Cluster info:
Cluster role: agent
Cluster UUID:
52316ae9-d251-3a1f-5ba9-862a6c842f6a
Node UUID:
534dfbb0-c2c3-65bc-85ac-005056013945
Member UUIDs:
["534dfd0a-a332-4185-9a86-005056013946",
"534dfd7f-fa7a-46cc-0030-005056013947",
"534dfbb0-c2c3-65bc-85ac-005056013945"] (3)
Storage info:
Auto claim: no
Disk Mappings:
SSD: VMware Serial Attached SCSI
Disk (mpx.vmhba1:C0:T3:L0) - 2 GB
MD: VMware Serial Attached SCSI
Disk (mpx.vmhba1:C0:T2:L0) - 5 GB
MD: VMware Serial Attached SCSI
Disk (mpx.vmhba1:C0:T1:L0) - 5 GB
NetworkInfo:
Adapter: vmk2 (172.20.13.61)
Host: esxi02.vclass.local
VSAN enabled: yes
Cluster info:
Cluster role: master
Cluster UUID:
52316ae9-d251-3a1f-5ba9-862a6c842f6a
Node UUID:
534dfd0a-a332-4185-9a86-005056013946
Member UUIDs:
["534dfd0a-a332-4185-9a86-005056013946",
"534dfd7f-fa7a-46cc-0030-005056013947",
"534dfbb0-c2c3-65bc-85ac-005056013945"] (3)
Storage info:
Auto claim: no
Disk Mappings:
SSD: VMware Serial Attached SCSI
Disk (mpx.vmhba1:C0:T3:L0) - 2 GB
MD: VMware Serial Attached SCSI
Disk (mpx.vmhba1:C0:T2:L0) - 5 GB
MD: VMware Serial Attached SCSI
Disk (mpx.vmhba1:C0:T1:L0) - 5 GB
NetworkInfo:
Adapter: vmk2 (172.20.13.62)
Host: esxi03.vclass.local
VSAN enabled: yes
Cluster info:
Cluster role: backup
Cluster UUID:
52316ae9-d251-3a1f-5ba9-862a6c842f6a
Node UUID:
534dfd7f-fa7a-46cc-0030-005056013947
Member UUIDs:
["534dfd0a-a332-4185-9a86-005056013946",
"534dfd7f-fa7a-46cc-0030-005056013947",
"534dfbb0-c2c3-65bc-85ac-005056013945"] (3)
Storage info:
Auto claim: no
Disk Mappings:
SSD: VMware Serial Attached SCSI
Disk (mpx.vmhba1:C0:T3:L0) - 2 GB
MD: VMware Serial Attached SCSI
Disk (mpx.vmhba1:C0:T2:L0) - 5 GB
MD: VMware Serial Attached SCSI
Disk (mpx.vmhba1:C0:T1:L0) - 5 GB
NetworkInfo:
Adapter: vmk2 (172.20.13.63)
/localhost/Training/computers>
vsan.disks_stats "Cluster 1"
2014-05-02 15:33:47 +0000: Fetching
VSAN disk info from esxi01.vclass.local (may take a moment) ...
2014-05-02 15:33:47 +0000: Fetching
VSAN disk info from esxi03.vclass.local (may take a moment) ...
2014-05-02 15:33:47 +0000: Fetching
VSAN disk info from esxi02.vclass.local (may take a moment) ...
2014-05-02 15:33:49 +0000: Done
fetching VSAN disk infos
+---------------------+---------------------+-------+------+----------+------+----------+--------+
| |
| | Num | Capacity | | | Status |
| DisplayName | Host
| isSSD | Comp | Total | Used | Reserved | Health |
+---------------------+---------------------+-------+------+----------+------+----------+--------+
| mpx.vmhba1:C0:T3:L0 |
esxi01.vclass.local | SSD | 0 | 1.75 GB | 0 % | 0 % | OK
| mpx.vmhba1:C0:T1:L0 |
esxi01.vclass.local | MD | 3 | 4.75 GB | 22 % | 0 % | OK
| mpx.vmhba1:C0:T2:L0 |
esxi01.vclass.local | MD | 3 | 4.75 GB | 21 % | 11 % | OK
+---------------------+---------------------+-------+------+----------+------+----------+--------+
| mpx.vmhba1:C0:T3:L0 |
esxi02.vclass.local | SSD | 0 | 1.75 GB | 0 % | 0 % | OK
| mpx.vmhba1:C0:T2:L0 |
esxi02.vclass.local | MD | 6 | 4.75 GB | 11 % | 0 % | OK
| mpx.vmhba1:C0:T1:L0 |
esxi02.vclass.local | MD | 1 | 4.75 GB | 21 % | 11 % | OK
+---------------------+---------------------+-------+------+----------+------+----------+--------+
| mpx.vmhba1:C0:T3:L0 |
esxi03.vclass.local | SSD | 0 | 1.75 GB | 0 % | 0 % | OK
| mpx.vmhba1:C0:T2:L0 |
esxi03.vclass.local | MD | 4 | 4.75 GB | 11 % | 0 % | OK
| mpx.vmhba1:C0:T1:L0 |
esxi03.vclass.local | MD | 3 | 4.75 GB | 23 % | 0 % | OK
/localhost/Training/computers> cd
..
/localhost/Training> mark cluster
~/computers/"Cluster 1"/.
/localhost/Training> mark esxi
~cluster/hosts/esxi01.vclass.local
/localhost/Training> mark vm
~/vms/vm01
/localhost/Training>
vsan.host_info ~esxi
VSAN enabled: yes
Cluster info:
Cluster role: agent
Cluster UUID:
52316ae9-d251-3a1f-5ba9-862a6c842f6a
Node UUID:
534dfbb0-c2c3-65bc-85ac-005056013945
Member UUIDs:
["534dfd0a-a332-4185-9a86-005056013946",
"534dfd7f-fa7a-46cc-0030-005056013947",
"534dfbb0-c2c3-65bc-85ac-005056013945",
"534e0297-570b-86ec-fbd5-00505601394f"] (4)
Storage info:
Auto claim: no
Disk Mappings:
SSD: VMware Serial Attached SCSI
Disk (mpx.vmhba1:C0:T3:L0) - 2 GB
MD: VMware Serial Attached SCSI
Disk (mpx.vmhba1:C0:T2:L0) - 5 GB
MD: VMware Serial Attached SCSI
Disk (mpx.vmhba1:C0:T1:L0) - 5 GB
NetworkInfo:
Adapter: vmk2 (172.20.13.61)
/localhost/Training>
vsan.whatif_host_failures -s ~cluster
Current utilization of hosts:
+---------------------+---------+--------------+------+----------+----------------+--------------+
| | | HDD
Capacity | | | Components | SSD Capacity |
| Host | NumHDDs | Total
| Used | Reserved | Used | Reserved |
+---------------------+---------+--------------+------+----------+----------------+--------------+
| esxi03.vclass.local | 2 | 9.50
GB | 22 % | 5 % | 9/562 (2 %) | 0 % |
| esxi02.vclass.local | 2 | 9.50
GB | 16 % | 5 % | 9/562 (2 %) | 0 % |
| esxi01.vclass.local | 2 | 9.50
GB | 23 % | 5 % | 9/562 (2 %) | 0 % |
| esxi04.vclass.local | 2 | 9.50
GB | 17 % | 5 % | 4/562 (1 %) | 0 % |
+---------------------+---------+--------------+------+----------+----------------+--------------+
Simulating 1 host failures:
+-----------------+----------------------------+-----------------------------------+
| Resource | Usage right now
| Usage after failure/re-protection |
+-----------------+----------------------------+-----------------------------------+
| HDD capacity | 19% used (30.64 GB
free) | 26% used (21.14 GB free)
| Components | 1% used (2217
available) | 2% used (1655 available)
| RC reservations | 0% used (6.99 GB
free) | 0% used (5.24 GB free)
/localhost/Training>
vsan.enter_maintenance_mode ~esxi
EnterMaintenanceMode
esxi01.vclass.local: running [=
/localhost/Training/networks/vDS01>
cd /
> vsan.observer ~cluster
--run-webserver --force
Couldn't load gnuplot lib
[2014-05-02 16:04:56] INFO WEBrick
1.3.1
[2014-05-02 16:04:56] INFO ruby 1.9.2
(2011-07-09) [x86_64-linux]
[2014-05-02 16:04:56] WARN TCPServer
Error: Address already in use - bind(2)
Press <Ctrl>+<C> to stop
observing at any point ...
2014-05-02 16:04:56 +0000: Collect one
inventory snapshot
[2014-05-02 16:04:56] INFO
WEBrick::HTTPServer#start: pid=22174 port=8010
Query VM properties: 0.10 sec
Query Stats on esxi02.vclass.local:
0.88 sec (on ESX: 0.20, json size: 151KB)
Query Stats on esxi01.vclass.local:
0.97 sec (on ESX: 0.20, json size: 156KB)
Query Stats on esxi03.vclass.local:
0.96 sec (on ESX: 0.19, json size: 155KB)Query Stats on
esxi04.vclass.local: 0.87 sec (on ESX: 0.19, json size: 137KB)
Note: Now launch the browser and point
to the vcenter server port 8010 (no https).