Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 252940

Capacity and Performance Trending reports

$
0
0

Hi, over the past couple of weeks I have been reviewing numerous posts on pulling data via powercli.  I have a customer who wants some executive monthly capacity trending reports for the past year and their engineers want monthly performance trending reports.  For the most part LucD has done a great job at compiling scripts to pull 75% of the information I need to create the excel reports.  If there is a way to simplify extracting the data would be very helpful.

 

It would be great if all this information could be pulled historically from vCenter but exporting it daily would be okay also.

 

The current environment is vSphere 4.x with plans to upgrade to 5.x in the coming months.  There is a mixture of VMFS and NFS.

 

This is mostly to help predict when to buy additional hardware based of past trends.

 

Note:  Its about time they added the CSV Append feature in Powershell v3.

 

What I need for the monthly capacity trending report:

  • At the Cluster layer over the past year or start collecting daily.
    • Total physical CPUs, CPU cores, provisioned vCPUs to VMs and over-commit ratio. CPU count not in Mhz.
    • Total physical RAM, provisioned vRAM to VMs and over-commit ratio.  In MB or GB.
    • Total physical Disk, used Disk and provisioned disk to VMs.

Performance reports:  These I have except for the VM disk performance on NFS datastores.

  • At the host layer over the past month @ 2 hour intervals.
    • Max CPU, Avg CPU
    • Max MEM, Avg MEM
  • At the VM layer over the past month @ 2 hour intervals.  I have everything for this report except for vmdk disk statistics on NFS.
    • CPU max and avg
    • MEM max, avg, and ballooning
    • Disk max and avg latency

Storage:

The historical datastore capacity script by LucD has is great but for some reason a few of my datastores return null even though the data shows up in vCenter.  This could be because the environment is 4.x.

 

What I've started with for daily capacity collections but would like to pull this historically if possible.  Some of this doesn't pull data so it is marked "NA"

 

$report = @()
$clusterName = "*"
foreach($cluster in Get-Cluster -Name $clusterName){
    $esx = $cluster | Get-VMHost
    $ds = Get-Datastore -VMHost $esx | where {$_.Type -eq "NFS" -eq "VMFS" -and $_.Extensiondata.Summary.MultipleHostAccess}
    $rp = Get-View $cluster.ExtensionData.ResourcePool
    $dt = (Get-Date -format d)
    New-Object PSObject -Property @{
$row = "" | Select "Date",VCname,DCname,Clustername,
"Number of hosts","Total Processors","Total Cores",
"Current CPU Failover Capacity","Current Memory Failover Capacity","Configured Failover Capacity",
"Migration Automation Level","DRS Recommendations","DRS Faults","Migration Threshold",
"target hosts load standard deviation","Current host load standard deviation",
"Total Physical Memory (MB)","Configured Memory MB","Available Memory (MB)",
                "Total CPU (Mhz)","Configured CPU (Mhz)",
                "Available CPU (Mhz)","Total Disk Space (MB)",
                "Configured Disk Space (MB)","Available Disk Space (MB)",
"CPU Total Capacity","CPU Reserved Capacity","CPU Available Capacity",
"Memory Total Capacity","Memory Reserved Capacity","Memory Available Capacity"
        $row.VCname = $cluster.Uid.Split(':@')[1]
        $row.DCname = (Get-Datacenter -Cluster $cluster).Name
        $row.Clustername = $cluster.Name
        $row."Number of hosts" = "NA" # $esx.Count
        $row."Total Processors" = ($esx | measure -InputObject {$_.Extensiondata.Summary.Hardware.NumCpuPkgs} -Sum).Sum
        $row."Total Cores" = ($esx | measure -InputObject {$_.Extensiondata.Summary.Hardware.NumCpuCores} -Sum).Sum
        $row."Current CPU Failover Capacity" = "NA" # $cluster.Extensiondata.Summary.AdmissionControlInfo.CurrentCpuFailoverResourcesPercent
        $row."Current Memory Failover Capacity" = "NA" # $cluster.Extensiondata.Summary.AdmissionControlInfo.CurrentMemoryFailoverResourcesPercent
        $row."Configured Failover Capacity" = "$cluster.Extensiondata.ConfigurationEx.DasConfig.FailoverLevel
        $row."Migration Automation Level" = $cluster.Extensiondata.ConfigurationEx.DrsConfig.DefaultVmBehavior
        $row."DRS Recommendations" = &{$result = $cluster.Extensiondata.Recommendation | %{$_.Reason};if($result){[string]::Join(',',$result)}}
        $row."DRS Faults" = "NA" # &{$result = $cluster.Extensiondata.drsFault | %{$_.Reason};if($result){[string]::Join(',',$result)}}
        $row."Migration Threshold" = $cluster.Extensiondata.ConfigurationEx.DrsConfig.VmotionRate
        $row."target hosts load standard deviation" = "NA"
        $row."Current host load standard deviation" = "NA"    
        $row."Total Physical Memory (MB)" = ($esx | Measure-Object -Property MemoryTotalMB -Sum).Sum  # Would like to change to GB
        $row."Configured Memory MB" = ($esx | Measure-Object -Property MemoryUsageMB -Sum).Sum # Would like to change to GB
        $row."Available Memory (MB)" = "NA" # ($esx | Measure-Object -InputObject {$_.MemoryTotalMB - $_.MemoryUsageMB} -Sum).Sum  # Not pulling data for some reason and would like to change to GB.
        $row."Total CPU (Mhz)" = ($esx | Measure-Object -Property CpuTotalMhz -Sum).Sum
        $row."Configured CPU (Mhz)" = ($esx | Measure-Object -Property CpuUsageMhz -Sum).Sum
        $row."Available CPU (Mhz)" = ($esx | Measure-Object -InputObject {$_.CpuTotalMhz - $_.CpuUsageMhz} -Sum).Sum
        $row."Total Disk Space (MB)" = ($ds | where {$_.Type -eq "VMFS"} | Measure-Object -Property CapacityMB -Sum).Sum #Would like to change to GB
        $row."Configured Disk Space (MB)" = ($ds | Measure-Object -InputObject {$_.CapacityMB - $_.FreeSpaceMB} -Sum).Sum #Would like to change to GB
        #Need total thin provisioned disk - This is NFS with dedup so it throws off the used and available disk.
        $row."Available Disk Space (MB)" = ($ds | Measure-Object -Property FreeSpaceMB -Sum).Sum  #Would like to change to GB
        # Need vCPU count provisioned to VMs
        $row."CPU Total Capacity" = $rp.Runtime.Cpu.MaxUsage
        $row."CPU Reserved Capacity" = $rp.Runtime.Cpu.ReservationUsed
        $row."CPU Available Capacity" = $rp.Runtime.Cpu.MaxUsage - $rp.Runtime.Cpu.ReservationUsed
        #Need vRAM in GB provisioned to VMs
        $row."Memory Total Capacity" = $rp.Runtime.Memory.MaxUsage  #Need in GB
        $row."Memory Reserved Capacity" = $rp.Runtime.Memory.ReservationUsed  #Need in GB
        $row."Memory Available Capacity" = $rp.Runtime.Memory.MaxUsage - $rp.Runtime.Memory.ReservationUsed  #Need in GB
}
$row."Date" = $dt
$report += $row
}
$report | Export-Csv "D:\Client report\Performance\PerfData\clustercapacity.csv" -NoTypeInformation -UseCulture -Append

 

