Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 214415

Re: Get-stat with hung vm cpu process

$
0
0

Your script is ok, but instead of calling Get-Stat 500+ times, I would only call it once with all 500+ VMs

And then use the Group-Object cmdlet to split the results per VM.

Something like this

$vms = Get-VM

$now = Get-Date

 

Get-Stat -Entity $vms -Stat cpu.usage.average -Start $now.AddHours(-4) |

Group-Object -Property {$_.Entity.Name} | %{

    $avgCpu = $_.Group | Where {$_.Value -ne 0} | Measure-Object -Property Value -Average |

        Select -ExpandProperty Average

    if($avgCpu -gt 80) {$_.Name}

}

You will have to change the Get-VM to get the 500+ VMs you want to monitor


Viewing all articles
Browse latest Browse all 214415

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>