The VSAN Observer is a very powerful tool that allows you to get in-depth performance analysis of your VSAN environment. One of the really useful feature is the ability to run the VSAN Observer in "collection" mode by using the --generate-html-bundle option. Something that I have noticed when running the VSAN Observer in collection mode is that you not close the current SSH session, else the collection will stop. I have even tried running the VSAN Observer using RVC's not very well known "script" feature and then back-grounding the process, but after a minute or so the collection also just stops.
The only workaround that I have found is by using Screen, a full-screen windows session manager usually found on most Linux/UNIX and Mac OS X systems. Having used Screen in the past life as a Systems Administrator, I can say it is an extremely useful tool when needing to perform long running tasks and not have to worry about your SSH session being disconnected. You can start a session, disconnect and then re-connect at a later time to monitor the progress.
If you are on a Mac, then Screen should have already been installed. Below are the steps to run the VSAN Observer in the VCSA using Screen:
Step 1 - Start screen and give the session a name such as "VSAN-Observer" for example:
screen -S VSAN-Observer
Step 2 - SSH to your VCSA and login to RVC and start the VSAN Observer using the collection mode as you normally would. For step by step instructions, check out Rawlinson Rivera's article here on setting up the VSAN Observer.
Step 3 - Once the VSAN Observer is running, enter the following key combinations which will detach your Screen session:
Crtl+a d
Step 4 - To list the available Screen sessions, you can run the following command:
screen -list
Step 5 - To re-attach to your Screen session, you will need to specify the session name. In our example, it was called VSAN-Observer:
screen -r VSAN-Observer
An alternative to Step 2, instead of running the VSAN Observer interactively, I actually prefer to run the VSAN Observer using RVC's script option. It is just less typing for me and makes it easy to collect stats across multiple VSAN environments
To do so, you will need to create a script file that contains the following:
# William Lam # www.virtuallyghetto.com # RVC script for running VSAN Observer datacenter_name = "VSAN-Datacenter" cluster_name = "VSAN-Cluster" vsan_html_output_directory = "/storage/core" vsan_observer_runtime = "1" # Do not edit beyond here # puts "Enabling VSAN Observer collection for: #{cluster_name} ..." rvc_exec("vsan.observer --run-webserver --force --generate-html-bundle #{vsan_html_output_directory} --max-runtime #{vsan_observer_runtime} /localhost/#{datacenter_name}/computers/#{cluster_name}")
The RVC script option actually accepts a Ruby script to execute and if we take a look at the script, we are just passing some arguments to the vsan.observer command.
To use the RVC script instead of interactively logging in, you can run the following command:
rvc -s [SCRIPT-NAME] [USERNAME:PASSWORD]@localhost
I think a nice feature enhancement to the VSAN Observer is the ability to automatically background the collection process without having to rely on the existing SSH connection, perhaps this is something Christian may consider for a future update to RVC 🙂 In the meantime, this is a pretty decent work around
Chuck Emory says
I am not sure I am following you. Doesn't screen have to be installed on the VCSA ? When I log into the VCSA screen is not installed. Having screen on my local machine wouldn't do me much good.
As far as the script where do I put that? I would like to run the VSAN Observer 24/7 even, if possible have it startup when the VCSA boots.
I wish vmware would make this part of the standard logging & monitoring of the system, or at least 1 click to enable it, not this convoluted process to use it.