Created
July 5, 2010 13:37
-
-
Save jbarber/464354 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find all of the VMs that have experienced ballooning in the last day | |
function ballooned? ($vm) { | |
$d = Get-Stat -memory -entity $vm -start (Get-Date).AddDays(-1) | | |
?{ $_.MetricId -eq 'mem.vmmemctl.average' } | | |
?{ $_.value -ne 0 } | |
return $d.count -ne 0 | |
} | |
connect-viserver -server virtualcenter -credential (Get-Credential (Get-Item env:username).value) | |
$vms = get-view -viewtype virtualmachine | |
$vms | ?{ ballooned?( get-viobjectbyviview -moref $_.moref ) } | %{ $_.name } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment