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

Re: Help With Get-Stat for Clusters

$
0
0

1.  How did you get your code so show up formated and color coded?

 

2.  Thanks for the code. I found some code that is similar and it works for what I need.  I was wondering if you could explain how the lines starting "Group-Object" through "New Object" work or guide me to some documentation that could explain those concepts.

 

 

 

 

$entity = Get-Cluster -Name IaaS-D

$start = (Get-Date).AddMonths(-1)

$counter = "cpu.usage.average"

 

 

Get-Stat -Entity $entity -Stat $counter -Start $start |

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

  $stats = $_.Group | Measure-Object -Property Value -Average -Maximum -Minimum

  New-Object PSObject -Property @{

    Cluster = $_.Name

    CPUAvg = [math]::round(($stats.Average), 0)

    CPUMin = [math]::round(($stats.Minimum), 0)

    CPUMax = [math]::round(($stats.Maximum), 0)

  }

}


Viewing all articles
Browse latest Browse all 204490

Trending Articles