Also is there any way to change the output format of Get-NaAggrSpace from bytes to kb,gb or tb?
This one is easy. PowerShell has built-in constants for storage sizes, so try something like this:
PS C:\> (Get-NaSnapshotReserve -Aggregate aggr0).Size / 1gb
1.19512939453125
You can also look at the Toolkit's data formatters (DataONTAP.Format.ps1xml) to see how we use a Toolkit cmdlet to format sizes with units:
PS C:\> $s = (Get-NaSnapshotReserve -Aggregate aggr0).Size
PS C:\> ConvertTo-FormattedNumber $s DataSize
1 GB
Get-NaAggrSpace doesn't show space used by WAFL or Snapshot reserve in the aggregate.I can get the aggregate snapshot reserve in powershell by using the Get-NaSnapshotReserve cmdlet
I cant see a cmdlet that gives me the WAFL reserve amount - from calculations on aggregate on 1 of our filers it looks like it is 10% of the aggregate.
Before I code a 10% size adjustment to into my script - Is the WAFL reserve always 10% of the aggregate size regardless of the version of Data OnTap?
WAFL reserve space seems to be around 10% but you can calculate it. Aggregate space calcs are a little more involved and require data points from multiple APIs to get everything you seek. From the API docs:
(Get-NaDisk).PhysicalSpace --> Use to get total aggregate size (multiply by number of data disks in aggregate (don't count parity disks))
(Get-NaAggrSpace).SizeNominal --> Total space contained in the aggregate minus the WAFL reserve
Given these definitions, you should be able to determine the WAFL reserve. And given a few other things you should be able to calculate everything:
(Get-NaSnapshotReserve -Aggregate).Size --> Aggregate snap reserve
(Get-NaAggr).SizeTotal --> Aggregate total usable size in bytes, not including WAFL reserve and aggregate snapshot reserve
I would prefer everything be in one structure, but I would hesitate to do that in the Toolkit as it would entail multiple API calls for each aggregate and would slow the process even when those values aren't of interest.