Src/Private/Get-AbrOntapNetworkMGMT.ps1
|
function Get-AbrOntapNetworkMgmt { <# .SYNOPSIS Used by As Built Report to retrieve NetApp ONTAP network management interfaces information from the Cluster Management Network .DESCRIPTION .NOTES Version: 0.6.7 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux .EXAMPLE .LINK #> [CmdletBinding()] param ( ) begin { Write-PScriboMessage "Collecting ONTAP network management interface information." } process { try { if (Get-NcNetInterface -Controller $Array | Where-Object { $_.Role -eq 'cluster' }) { try { Section -ExcludeFromTOC -Style Heading6 'Cluster Network Interfaces' { $ClusterData = Get-NcNetInterface -Controller $Array | Where-Object { $_.Role -eq 'cluster' } $ClusterObj = @() if ($ClusterData) { foreach ($Item in $ClusterData) { try { $inObj = [ordered] @{ 'Cluster Interface' = $Item.InterfaceName 'Status' = switch ($Item.OpStatus) { "" { "Unknown" } $Null { "Unknown" } default { $Item.OpStatus.ToString().ToUpper() } } 'Data Protocols' = $Item.DataProtocols 'Address' = $Item.Address 'Vserver' = $Item.Vserver } $ClusterObj += [pscustomobject]$inobj } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } } if ($Healthcheck.Network.Interface) { $ClusterObj | Where-Object { $_.'Status' -notlike 'UP' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ Name = "Cluster Network - $($ClusterInfo.ClusterName)" List = $false ColumnWidths = 35, 8, 21, 18, 18 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $ClusterObj | Table @TableParams if ($Healthcheck.Network.Interface -and ($ClusterObj | Where-Object { $_.'Status' -notlike 'UP' })) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { Text "Best Practice:" -Bold Text "Ensure that all cluster network interfaces are operational (UP) to maintain cluster connectivity and performance." } BlankLine } } } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } } try { Section -ExcludeFromTOC -Style Heading6 'Management Network Interfaces' { $ClusterData = Get-NcNetInterface -Controller $Array | Where-Object { $_.Role -eq 'cluster_mgmt' -or $_.Role -eq 'node_mgmt' } $ClusterObj = @() if ($ClusterData) { foreach ($Item in $ClusterData) { try { $inObj = [ordered] @{ 'MGMT Interface' = $Item.InterfaceName 'Status' = switch ($Item.OpStatus) { "" { "Unknown" } $Null { "Unknown" } default { $Item.OpStatus.ToString().ToUpper() } } 'Data Protocols' = $Item.DataProtocols 'Address' = $Item.Address 'Vserver' = $Item.Vserver } $ClusterObj += [pscustomobject]$inobj } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } } if ($Healthcheck.Network.Interface) { $ClusterObj | Where-Object { $_.'Status' -notlike 'UP' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ Name = "Management Network - $($ClusterInfo.ClusterName)" List = $false ColumnWidths = 35, 8, 21, 18, 18 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $ClusterObj | Table @TableParams if ($Healthcheck.Network.Interface -and ($ClusterObj | Where-Object { $_.'Status' -notlike 'UP' })) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { Text "Best Practice:" -Bold Text "Ensure that all management network interfaces are operational (UP) to maintain proper management access to the cluster." } BlankLine } } } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } try { if (Get-NcNetInterface -Controller $Array | Where-Object { $_.Role -eq 'intercluster' }) { Section -ExcludeFromTOC -Style Heading6 'Intercluster Network Interfaces' { $ClusterData = Get-NcNetInterface -Controller $Array | Where-Object { $_.Role -eq 'intercluster' } $ClusterObj = @() if ($ClusterData) { foreach ($Item in $ClusterData) { try { $inObj = [ordered] @{ 'Intercluster Interface' = $Item.InterfaceName 'Status' = switch ($Item.OpStatus) { "" { "Unknown" } $Null { "Unknown" } default { $Item.OpStatus.ToString().ToUpper() } } 'Data Protocols' = $Item.DataProtocols 'Address' = $Item.Address 'Vserver' = $Item.Vserver } $ClusterObj += [pscustomobject]$inobj } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } } if ($Healthcheck.Network.Interface) { $ClusterObj | Where-Object { $_.'Status' -notlike 'UP' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ Name = "Intercluster Network - $($ClusterInfo.ClusterName)" List = $false ColumnWidths = 35, 8, 21, 18, 18 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $ClusterObj | Table @TableParams if ($Healthcheck.Network.Interface -and ($ClusterObj | Where-Object { $_.'Status' -notlike 'UP' })) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { Text "Best Practice:" -Bold Text "Ensure that all intercluster network interfaces are operational (UP) to maintain cluster-to-cluster communication." } BlankLine } } } } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } try { Section -ExcludeFromTOC -Style Heading6 'Data Network Interfaces' { $ClusterData = Get-NcNetInterface -Controller $Array | Where-Object { $_.Role -eq 'data' -and $_.Vserver -notin $options.Exclude.Vserver } $ClusterObj = @() if ($ClusterData) { foreach ($Item in $ClusterData) { try { if ($Item.Wwpn) { $AddressData = $Item.Wwpn } else { $AddressData = $Item.Address } $inObj = [ordered] @{ 'Data Interface' = $Item.InterfaceName 'Status' = switch ($Item.OpStatus) { "" { "Unknown" } $Null { "Unknown" } default { $Item.OpStatus.ToString().ToUpper() } } 'Data Protocols' = [string]$Item.DataProtocols 'Address' = $AddressData 'Vserver' = $Item.Vserver } $ClusterObj += [pscustomobject]$inobj } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } } if ($Healthcheck.Network.Interface) { $ClusterObj | Where-Object { $_.'Status' -notlike 'UP' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ Name = "Data Network - $($ClusterInfo.ClusterName)" List = $false ColumnWidths = 33, 10, 21, 18, 18 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $ClusterObj | Table @TableParams if ($Healthcheck.Network.Interface -and ($ClusterObj | Where-Object { $_.'Status' -notlike 'UP' })) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { Text "Best Practice:" -Bold Text "Ensure that all data network interfaces are operational (UP) to maintain optimal data access and performance." } BlankLine } } } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } try { if ((Get-NcNetInterface -Controller $Array | Where-Object { $_.DataProtocols -ne 'fcp' -and $_.IsHome -like "False" }) -and $Healthcheck.Network.Interface) { Section -ExcludeFromTOC -Style Heading6 'HealthCheck - Check If Network Interface is Home' { Paragraph "The following table provides the LIF Home Status Information in $($ClusterInfo.ClusterName)." BlankLine $ClusterData = Get-NcNetInterface -Controller $Array | Where-Object { $_.DataProtocols -ne 'fcp' -and $_.IsHome -like "False" } $ClusterObj = @() if ($ClusterData) { foreach ($Item in $ClusterData) { try { $inObj = [ordered] @{ 'Network Interface' = $Item.InterfaceName 'Home Port' = $Item.HomeNode + ":" + $Item.HomePort 'Current Port' = $Item.CurrentNode + ":" + $Item.CurrentPort 'IsHome' = switch ($Item.IsHome) { "True" { 'Yes' } "False" { "No" } default { $Item.IsHome } } 'Vserver' = $Item.Vserver } $ClusterObj += [pscustomobject]$inobj } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } } if ($Healthcheck.Network.Interface) { $ClusterObj | Where-Object { $_.'IsHome' -ne 'Yes' } | Set-Style -Style Warning -Property 'Network Interface', 'IsHome', 'Home Port', 'Current Port', 'Vserver' } $TableParams = @{ Name = "Network Interface Home Status - $($ClusterInfo.ClusterName)" List = $false ColumnWidths = 20, 25, 25, 10, 20 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $ClusterObj | Table @TableParams if ($Healthcheck.Network.Interface -and ($ClusterObj | Where-Object { $_.'IsHome' -ne 'Yes' })) { Paragraph "Health Check:" -Bold -Underline BlankLine Paragraph { Text "Best Practice:" -Bold Text "Ensure that all network interfaces are on their designated home ports to maintain optimal network performance and reliability." } BlankLine } } } } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } } catch { Write-PScriboMessage -IsWarning $_.Exception.Message } } end {} } |