Src/Private/Get-AbrOntapVserverSummary.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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
function Get-AbrOntapVserverSummary { <# .SYNOPSIS Used by As Built Report to retrieve NetApp ONTAP Vserver information from the Cluster Management Network .DESCRIPTION .NOTES Version: 0.6.3 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux .EXAMPLE .LINK #> param ( [Parameter ( Position = 0, Mandatory)] [string] $Vserver ) begin { Write-PscriboMessage "Collecting ONTAP Vserver information." } process { try { $VserverData = Get-NcVserver -VserverContext $Vserver| Where-Object { $_.VserverType -eq "data" } $VserverObj = @() if ($VserverData) { foreach ($Item in $VserverData) { try { $inObj = [ordered] @{ 'Vserver Type' = $Item.VserverType 'Allowed Protocols' = [string]$Item.AllowedProtocols 'Disallowed Protocols' = [string]$Item.DisallowedProtocols 'IPSpace' = $Item.Ipspace 'Status' = $Item.State } $VserverObj += [pscustomobject]$inobj } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } } if ($Healthcheck.Vserver.Status) { $VserverObj | Where-Object { $_.'Status' -like 'stopped' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ Name = "Information - $($Vserver)" List = $false ColumnWidths = 20, 20, 20, 20, 20 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $VserverObj | Table @TableParams } try { Section -Style Heading4 'Root Volume' { $VserverRootVol = Get-NcVol -VserverContext $Vserver| Where-Object {$_.JunctionPath -eq '/'} $VserverObj = @() if ($VserverRootVol) { foreach ($Item in $VserverRootVol) { try { $inObj = [ordered] @{ 'Root Volume' = $Item.Name 'Status' = $Item.State 'Total Size' = $Item.Totalsize | ConvertTo-FormattedNumber -Type Datasize -ErrorAction SilentlyContinue 'Used' = $Item.Used | ConvertTo-FormattedNumber -Type Percent -ErrorAction SilentlyContinue 'Available' = $Item.Available | ConvertTo-FormattedNumber -Type Datasize -ErrorAction SilentlyContinue 'Dedup' = ConvertTo-TextYN $Item.Dedupe 'Aggregate' = $Item.Aggregate } $VserverObj += [pscustomobject]$inobj } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } } if ($Healthcheck.Vserver.Status) { $VserverObj | Where-Object { $_.'Used' -ge 75 } | Set-Style -Style Warning -Property 'Used' $VserverObj | Where-Object { $_.'Status' -like 'offline' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ Name = "Root Volume - $($Vserver)" List = $false ColumnWidths = 20, 10, 10, 10, 10, 10, 30 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $VserverObj | Table @TableParams } } } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } try { if (Get-NcVserverAggr) { Section -Style Heading4 'Aggregate Resource Allocation' { $VserverAGGR = Get-NcVserverAggr -VserverContext $Vserver -Controller $Array $VserverObj = @() if ($VserverAGGR) { foreach ($Item in $VserverAGGR) { try { $inObj = [ordered] @{ 'Aggregate' = $Item.AggregateName 'Type' = $Item.AggregateType 'SnapLock Type' = $Item.SnaplockType 'Available' = $Item.AvailableSize | ConvertTo-FormattedNumber -Type Datasize -ErrorAction SilentlyContinue } $VserverObj += [pscustomobject]$inobj } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } } $TableParams = @{ Name = "Aggregate Resource Allocation - $($Vserver)" List = $false ColumnWidths = 40, 15, 25, 20 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $VserverObj | Table @TableParams } } } } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } } end {} } |