Subscribe

Aggregate over commit percentage

Hi

I've been trying to find a powershell command that will return the above.  The dfm is able to email this info out as a warning, but thus far I've not been able to track down a way of doing this..  Get-NaAggr and Get-NAAggrSpace don't return this info..

Re: Aggregate over commit percentage

well, i think DFM calculates it - sum all volume sizes - compare with aggr total space and you should be able to calc the percentage value.

best andreas

Re: Aggregate over commit percentage

this doesn't take into account the snap reserve, but you can do something like this:

PS E:\> get-navol | Group-Object -Property ContainingAggregate | %{$_.name; ($_.group | measure-object -property totalsize -sum).sum/(get-naaggr $_.name).totalsize*100}

aggr0

126.98877560655991701782664328

aggr5

95.82054648597344067824994915

aggr9

43.057449986213111943013075340

Re: Aggregate over commit percentage

This is interesting.. I never thought to do it that way...  

I'm a script junkie, but I used to use the excel api to dump to a dashboard and then use the power of excel to do the calcs.  I'm going to play around with this today if I have time to see if I can also come up with a solution...

Re: Aggregate over commit percentage

That's the kind of thing I'm after, thanks....  I'm normally pretty good at borrowing ps from the web and tweaking it for my needs, but this is beyond my skill level

I'm trying to figure a way of incorporating that into my report....  I use the below to pull back Aggr info and write it into a html report

Is it possible to parse your suggestion into my code somehow below so that I could get a Committed Use %age for each aggr or is it liekely I'll have to create a new fuinction?

ForEach ($netapp in $netapplist) {

      write-host "Connecting to ... "$netapp

  

   WriteAggrTableHeader-v2 $netapp

   Connect-nacontroller $netapp -Credential $cred

   Get-NaAggrspace | Sort-Object AggregateName | %{

      $Agg = {} | select AggregateName,SizeFree,SizeMetadata,SizeNominal,SizeSnapUsed,SizeUsed,Used

   $Agg.AggregateName = $_.AggregateName

   $Agg.SizeFree = $_.SizeFree

   $Agg.SizeMetadata = $_.SizeMetadata

   $Agg.SizeNominal = $_.SizeNominal

   $Agg.SizeSnapUsed = $_.SizeSnapUsed

   $Agg.SizeUsed = $_.SizeUsed 

   $Agg.Used = $_.Used

  

  

   writeAgg-v2Info $netapp $Agg.AggregateName $Agg.SizeFree $Agg.SizeMetadata $Agg.SizeNominal $Agg.SizeSnapUsed $Agg.SizeUsed $Agg.Used

     

    }

   Add-Content $fileName "</table>"

Function writeAgg-v2Info
{
  param($Netapp,$AggName,$AggFree,$AggMeta,$AggNom,$AggSnap,$AggSUsed,$AggPFree,$CommittedUse)

  $AggFree = "{0:N2}" -f (([Math]::Round(($AggFree/1099511627776 ),2)))
  $AggMeta = "{0:N2}" -f (([Math]::Round(($AggMeta/1099511627776 ),2)))
  $AggNom = "{0:N2}" -f (([Math]::Round(($AggNom/1099511627776 ),2)))
  $AggSnap = "{0:N2}" -f (([Math]::Round(($AggSnap/1099511627776 ),2)))
  $AggSUsed = "{0:N2}" -f (([Math]::Round(($AggSUsed/1099511627776 ),2)))
  $AggPFree = "{0:N2}" -f (([Math]::Round(($AggFree/$AggNom*100 ),2)))
  $CommittedUse = "{0:N2}" -f (([Math]::Round(($CommittedUse),2)))

Re: Aggregate over commit percentage

See if this is what you are after:

foreach ($aggr in Get-NaAggr){

        $voltotal = foreach ($volume in get-navol -Aggregate $aggr) {Get-NaVolSize $volume.name | select @{name="Total";e={[math]::truncate($_.VolumeSize / 1GB)}}}

        $aggrused = Get-NaAggr -name $aggr |Select @{name="Used";e={[math]::truncate($_.SizeUsed / 1GB)}}

        $committed = ($voltotal | Measure-Object 'Total' -Sum).Sum

        Get-NaAggr -name $aggr | select @{n="Controller";e={$controller}},Name,@{name="Total";e={[math]::truncate($_.TotalSize / 1GB)}},@{name="Used";e={$aggrused.used}},@{name="Used%";e={[math]::round(([decimal] $_.sizeused / $_.totalsize)*100)}},@{name="Committed";e={$committed}},@{name="Committed%";e={[math]::round(([decimal] $committed / ($_.TotalSize / 1GB))*100)}}

        }

This will loop through all of the aggregates on the controller

$voltotal = Pulls all of the volume sizes from the aggregate

$aggrused = Gets to used space from the aggregate
$committed = SUM of all of the volume sizes

Then outputs the information using expressions.

Re: Aggregate over commit percentage

Thats a great bit of code which I think almost has it.....

The figures however do not match what dfm tells me...  The figure produced from your code is actually 15% lower than the dfm figure...  Could that be related to the Snap reserve as an earlier poster mentioned

Re: Aggregate over commit percentage

Good catch - I didn't account for SnapReserve.  This will.  I changed from using get-navolsize to get-navol and used TotalSize and SnapshotBlocksReserved fields to load $voltotal.

foreach ($aggr in Get-NaAggr){

        $voltotal = foreach ($volume in get-navol -Aggregate $aggr) {Get-NaVol $volume.name | select @{name="Total";e={[math]::truncate($_.TotalSize / 1GB)}},@{name="Snap";e={[math]::truncate($_.SnapshotBlocksReserved / 1GB)}}}

        $aggrused = Get-NaAggr -name $aggr |Select @{name="Used";e={[math]::truncate($_.SizeUsed / 1GB)}}

        $committed = ($voltotal | Measure-Object 'Total' -Sum).Sum

        Get-NaAggr -name $aggr | select @{n="Controller";e={$controller}},Name,@{name="Total";e={[math]::truncate($_.TotalSize / 1GB)}},@{name="Used";e={$aggrused.used}},@{name="Used%";e={[math]::round(([decimal] $_.sizeused / $_.totalsize)*100)}},@{name="Committed";e={$committed}},@{name="Committed%";e={[math]::round(([decimal] $committed / ($_.TotalSize / 1GB))*100)}}

        }

Re: Aggregate over commit percentage

Hi billyd

I really appreciate the effort on this, but for some reason the committed %age has gone lower than previously  dfm says 157%.   Your original code 142% and now its down to 130%...

Re: Aggregate over commit percentage

Could you send the output of the command along with what DFM is showing? 

Also - if you have a report in DFM that you want to see in excel, you could do this.  This script could be run as a scheduled task on the DFM server to automatically report and save the committed space from week to week. 

Powershell script to run report and send output to CSV:

Import-Module DataONTAP -ErrorAction SilentlyContinue

$aggregatefile = "C:\scripts\data\aggregates\"+(Get-Date -format MM_dd_yyyy)+".csv"

dfm report view -F csv Aggr_Report | Convertfrom-csv | Export-Csv -LiteralPath $aggregatefile -NoTypeInformation

If you don't have a custom DFM report, here's what a basic one for Committed space would look like.  Then you can use the same script above to run it.

DFM CLI to create report:

dfm report create -R Aggregate -f Aggregate.StorageSystem,Aggregate.Name,Aggregate.TotalSpace,Aggregate.BytesCommittedPct Aggr_Report