I search a cmdlet or script to list all vm's were the memctl requests memory.
Are these VMs, for which you get the error, powered on ?
Try this variation
$vms = Get-VM Get-Stat -Entity $vms -Realtime -Stat mem.vmmemctl.average -MaxSamples 1 -ErrorAction SilentlyContinue | where {$_.Value -gt 5} | Select @{N="VM";E={$_.Entity.Name}},Value
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hello Mike,
Can you please clarify your question? Are you asking about using esxtop to monitor your VM memory ballooing statistics?
You could do something like this.
It will list all VMs that have ballooning above 5 KB
$vms = Get-VM
Get-Stat -Entity $vms -Realtime -Stat mem.vmmemctl.average -MaxSamples 1 | where {$_.Value -gt 5} | Select @{N="VM";E={$_.Entity.Name}},Value
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I found one but it seems to work only with ESX3 : http://ict-freak.nl/2009/12/18/powercli-find-resourcepool-or-vms-with-memory-ballooningswap-usage/ I think ".Summary.QuickStats.BalloonedMemory" is not supported on ESX4 anymore
Hi Luc, the script works for affected vm's but gives an error for all others : Get-Stat : 01.03.2012 00:19:14 Get-Stat The metric counter "mem.vmmemctl.average" doesn't exist for entity "VMNAME". At C:\Users\Administrator\Downloads\balloon-vm2.ps1:2 Col:9 + Get-Stat <<<< -Entity $vms -Realtime -Stat mem.vmmemctl.average -MaxSamples 1 | + CategoryInfo : ResourceUnavailable: (mem.vmmemctl.average:String) [Get-Stat], VimException + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,VMware.VimA utomation.ViCore.Cmdlets.Commands.GetViStats
Are these VMs, for which you get the error, powered on ?
Try this variation
$vms = Get-VM Get-Stat -Entity $vms -Realtime -Stat mem.vmmemctl.average -MaxSamples 1 -ErrorAction SilentlyContinue | where {$_.Value -gt 5} | Select @{N="VM";E={$_.Entity.Name}},Value
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Luc, this works great. Only one warning is shown : WARNING: 'Entity' property is obsolete. Use 'EntityId' instead. But the output is exactly what i searched for. Thanks
That warning can be ignored for now. It just states that in a future PowerCLI build that property might not be there anymore.
You can get rid of those warnings by doing the following once in your session
Set-PowerCLIConfiguration -DisplayDeprecationWarnings $false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference