WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Hardware Options
    • Hardware Reviews
    • Lab Deployment Scripts
    • Nested Virtualization
    • Homelab Podcasts
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / Quick Tip - Retrieving vSAN usage & overhead information using vSAN API

Quick Tip - Retrieving vSAN usage & overhead information using vSAN API

12.10.2024 by William Lam // 2 Comments

Within the vSphere UI, you can view a detailed breakdown of your vSAN storage utilization including various system overhead by selecting a specific vSAN Cluster and then navigating to Monitor->vSAN->Capacity as shown in the screenshot below.


Different vSAN configuration such using vSAN Original Storage Architecture (OSA) or vSAN Express Storage Architecture (ESA) and whether capabilities like vSAN Deduplication and Compression is enabled will yield different utilization metrics that are displayed.

I recently had an inquiry asking how to retrieve the vSAN Deduplication and Compression overhead information using PowerCLI?

While the PowerCLI vSAN cmdlet Get-VsanSpaceUsage does provide a number of the usage metrics shown in the vSphere UI, it does not expose every single property.

However, we can still leverage PowerCLI to retrieve this information by simply using the underlying vSAN API which provides this information and specifically the querySpaceUsage() vSAN API. As you can see from the vSAN API documentation, the API method will return an array of vSAN usage object types, which maps back to what you see within the vSphere UI by decoding the ObjType property.

To demonstrate the use of this vSAN API, I have created an example PowerCLI script called vsanUsageAndOverheadInfo.ps1 which you just need to update the variable $vsanCluster with the name of your desired vSAN Cluster.

After connecting to your vCenter Server, you can simply run the script as shown below:

./vsanUsageAndOverheadInfo.ps1

Here is a screenshot of the output from the script:

More from my site

  • Programmatically accessing the Broadcom Compatibility Guide (BCG)
  • Enable TRIM/UNMAP from Nested vSAN OSA/ESA to physical vSAN OSA
  • Enhancements to VMware Cloud Foundation (VCF) & vSphere Automated Lab Deployment Scripts
  • Quick Tip - vSAN ESA Cluster Health Check returns Error message: Expecting value: line 1 column 1 (char 0)
  • Quick Tip - Retrieving vSAN File Share Network Permissions using vSAN API & PowerCLI

Categories // Automation, PowerCLI, VSAN Tags // VSAN

Comments

  1. *protectedAVC says

    02/04/2025 at 2:46 am

    Hi William,

    Thanks for your work, why do the VMDK and swap object sizes in the capacity capture not match the script output?

    Reply
    • William Lam says

      02/04/2025 at 5:41 am

      Stats change, UI is point in time and you’ll see same even if you load both

      Reply

Thanks for the comment!Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

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

  • VCF 9.0 Hardware Considerations 05/30/2025
  • VMware Flings is now available in Free Downloads of Broadcom Support Portal (BSP) 05/19/2025
  • VMUG Connect 2025 - Minimal VMware Cloud Foundation (VCF) 5.x in a Box  05/15/2025
  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/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...