Host and VM performance history script:  Need disk counters for VMs on NFS.  CPU ready time maybe a good one to add here also.

 

 

$esxImpl = Get-VM

$todayMidnight = (Get-Date -Hour 0 -Minute 0 -Second 0).AddMinutes(-1)

$workingDays = "Monday","Tuesday","Wednesday","Thursday","Friday"

$dayStart = New-Object DateTime(1,1,1,10,00,0)     # 10:00 AM

$dayEnd = New-Object DateTime(1,1,1,16,00,0)      # 04:00 PM

 

$stats = Get-Stat -Entity $esxImpl -Stat cpu.usage.average,mem.usage.average -Start $todayMidnight.AddDays(-31) -Finish $todayMidnight.AddDays(-1) -IntervalSecs 7200

$report = $stats # | Where-Object {

  $workingDays -contains $_.Timestamp.DayOfWeek -and

  $_.Timestamp.TimeOfDay -gt $dayStart.TimeOfDay -and

  $_.Timestamp.TimeOfDay -lt $dayEnd.TimeOfDay

# }

 

$report | Export-Csv "D:\Client report\Performance\PerfData\ag-VM-performance-avg.csv" -NoTypeInformation -UseCulture

 

 

$esxImpl = Get-VMHost

$todayMidnight = (Get-Date -Hour 0 -Minute 0 -Second 0).AddMinutes(-1)

$workingDays = "Monday","Tuesday","Wednesday","Thursday","Friday"

$dayStart = New-Object DateTime(1,1,1,10,00,0)     # 10:00 AM

$dayEnd = New-Object DateTime(1,1,1,16,00,0)      # 04:00 PM

 

$stats = Get-Stat -Entity $esxImpl -Stat cpu.usage.average,mem.usage.average -Start $todayMidnight.AddDays(-31) -Finish $todayMidnight.AddDays(-1) -IntervalSecs 7200

$report = $stats # | Where-Object {

  $workingDays -contains $_.Timestamp.DayOfWeek -and

  $_.Timestamp.TimeOfDay -gt $dayStart.TimeOfDay -and

  $_.Timestamp.TimeOfDay -lt $dayEnd.TimeOfDay

# }

 

$report | Export-Csv "D:\Client report\Performance\PerfData\ag-Host-performance-avg.csv" -NoTypeInformation -UseCulture

 

Datastore Scripts can be found here:  Need to figure out why some datastores pull no data.
This is a very nice script by the way.  Very useful.
Thanks to all help ahead of time...  It's much appreciated
JB
Edit:  Highlighted key points in need to work on.

 

Message was edited by: JayLB


Viewing all articles
Browse latest Browse all 252940

Trending Articles



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