WilliamLam.com

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

Retrieving VM DRS Score using vSphere API and PowerCLI

01.27.2022 by William Lam // 2 Comments

VM DRS Score is a new feature that was introduced with the release of vSphere 7.0, check out this blog post by Niels for a closer look at how this feature can benefit your environment.


In the vSphere UI, this information is expressed as both a Cluster DRS Score and a VM DRS Score as shown in the screenshot above.

This information can also be retrieved programmatically using the vSphere API, as alluded in the title of this blog post. Using the vSphere API, there is a new property called SummaryEx under the ClusterComputeResource object which represents a vSphere Cluster from an API point of view. Here, you will find two new properties: drsScore and numVmsPerDrsScoreBucket which maps to the respective information found within the vSphere UI.

To demonstrate how to access these two new properties, below is a small PowerCLI function called Get-DRSScore which uses the vSphere API to retrieve this information and accepts a single parameter which is a vSphere Cluster object by using the Get-Cluster cmdlet.

Function Get-DRSScore {
    param(
        [Parameter(Mandatory=$true)][VMware.VimAutomation.ViCore.Impl.V1.Inventory.ComputeResourceImpl]$Cluster
    )

    $drsScoreBuckets = @("0%-20%","21%-40%","41%-60%","61%-80%","81%-100%")

    $drsScoreResults = $Cluster.ExtensionData.SummaryEx | select DrsScore, NumVmsPerDrsScoreBucket

    Write-Host "Cluster DRS Score: $(${drsScoreResults}.DrsScore)`n"

    Write-Host "VM DRS Score"
    $count = 0
    foreach($i in ${drsScoreBuckets}) {
        Write-Host "${i} - $(${drsScoreResults}.NumVmsPerDrsScoreBucket[$count]) VMs"
        $count++
    }
    Write-Host
}

Here is an example of using the function and the output matches what is shown in the vSphere UI.

Get-DRSScore -Cluster (Get-Cluster Cluster-1)

Categories // Automation, vSphere 7.0 Tags // drs, PowerCLI, vSphere 7.0

Use cases for Anti-Affinity VM-Host Rules

06.25.2018 by William Lam // 6 Comments

I was in a meeting last week with Engineering and a question had come up on whether customers were actively using the Anti-Affinity (AA) VM-Host Rules capability and if so, what are some of the use cases?  We know that Anti-Affinity VM-VM Rules are used quite regularly by customers and the use cases are pretty well understood, but what is not clear was the usage and frequency of AA VM-Host rules. I figured I could help Engineering by asking some of my Twitter folllowers, the following question:

Anyone using Anti-Affiity VM-Host Rules today (e.g. VMs should/must not run on specific ESXi hosts)? Had a chat w/Engr the other day, they were curious if customers used this at all compared to Affinity VM-Host Rules & what the use case might be? pic.twitter.com/7EASBAvvt5

— William Lam (@lamw.bsky.social | @*protected email*) (@lamw) June 21, 2018

In an attempt to avoid any confusion, I also included a screenshot of the AA VM-Host Rules in the vSphere UI which you can see above. However, it looks like my attempt had failed and I actually received a number of replies that described AA VM-VM Host Rules (separate certain groups of VMs from each other, regardless of host groups), rather than AA VM-Host Rules (do not run certain groups of VMs on specific host groups). Perhaps the question could have been better phrased or it was just a simple misinterpretation, but overall it was a very useful exercise and it was great learn about all the different use cases for BOTH AA VM-VM and AA VM-Host Rules, so thank you to everyone who shared their feedback.

[Read more...]

Categories // vSphere Tags // affinity, anti-affinity, drs, VM-Host, VM-VM

VMware Labs releases Proactive DRS Fling from last years Fling Contest

08.27.2013 by William Lam // 1 Comment

Last year, the VMware Labs team ran an Open Innovation contest where users could submit ideas for Flings that they would like to see get built. In addition to that, one lucky winner will be selected and their idea will actually be sponsored internally within VMware R&D and VMware Engineers would then implement that idea. The winner of that contest was Mike Preston on an idea called Proactive DRS:

“What I would like to see is some sort of appliance/script that can hook into both the vCenter Operations API’s as well as the vSphere APIs and merge these two technologies together. By interpreting vCenter Operations predictions for what is going to happen within your environment and then leveraging vMotion/DRS/DPM to prepare for this before it happens we could be left with a more proactive approach. (I.E. Historically VM1 will utilize 100% CPU at 4am in the morning, let’s be sure these resources are available on the host at 3:45 by migrating other VMs off, rather than waiting for DRS to kick in at 4:05 – At 6am everyday my workload normally increases to the point where DPM kicks in and turns on some hosts, let’s turn these on at based on the vCenter Operations stats rather than having to manually configure a setting to do so).”

Today at the VMware R&D Innovation booth at VMworld, the VMware Labs team has just announced that they will be releasing the Proactive DRS Fling (download coming very soon!). I think this is pretty awesome, I mean how cool is that, an idea that you came up with was implemented by a group of VMware Engineers? Congrats on the awesome idea Mike!

Here is a bit more details on how Proactive DRS works:  

It is a way for DRS to react to changes in the virtual cluster, and to act on predicted changes in resource demands before hosts become stressed. For example, if you have a VM that historically uses 100% CPU at 8am every morning, ProactiveDRS  makes  sure that the CPU resources will be available for that VM before 8am. These actions ensure that your cluster runs smoother and reduces the amount of reactive VM rebalances that occur.

Features

  • Given an advance forecast/prediction of each VM’s resource demands, e.g., CPU and Memory, ProactiveDRS seeks to reorganize the placement of VMs to best balance the current resource demands while taking early actions to accommodate the future/predicted resource demands.
  • Sample actions include, but are not limited to, proactive vMotions (migrations) and proactively powering on a new physical host to accept VMs whose resource demands are expected to spike beyond the available resources of their current physical host.

The VMware Labs folks did not stop there, they are also running a new 2013 Fling Contest and if you are at VMworld, you can drop by the VMware R&D Innovation booth which is behind the main VMware booth to submit your ideas. Another lucky winner will be selected and their idea will also be built by VMware Engineers which includes a free ticket to VMworld 2014. I recommend you either drop by the booth if you are at VMworld or go online to submit an idea and you could be the next person with their very own Fling!

Categories // Uncategorized Tags // drs, fling, innovation, vcops, vmware

  • 1
  • 2
  • 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...