Merge pull request #43 from mycloudrevolution/Recommend-Sizing-v1.2
Recommend sizing v1.2
This commit is contained in:
@@ -8,14 +8,15 @@ function Recommend-Sizing {
|
|||||||
===========================================================================
|
===========================================================================
|
||||||
Changelog:
|
Changelog:
|
||||||
2016.11 ver 1.0 Base Release
|
2016.11 ver 1.0 Base Release
|
||||||
2016.11 ver 1.1 Optional Stats Collection.
|
2016.11 ver 1.1 Optional Stats Collection
|
||||||
|
2016.11 ver 1.2 VM Stats from Realtime Data and new Counters
|
||||||
===========================================================================
|
===========================================================================
|
||||||
External Code Sources:
|
External Code Sources:
|
||||||
http://www.lucd.info/2011/04/22/get-the-maximum-iops/
|
http://www.lucd.info/2011/04/22/get-the-maximum-iops/
|
||||||
https://communities.vmware.com/thread/485386
|
https://communities.vmware.com/thread/485386
|
||||||
===========================================================================
|
===========================================================================
|
||||||
Tested Against Environment:
|
Tested Against Environment:
|
||||||
vSphere Version: 5.5 U2
|
vSphere Version: 5.5 U2, 6.0
|
||||||
PowerCLI Version: PowerCLI 6.3 R1, PowerCLI 6.5 R1
|
PowerCLI Version: PowerCLI 6.3 R1, PowerCLI 6.5 R1
|
||||||
PowerShell Version: 4.0, 5.0
|
PowerShell Version: 4.0, 5.0
|
||||||
OS Version: Windows 8.1, Server 2012 R2
|
OS Version: Windows 8.1, Server 2012 R2
|
||||||
@@ -24,7 +25,7 @@ function Recommend-Sizing {
|
|||||||
===========================================================================
|
===========================================================================
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This Function collects Basic vSphere Informations for a Hardware Sizing Recomamndation. Focus is in Compute Ressources.
|
This Function collects Basic vSphere Informations for a Hardware Sizing Recommandation. Focus is in Compute Ressources.
|
||||||
|
|
||||||
.Example
|
.Example
|
||||||
Recommend-Sizing -ClusterNames Cluster01, Cluster02 -Stats -StatsRange 60 -Verbose
|
Recommend-Sizing -ClusterNames Cluster01, Cluster02 -Stats -StatsRange 60 -Verbose
|
||||||
@@ -41,7 +42,7 @@ function Recommend-Sizing {
|
|||||||
.PARAMETER Stats
|
.PARAMETER Stats
|
||||||
Enables Stats Collection.
|
Enables Stats Collection.
|
||||||
|
|
||||||
Warning: At the moment this is only tested and supported with vSphere 5.5!
|
Warning: At the moment this is only fully tested with vSphere 5.5 and vSphere 6.5!
|
||||||
|
|
||||||
.PARAMETER StatsRange
|
.PARAMETER StatsRange
|
||||||
Time Range in Minutes for the Stats Collection.
|
Time Range in Minutes for the Stats Collection.
|
||||||
@@ -55,15 +56,15 @@ function Recommend-Sizing {
|
|||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$True, ValueFromPipeline=$False, Position=0)]
|
[Parameter(Mandatory=$True, ValueFromPipeline=$False, Position=0)]
|
||||||
[Array] $ClusterNames,
|
[Array] $ClusterNames,
|
||||||
[Parameter(Mandatory=$False, ValueFromPipeline=$False, Position=2)]
|
[Parameter(Mandatory=$False, ValueFromPipeline=$False, Position=1, ParameterSetName = "Stats")]
|
||||||
[switch] $Stats,
|
[switch] $Stats,
|
||||||
[Parameter(Mandatory=$False, ValueFromPipeline=$False, Position=2)]
|
[Parameter(Mandatory=$False, ValueFromPipeline=$False, Position=2, ParameterSetName = "Stats")]
|
||||||
[int] $StatsRange = 1440
|
[int] $StatsRange = 1440
|
||||||
|
|
||||||
)
|
)
|
||||||
Begin {
|
Begin {
|
||||||
if ($Stats) {
|
if ($Stats) {
|
||||||
Write-Warning "Stats Collection enabled.`nAt the moment this is only tested and supported with vSphere 5.5"
|
Write-Warning "Stats Collection requested.`nAt the moment this is only fully tested with vSphere 5.5 and vSphere 6.5"
|
||||||
[int]$TimeRange = "-" + $StatsRange
|
[int]$TimeRange = "-" + $StatsRange
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,30 +122,38 @@ Process {
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
if ($Stats) {
|
if ($Stats) {
|
||||||
#region: Creating Disk Metrics
|
#region: Creating VM Stats
|
||||||
Write-Verbose "$(Get-Date -Format G) Create $($Cluster.name) IOPS Metrics..."
|
Write-Verbose "$(Get-Date -Format G) Create $($Cluster.name) VM Stats..."
|
||||||
$DiskMetrics = "virtualDisk.numberReadAveraged.average","virtualDisk.numberWriteAveraged.average"
|
$VMMetrics = "disk.numberwrite.summation","disk.numberread.summation","cpu.usage.average", "mem.usage.average"
|
||||||
$start = (Get-Date).AddMinutes($TimeRange)
|
$Start = (Get-Date).AddMinutes($TimeRange)
|
||||||
$DiskStats = Get-Stat -Stat $DiskMetrics -Entity $ClusterVMsPoweredOn -Start $start -Verbose:$False
|
$VMStats = Get-Stat -Realtime -Stat $VMMetrics -Entity $ClusterVMsPoweredOn -Start $Start -Verbose:$False
|
||||||
Write-Verbose "$(Get-Date -Format G) Create $($Cluster.name) IOPS Metrics completed"
|
Write-Verbose "$(Get-Date -Format G) Create $($Cluster.name) VM Stats completed"
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region: Creating IOPS Reports
|
#region: Creating VM Stats Report
|
||||||
Write-Verbose "$(Get-Date -Format G) Process $($Cluster.name) IOPS Report..."
|
Write-Verbose "$(Get-Date -Format G) Process $($Cluster.name) VM Stats Report..."
|
||||||
$reportDiskPerf = @()
|
$ReportVMPerf = @()
|
||||||
$reportDiskPerf = $DiskStats | Group-Object -Property {$_.Entity.Name},Instance | %{
|
$ReportVMPerf = $VMStats | Group-Object -Property {$_.Entity.Name},Instance | %{
|
||||||
New-Object PSObject -Property @{
|
New-Object PSObject -Property @{
|
||||||
IOPSMax = ($_.Group | `
|
IOPSWriteAvg = ($_.Group | `
|
||||||
Group-Object -Property Timestamp | `
|
where{$_.MetricId -eq "disk.numberwrite.summation"} | `
|
||||||
%{$_.Group[0].Value + $_.Group[1].Value} | `
|
Measure-Object -Property Value -Average).Average
|
||||||
Measure-Object -Maximum).Maximum
|
IOPSReadAvg = ($_.Group | `
|
||||||
|
where{$_.MetricId -eq "disk.numberread.summation"} | `
|
||||||
|
Measure-Object -Property Value -Average).Average
|
||||||
|
CPUUsageAvg = ($_.Group | `
|
||||||
|
where{$_.MetricId -eq "cpu.usage.average"} | `
|
||||||
|
Measure-Object -Property Value -Average).Average
|
||||||
|
MEMUsageAvg = ($_.Group | `
|
||||||
|
where{$_.MetricId -eq "mem.usage.average"} | `
|
||||||
|
Measure-Object -Property Value -Average).Average
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Write-Verbose "$(Get-Date -Format G) Process $($Cluster.name) IOPS Report completed"
|
Write-Verbose "$(Get-Date -Format G) Process $($Cluster.name) VM Stats Report completed"
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Verbose "$(Get-Date -Format G) Stats Cellocetion skipped..."
|
Write-Verbose "$(Get-Date -Format G) Stats Collection skipped..."
|
||||||
}
|
}
|
||||||
|
|
||||||
#region: Create VM Disk Space Report
|
#region: Create VM Disk Space Report
|
||||||
@@ -194,8 +203,10 @@ Process {
|
|||||||
SumVMDiskSpaceGB = [math]::round( ($reportDiskSpace | Measure-Object -Sum -Property CapacityGB).sum, 1 )
|
SumVMDiskSpaceGB = [math]::round( ($reportDiskSpace | Measure-Object -Sum -Property CapacityGB).sum, 1 )
|
||||||
SumDatastoreSpaceGB = [math]::round( ($DatastoreReport | Measure-Object -Sum -Property CapacityGB).sum, 1 )
|
SumDatastoreSpaceGB = [math]::round( ($DatastoreReport | Measure-Object -Sum -Property CapacityGB).sum, 1 )
|
||||||
SumDatastoreUsedSpaceGB = [math]::round( ($DatastoreReport | Measure-Object -Sum -Property UsedSpaceGB).sum, 1 )
|
SumDatastoreUsedSpaceGB = [math]::round( ($DatastoreReport | Measure-Object -Sum -Property UsedSpaceGB).sum, 1 )
|
||||||
SumMaxVMIOPS = [math]::round( ($reportDiskPerf | Measure-Object -Sum -Property IOPSMax).sum, 1 )
|
AverageVMIOPSWriteAvg = [math]::round( ($ReportVMPerf | Measure-Object -Average -Property IOPSWriteAvg).Average,1 )
|
||||||
AverageMaxVMIOPs = [math]::round( ($reportDiskPerf | Measure-Object -Average -Property IOPSMax).Average,1 )
|
AverageVMIOPSReadAvg = [math]::round( ($ReportVMPerf | Measure-Object -Average -Property IOPSReadAvg).Average,1 )
|
||||||
|
AverageVMCPUUsageAvg = "$([math]::round( ($ReportVMPerf | Measure-Object -Average -Property CPUUsageAvg).Average,1 )) %"
|
||||||
|
AverageVMMEMUsageAvg = "$([math]::round( ($ReportVMPerf | Measure-Object -Average -Property MEMUsageAvg).Average,1 )) %"
|
||||||
}
|
}
|
||||||
$MyView += $SizingReport
|
$MyView += $SizingReport
|
||||||
Write-Verbose "$(Get-Date -Format G) Process Global Report completed"
|
Write-Verbose "$(Get-Date -Format G) Process Global Report completed"
|
||||||
|
|||||||
Reference in New Issue
Block a user