I recently encountered a posting on the NetApp Community asking about, among other things, allocated capacity for an aggregate. As you can see in my response, I created a quick scriptlet which displays the information regarding total volume capacity allocated, but this is only part of the potentially thin provisioned capacity. LUNs can also be thin provisioned inside the volume. Additionally, some may find how much overcommitment exists with no storage efficiency applied as well (this can help with IOPS density calculations, for example).
To address this, I created a function which will display the total, used, saved, and committed capacity for an aggregate…
Show Overcommitment for Non-Root Aggregates
1 |
Get-NcAggr | ?{ $_.Name -notlike "*root" } | Get-NcAggrOvercommitReport | Format-Table -AutoSize |
Show Aggregates Which Have Overcommitment > 200%
1 |
Get-NcAggr | ?{ $_.Name -notlike "*root" } | Get-NcAggrOvercommitReport | ?{ $_.CommittedPercent -gt 200 } |
The code is straightforward, simply checking to see if there are LUNs in the volumes which have allocation which exceeds the volume size. If so, we use that as the value for the volume instead of it’s actual size.
Since we’re potentially querying a lot of information (# aggregates * # volumes * # of LUNs), it’s a good idea to use the template concept to choose what information is returned from the ZAPI queries. This not only substantially reduces the amount of information traversing the network, but also reduces execution time.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# # Aggregate overcommitment report # # Shows the cumulative total of allocated space for thin provisioned # LUNs and volumes for an aggregate. # function Get-NcAggrOvercommitReport { param( [Parameter( Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelinebyPropertyName=$true )] [Alias("Name")] [String[]] $Aggregate ) process { # get the aggregate object $aggrQuery = Get-NcAggr -Template Initialize-NcObjectProperty -Object $aggrQuery -Name Name,AggrSpaceAttributes $aggr = Get-NcAggr -Name $Aggregate -Attributes $aggrQuery $allocated = 0 $saved = 0 # loop through the volumes for this aggregate $volQuery = Get-NcVol -Template Initialize-NcObjectProperty -Object $volQuery -Name Name,Vserver,VolumeSpaceAttributes,VolumeSisAttributes # determine the total allocated for each volume foreach ($volume in (Get-NcVol -Aggregate $aggr -Attributes $volQuery)) { # start with the size of the volume $volAllocated = $volume.VolumeSpaceAttributes.SizeTotal # sum the size of all LUNs in the volume #$lunQuery = Get-NcLun -Template #Initialize-NcObjectProperty -Object $lunQuery -Name Size $lunAllocated = ((Get-NcLun -Volume $volume).Size | Measure-Object -Sum).Sum # if there are thin provisioned LUNs which exceed the size # of the volume, then use that size as the total for this # volume if ($lunAllocated -gt $volAllocated) { $volAllocated = $lunAllocated } # add this volume to the total $allocated += $volAllocated # add the amount of space saved for this volume to the total #$saved += (Get-NcEfficiency -Volume $volume.Name -Vserver $volume.Vserver).Returns.Total $saved += $volume.VolumeSisAttributes.TotalSpaceSaved } $result = "" | Select Name,Total,Used,UsedPercent,Saved,SavedPercent,Committed,CommittedPercent $result.Name = $aggr.Name # total TB in the aggr #$result.TotalTB = [Math]::Round($aggr.AggrSpaceAttributes.SizeTotal / 1TB, 2) $result.Total = ConvertTo-FormattedNumber -Value $aggr.AggrSpaceAttributes.SizeTotal -Type DataSize -NumberFormatString "0.00" # total TB used/consumed #$result.UsedTB = [Math]::Round($aggr.AggrSpaceAttributes.SizeUsed / 1TB, 2) $result.Used = ConvertTo-FormattedNumber -Value $aggr.AggrSpaceAttributes.SizeUsed -Type DataSize -NumberFormatString "0.00" # % of capacity consumed $result.UsedPercent = [Math]::Round((($aggr.AggrSpaceAttributes.SizeUsed) / $aggr.AggrSpaceAttributes.SizeTotal) * 100, 2) # total TB saved by efficiency #$result.SavedTB = [Math]::Round($saved / 1TB, 2) $result.Saved = ConvertTo-FormattedNumber -Value $saved -Type DataSize -NumberFormatString "0.00" # % of capacity saved by efficiency $result.SavedPercent = [Math]::Round(($saved / $aggr.AggrSpaceAttributes.SizeTotal) * 100, 2) # total TB committed, including thin LUNs and thin Vols #$result.CommittedTB = [Math]::Round($allocated / 1TB, 2) $result.Committed = ConvertTo-FormattedNumber -Value $allocated -Type DataSize -NumberFormatString "0.00" # % of capacity committed, > 100% means the aggr is overcommitted $result.CommittedPercent = [Math]::Round(($allocated / $aggr.AggrSpaceAttributes.SizeTotal) * 100, 2) # send the result down the pipeline Write-Output $result } } |
Great to see an example on how to approach such a task! At some point in the future I might have the time to complement my server volume chart scripts with a NetApp utilization view as well 🙂
Is it me or is the template $aggrQuery nowhere being used? (except for creation)
Thanks!
Hi Markus,
Thank you for reading, and thanks for pointing out the error!
The variable should be used to narrow the elements returned by the Get-NcAggr cmdlet on line 23. I’ve updated the code to reflect the change.
Andrew
What toolkit version are you using to obtain this cmdlet?