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 / Exploring VSAN APIs Part 10 – VSAN Disk Health

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

More from my site

  • PowerCLI script to help correlate vCenter, ESXi & vSAN build/versions w/o manual VMware KB lookup
  • Extending VSAN capabilities in the vSphere Web Client using vCO
  • VSAN Flash/MD capacity reporting
  • Exploring VSAN APIs Part 9 – VSAN Component count
  • VSAN vCheck Plugins

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

Comments

  1. *protectedtrungtien1571992 says

    03/25/2017 at 8:26 am

    Hi,

    I can't run this script vsanDiskHealth.pl.
    Error: "File "/home/vsan-sdk-python/samplecode/vsanDiskHealth.pl", line 6
    use strict;
    ^
    SyntaxError: invalid syntax"

    And this command: ./vsanDiskHealth.pl --server .vcenter55-1 --username root --cluster VSAN-Cluster. what's about password of user?

    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

  • Automating the vSAN Data Migration Pre-check using vSAN API 06/04/2025
  • 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

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...