WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple

Exploring VSAN APIs Part 10 – VSAN Disk Health

06.04.2014 by William Lam // 1 Comment

In additional to monitoring storage and host utilization of your VSAN Cluster, the health of the individual disks contributing to your VSAN Cluster is probably one of, if not the most important thing to keep an eye on. In the vSphere Web Client, this information can be accessed by navigating over to the VSAN Disk Management tab as seen in the screenshot below.

vsan-disk-health-0
Even though this information is available from the UI, it would also be useful to be able to extract this information programmatically using the vSphere API either for external monitoring or informational purposes. I recently had did some work on this, so I figure I might as well share an example script that demonstrates this functionality. To do so, I of course created a sample vSphere SDK for Perl script called vsanDiskHealth.pl

Disclaimer:  These scripts are provided for informational and educational purposes only. It should be thoroughly tested before attempting to use in a production environment.

The script leverages the QueryPhysicalVsanDisks() API which accepts a list of properties to collect on an individual VSAN Disk. You can also leave the method blank, in which all properties will be returned. For our use case, we are collecting a sub-set of the properties which includes: owner, uuid, isSsd, capacity, capacityUsed, disk_health.

To check the current health of your VSAN Disks, you just need to specify the name of a VSAN enabled Cluster:

./vsanDiskHealth.pl --server .vcenter55-1 --username root --cluster VSAN-Cluster

vsan-disk-health-1

  1. Exploring VSAN APIs Part 1 – Enable VSAN Cluster
  2. Exploring VSAN APIs Part 2 – Query available SSDs
  3. Exploring VSAN APIs Part 3 – Enable VSAN Traffic Type
  4. Exploring VSAN APIs Part 4 – VSAN Disk Mappings
  5. Exploring VSAN APIs Part 5 – VSAN Host Status
  6. Exploring VSAN APIs Part 6 – Modifying Virtual Machine VM Storage Policy
  7. Exploring VSAN APIs Part 7 – VSAN Datastore Folder Management
  8. Exploring VSAN APIs Part 8 – Maintenance Mode
  9. Exploring VSAN APIs Part 9 – VSAN Component count
  10. Exploring VSAN APIs Part 10 – VSAN Disk Health

Categories // Automation, VSAN, vSphere 5.5 Tags // disk health, VSAN, vSphere API

Extending VSAN capabilities in the vSphere Web Client using vCO

05.29.2014 by William Lam // Leave a Comment

One of my favorite features of vCenter Orchestrator is how easy it is to extend an existing vCO workflow and making it available directly in the vSphere Web Client. I think this is still not a very well known feature of vCO, but once you realize the capability of this feature, you will see how powerful it is to be able to provide context aware workflows in the vSphere Web Client. Another thing to be aware of is that vCO also provides full access to the underlying vSphere API, this means you can easily expose new functionality that may not exists in the vSphere Web Client.

A good example of this is a recent workflow that I created to extend some additional VSAN information directly in the vSphere Web Client. I wanted to be able to easily view the number of VSAN components for each of my ESXi hosts. Since this information is available through the vSphere API which I wrote about here, I was able to create a vCO Workflow which exposed this information and then make it available in the vSphere Web Client.

To get started, you will need to download the workflow and an updated vCenter vCO Plugin as it contains a fix for leveraging the VSAN APIs:

  • List VSAN Host Component Count.workflow
  • vCenter vCO Plugin 5.5.2 (currently in Tech Preview)

In the example below, I am using the vCO Appliance but the steps are very similar if you are using the Windows version.

Step 1 - Upload the o11nplugin-vsphere.dar.zip to your vCO Appliance

Step 2 - Unzip the contents by running the following command:

unzip o11nplugin-vsphere.dar.zip

Step 3 - Run the following command to set the appropriate ownership and permissions:

chmod 644 o11nplugin-vsphere.dar
chown vco:vco o11nplugin-vsphere.dar

Step 4 - Backup the original vCenter vCO Plugin by running the following command:

mv /usr/lib/vco/app-server/plugins/o11nplugin-vsphere.dar /usr/lib/vco/app-server/plugins/o11nplugin-vsphere.dar.bak

Step 5 - Copy the new plugin to the plugins directory by running the following command:

mv o11nplugin-vsphere.dar /usr/lib/vco/app-server/plugins

Step 6 - Restart the vCO Service to load the new plugin

/etc/init.d/vco-server restart

Once the vCO Server is available, you can login to the vCO Client and import the new VSAN workflow. To make the workflow available in the vSphere Web Client, you will need to login to the vSphere Web Client using an account that has access to the vCO Server and the instructions below.

Step 1 - Click on the vCO icon on the home page and then select Manage and Context Actions

Step 2 - Click on the green arrow to add a new worfklow

Step 3 - Browse for the VSAN workflow and then click on the Add button and associate the workflow with a vSphere Cluster object as seen in the screenshot below:

vsan-vco-plugin-0
Once the context workflow has been added, you are now ready to run the new VSAN workflow! Right click on a VSAN enabled vSphere Cluster and under the All vCenter Orchestrator Actions, you should see our workflow:

vsan-vco-plugin-1
Go ahead and run the workflow and once it completes, you can view the results by clicking on the workflow name in the Recent Tasks:

vsan-vco-plugin-2
Under the Parameters section, we can see our input and output variables. In this workflow, I have created a String output called "count" which contains the name of each ESXi host in the VSAN Cluster along with the number of corresponding components.

As you can see, you can easily enhance the functionality of the vSphere Web Client by simply extending it with either out of the box or custom vCO Workflows that you have created. Happy workflowing!

Categories // ESXi, VSAN, vSphere 5.5, vSphere Web Client Tags // ESXi 5.5, vcenter orchestrator, vCO, VSAN, vSphere 5.5, vSphere API, workflow

How to run the VSAN Observer in "collection" mode in the background?

05.18.2014 by William Lam // 1 Comment

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

vsan-observer-rvc-script-1
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

vsan-observer-rvc-script-0
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

Categories // ESXi, VSAN, vSphere 5.5 Tags // ESXi 5.5, ruby, ruby vsphere console, rvc, VCSA, VSAN, vsan observer, vSphere 5.5

  • « Previous Page
  • 1
  • …
  • 39
  • 40
  • 41
  • 42
  • 43
  • …
  • 53
  • Next Page »

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...