VMware Cloud Community
jedijeff
Enthusiast
Enthusiast

New to Powercli, why is get-stat so slow?

I fairly new to Powercli, and am starting to delve into some statistics gathering. With nearly 1,000 vms, it is really really slow.

For instance, a query of say "Get-VM | Get-Stat -Stat cpu.usage.average" using a start and finish of 1 day,,,could take about an hour.

I have been reading(though do not comprehend yet) that using Get-View could seriously speed things up.

Now I am not looking for anyone to write me a script, I am just wondering is this the time I can expect Get-Stat to run--1Hr+. Or Can I use get-view somehow to speed things up.

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership

You could optimize that statement, for example place all VMs in 1 array, do 1 call to Get-Stat and then use for example Group-Object to retrieve the results per VM.

$vms = Get-VM

$stats = Get-Stat -Entity $vms....

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

There's a couple of examples in my Statistics posts.

Start with Part 1-4, they give a bit of statistics background and some general methods.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
jedijeff
Enthusiast
Enthusiast

Thank you very much! I will check out your posts.

Reply
0 Kudos