Microsoft Virtualization Discussions

get volsize and aggrsize

JSHACHER11
7,448 Views

Hi guys,

I'm after a script that will show me volumes over 90% full (total, available, used) and then will show the same thing in the containing aggregates (total, available, used)

this is what I use now to get the vol size:

+++++++++++++++++++++++++++

Import-Module Dataontap

function Get-VolOverEighty {

Get-NaVol | select name,aggregate,used,@{Name="Available(GB)";Expression={[math]::Round([decimal]$_.Available/1gb,0)}},@{Name="SizeTotal(GB)";Expression={[math]::Round([decimal]$_.sizetotal/1gb,0)}} | ? { $_.used -gt 90 }

}

$filer = Read-Host "Enter the filer name"

$user = "root"

Connect-NaController -Name $filer -Credential $user

Get-VolOverEighty

+++++++++++++++++++++++++

This works fine but I want it to report the size in the containing aggregates as well - is that possible?

Cheers

1 ACCEPTED SOLUTION

vinith
7,445 Views

This should give you that information, Note that i have appended the Aggr Size information in TB

Function Get-VolOverEighty {

Get-NaVol | ? { $_.used -gt 90 } | select name,aggregate,used,@{Name="VolumeAvailable(GB)";Expression={[math]::Round([decimal]$_.Available/1gb,0)}},`

@{Name="VolumeSizeTotal(GB)";Expression={[math]::Round([decimal]$_.sizetotal/1gb,0)}}, `

@{Name="AggregateSizeTotal(TB)";Expression={[math]::Round([decimal] ((Get-NaAggr -Name $_.Aggregate | select -ExpandProperty SizeTotal)/1tb),2)}},`

@{Name="AggregateSizeAvailable(TB)";Expression={[math]::Round([decimal] ((Get-NaAggr -Name $_.Aggregate | select -ExpandProperty SizeAvailable)/1tb),2)}},`

@{Name="AggregateSizeUsed(TB)";Expression={[math]::Round([decimal] ((Get-NaAggr -Name $_.Aggregate | select -ExpandProperty SizeUsed)/1tb),2)}}

}

Get-VolOverEighty

View solution in original post

16 REPLIES 16
Public