Last active
February 18, 2017 22:20
-
-
Save simonjgreen/56b89d0a1af42c5c739512c47725fab1 to your computer and use it in GitHub Desktop.
Get avg and max VM usage stats
This file contains hidden or 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
Get-VM -Tag LoadBalancer | Where {$_.PowerState -eq "PoweredOn"} | Select Name, VMHost, NumCPU, MemoryGB, ` | |
@{N="CPU MHz (Avg)" ; E={[Math]::Round((($_ | Get-Stat -Stat cpu.usagemhz.average -Start (Get-Date).AddDays(-30) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}}, ` | |
@{N="CPU Mhz (Max)" ; E={[Math]::Round((($_ | Get-Stat -Stat cpu.usagemhz.average -Start (Get-Date).AddDays(-30) -IntervalMins 5 | Measure-Object Value -maximum).maximum),2)}}, ` | |
@{N="Memory % (Avg)" ; E={[Math]::Round((($_ | Get-Stat -Stat mem.usage.average -Start (Get-Date).AddDays(-30) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}} , ` | |
@{N="Memory % (Max)" ; E={[Math]::Round((($_ | Get-Stat -Stat mem.usage.average -Start (Get-Date).AddDays(-30) -IntervalMins 5 | Measure-Object Value -maximum).maximum),2)}} , ` | |
@{N="Network KBps (Max)" ; E={[Math]::Round((($_ | Get-Stat -Stat net.usage.average -Start (Get-Date).AddDays(-30) -IntervalMins 5 | Measure-Object Value -maximum).maximum),2)}} , ` | |
@{N="Network KBps (Avg)" ; E={[Math]::Round((($_ | Get-Stat -Stat net.usage.average -Start (Get-Date).AddDays(-30) -IntervalMins 5 | Measure-Object Value -Average).Average),2)}} | ` | |
Format-Table |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment