Buddy, you previous script that I used, see below works excellent
$vms = "MY-VM"
$metric = "cpu.usage.average","mem.usage.average"
$metric = "cpu.usage.average","mem.consumed.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.consumed.average"}).Value}}|
Export-Csv "C:\MY-VM-Perf.csv" -NoTypeInformation –UseCulture
However I try to combine this script with script that you mention in Part 2 having lot of problem, I try to tweak but no success to make long story short
Will you please changes made on above script in such a way, so I get,
- 8 hrs (0800AM-0500PM) overall average utilization of CPU and memory for current month and previous month (Note: above script show Previous month)
e.g
VM
Time
CPU (8hr Avg.0900AM-0500PM))
Memory (8hr Avg. 0900AM-0500PM)
VM1
31/12/2011 19:00
3.12
2363650
VM2
30/12/2011 19:00
1.12
2963650
And my other concern, when I tried to get used net.usage.average API in above script I am not able to see any thing in my report. Is this because of my vCentre Statistics level set as 1
BTW how do I give you points, I know this is very dump question, please not to post
Thanks