Quantcast
Channel: VMware Communities: Message List - need a script to collect the performance report.
Viewing all articles
Browse latest Browse all 46

Re: need a script to collect the performance report.

$
0
0

Hey lucD

 

 

$vms = Get-VM
$metric = "cpu.usage.average","mem.active.average"
$now = Get-Date -Hour 0 -Minute 0 -Second 0
$finish = $now.AddDays(- $now.Day)
$start = $finish.AddMonths(-1).AddDays(1)
$finish = $finish.AddDays(1).AddMinutes(-1)
$stats = Get-Stat -Entity $vms -Stat $metric -Start $start -Finish $finish
$stats | Group-Object -Property {$_.Entity.Name},{$_.Timestamp} |
Select @{N="VM";E={$_.Values[0]}},
@{N="Time";E={$_.Values[1]}},
@{N="CPU";E={($_.Group | where {$_.MetricId -eq "cpu.usage.average"}).Value}},
@{N="Memory";E={($_.Group | where {$_.MetricId -eq "mem.active.average"}).Value}} |
Export-Csv "C:\stat-report.csv" -NoTypeInformation -UseCulture

 

The above script works and it gives output of Average CPU usage&average active memory usage for last month, on daily basis. But i need a script that gives single output usages of average CPU&active memory for last month for each virtual machine.


Viewing all articles
Browse latest Browse all 46

Trending Articles



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