Subscribe
Accepted Solution

get volsize and aggrsize

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

Re: get volsize and aggrsize

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

Re: get volsize and aggrsize

thanks

I'm getting this:

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

Missing expression after ','.

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

    + CategoryInfo          : ParserError: (,:String) [], ParseException

    + FullyQualifiedErrorId : MissingExpressionAfterToken

Re: get volsize and aggrsize

Just copy paste this.

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 

Re: get volsize and aggrsize

Great, thanks

Is there a way to show every volume that is more than 90% full and pipe the snapmirror status of only those volumes?

Re: get volsize and aggrsize

You can also use the built in cmdlet instead of all that math - convertto-formattednumber..

Re: get volsize and aggrsize

As far as piping them to snapmirror status, you can either pipe them to snapmirror status, or create custom objects and then work that why.

I'm curious, why are you using a function?

Re: get volsize and aggrsize

Thanks for the advice

1. "pipe them to snapmirror status, or create custom objects" - can you give an example please how to pipe the output of Get-VolOverEighty to Get-NaSnapmirror?

2. "why are you using a function?" - is that the wrong way? Please let me know how you would do it (I'm still a newbie...)

Cheers

Joel

Re: get volsize and aggrsize

Yah.. Functions are not what you are after.. That is not the proper way to do thing in my opinion for this

For piping directly to snapmirror status

get-navol | get-nasnapmirror

Re: get volsize and aggrsize

so in my case if I want to get the snapmirror status of (only) the volumes that are more than 90% full I should use this?

Get-VolOverEighty | GetNaSnapmirror