Pages: [1]
Print
Author Topic: vm performance per cluster, output to csv  (Read 606 times)
esarakaitis
Administrator
Full Member
*****
Posts: 218


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« on: May 04, 2009, 08:15:33 AM »

parts of this borrowed from the health check script

Code:
#VM Information
Write-Host "Gathering Virtual Machine Information."
function VM-statavg ($vmImpl, $StatStart, $StatFinish, $statId) {
$stats = $vmImpl | get-stat -Stat $statId -intervalmin 120 -Maxsamples 360 `
    -Start $StatStart -Finish $StatFinish
$statAvg = "{0,9:#.00}" -f ($stats | Measure-Object value -average).average
$statAvg
}
# Report for previous day
$DaysBack = 1 # Number of days to go back
$DaysPeriod = 1 # Number of days in the interval
$DayStart = (Get-Date).Date.adddays(- $DaysBack)
$DayFinish = (Get-Date).Date.adddays(- $DaysBack + $DaysPeriod).addminutes(-1)
# Report for previous week
$DaysBack = 7 # Number of days to go back
$DaysPeriod = 7 # Number of days in the interval
$WeekStart = (Get-Date).Date.adddays(- $DaysBack)
$WeekFinish = (Get-Date).Date.adddays(- $DaysBack + $DaysPeriod).addminutes(-1)
$report = @()
get-cluster "ENTINT01DU Cluster" | get-vm | Sort Name | % {
  $vm = Get-View $_.ID
    $vms = "" | Select-Object VMName, WeekAvgCpuUsage, VMState, TotalCPU, TotalMemory, WeekAvgMemUsage
    $vms.VMName = $vm.Name
    $vms.WeekAvgCpuUsage = VM-statavg $_ $WeekStart $WeekFinish "cpu.usage.average"
    $vms.VMState = $vm.summary.runtime.powerState
    $vms.TotalCPU = $vm.summary.config.numcpu
    $vms.TotalMemory = $vm.summary.config.memorysizemb
    $vms.WeekAvgMemUsage = VM-statavg $_ $WeekStart $WeekFinish "mem.usage.average"
    $Report += $vms
}
$Report | export-csv c:\guestinfo.csv
« Last Edit: May 04, 2009, 08:18:30 AM by esarakaitis » Logged
HSteinhauer
Newbie
*
Posts: 1


View Profile Email
« Reply #1 on: July 17, 2009, 09:04:37 AM »

This is very helpful.  But I find that I do not have the [math]  function to do the Round function.

Also - for those systems that are off-line / powered-off -- that they do not have data.  So it would be good to skip those systems - or at least report  that they are off-line

Also - I added stats to pick up the Network Traffic usage and the Disk usage.  As these are also items that can cause issues for systems. 

Another thought would be to take the different measurements for the week and then sort them so that you can pick the 75th and 90th values to report the utilization measures.

I notice that this is using a 120 minute interval for reporting and this hides a lot of the give and take of processing.  Using the 5 minute or 1 minute interval and then using the 75th  and 90th percential values would go along way to show how stable or unstable the workloads are.  Also - this way we could further see how much head room we have in a cluster. 

We have different workload time frames for these systems - and needing summary by zone.  ie prime time, 2nd shift, 3rd shift.     

Another item to add would be the CPU Mhz usage  for those systems that you might have limits on that can not use a full CPU for instance. 

Thanks for your work.

Henry
Logged
esarakaitis
Administrator
Full Member
*****
Posts: 218


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #2 on: July 18, 2009, 10:25:40 AM »

ahh, let me get the math function for you...

did you happen to post your script anywhere?

i had to limit myself to what stats i collected because of the amount of virtual machines and the performance impact it had on my vcenter server....
Logged
Pages: [1]
Print
Jump to: