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

LucD,

   i am getting the error for 2nd script

 

Get-Stat : 1/27/2012 10:06:07 AM    Get-Stat        Object reference not set to an instance of an object.
At E:\script\performance.ps1:12 char:18
+ $stats = Get-Stat <<<<  -Entity $vms -Stat $metric -Start $start -Finish $finish
    + CategoryInfo          : NotSpecified: (:) [Get-Stat], VimException
    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetViStats

 

Script :-

$vms = Get-VM
$metric = "cpu.usage.average","mem.usage.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.usage.average"}).Value}} |
Export-Csv "C:\stat-report.csv" -NoTypeInformation -UseCulture

 

thanks

vmguy


Viewing all articles
Browse latest Browse all 46

Trending Articles



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