Src/Private/Get-AbrOntapVserverCGLun.ps1
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 |
function Get-AbrOntapVserverCGLun { <# .SYNOPSIS Used by As Built Report to retrieve NetApp ONTAP Vserver Consistency Groups Luns information from the Cluster Management Network .DESCRIPTION .NOTES Version: 0.6.5 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux .EXAMPLE .LINK #> param ( [Parameter ( Position = 0, Mandatory)] $CGObj ) begin { Write-PscriboMessage "Collecting ONTAP Vserver Consistency Groups lun information." } process { try { $LunData = $CGObj.luns $CGLunObj = @() if ($LunData) { foreach ($Item in $LunData) { try { $inObj = [ordered] @{ 'Name' = $Item.Name.Split('/')[3] 'Capacity' = Switch ([string]::IsNullOrEmpty($Item.space.size)) { $true {'-'} $false {$Item.space.size | ConvertTo-FormattedNumber -Type Datasize -ErrorAction SilentlyContinue} default {'-'} } 'Used' = Switch ([string]::IsNullOrEmpty($Item.space.used)) { $true {'-'} $false {$Item.space.used | ConvertTo-FormattedNumber -Type Datasize -ErrorAction SilentlyContinue} default {'-'} } 'OS Type' = ConvertTo-EmptyToFiller $Item.os_type 'Volume State' = $Item.status.container_state 'Mapped' = ConvertTo-TextYN $Item.status.mapped 'Read Only' = ConvertTo-TextYN $Item.status.read_only 'State' = $Item.status.state } $CGLunObj += [pscustomobject]$inobj } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } } if ($Healthcheck.Vserver.CG) { $CGLunObj | Where-Object { $_.'Volume State' -ne 'online'} | Set-Style -Style Warning -Property 'Volume State' $CGLunObj | Where-Object { $_.'Mapped' -eq 'No'} | Set-Style -Style Warning -Property 'Mapped' $CGLunObj | Where-Object { $_.'Read Only' -eq 'Yes'} | Set-Style -Style Warning -Property 'Read Only' $CGLunObj | Where-Object { $_.'State' -eq 'offline'} | Set-Style -Style Warning -Property 'State' } $TableParams = @{ Name = "Consistency Group Luns - $($CGObj.Name)" List = $false ColumnWidths = 30, 10, 9, 10, 11, 10, 10, 10 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $CGLunObj | Sort-Object -Property Name | Table @TableParams } } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } } end {} } |