Skip to content

Commit

Permalink
Merge pull request #47 from rebelinux/dev
Browse files Browse the repository at this point in the history
Nvme Improvements
  • Loading branch information
rebelinux authored Aug 9, 2024
2 parents 538ed4b + 7090cb2 commit eae10b7
Show file tree
Hide file tree
Showing 7 changed files with 365 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Src/Private/Get-AbrOntapEfficiencyAggr.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function Get-AbrOntapEfficiencyAggr {
}
if ($OutObj) {
Section -Style Heading4 'HealthCheck - Volume with Disabled Deduplication' {
Paragraph "The following section provides the Volume efficiency healthcheck Information on $($ClusterInfo.ClusterName)."
Paragraph "The following table provides the Volume efficiency healthcheck Information on $($ClusterInfo.ClusterName)."
BlankLine
$OutObj | Table @TableParams
}
Expand Down
2 changes: 1 addition & 1 deletion Src/Private/Get-AbrOntapNetworkMGMT.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function Get-AbrOntapNetworkMgmt {
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 section provides the LIF Home Status Information on $($ClusterInfo.ClusterName)."
Paragraph "The following table provides the LIF Home Status Information on $($ClusterInfo.ClusterName)."
BlankLine
$ClusterData = Get-NcNetInterface -Controller $Array | Where-Object { $_.DataProtocols -ne 'fcp' -and $_.IsHome -like "False" }
$ClusterObj = @()
Expand Down
85 changes: 85 additions & 0 deletions Src/Private/Get-AbrOntapVserverCGNamespace.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
function Get-AbrOntapVserverCGNamespace {
<#
.SYNOPSIS
Used by As Built Report to retrieve NetApp ONTAP Vserver Consistency Groups Namespace information from the Cluster Management Network
.DESCRIPTION
.NOTES
Version: 0.6.7
Author: Jonathan Colon
Twitter: @jcolonfzenpr
Github: rebelinux
.EXAMPLE
.LINK
#>
param (
[Parameter (
Position = 0,
Mandatory)]
$CGObj
)

begin {
Write-PScriboMessage "Collecting ONTAP Vserver Consistency Groups namespace information."
}

process {
try {
$NamespaceData = $CGObj.namespaces
$CGNamespaceObj = @()
if ($NamespaceData) {
foreach ($Item in $NamespaceData) {
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


}
$CGNamespaceObj += [pscustomobject]$inobj
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}

if ($Healthcheck.Vserver.CG) {
$CGNamespaceObj | Where-Object { $_.'Volume State' -ne 'online' } | Set-Style -Style Warning -Property 'Volume State'
$CGNamespaceObj | Where-Object { $_.'Mapped' -eq 'No' } | Set-Style -Style Warning -Property 'Mapped'
$CGNamespaceObj | Where-Object { $_.'Read Only' -eq 'Yes' } | Set-Style -Style Warning -Property 'Read Only'
$CGNamespaceObj | Where-Object { $_.'State' -eq 'offline' } | Set-Style -Style Warning -Property 'State'
}

$TableParams = @{
Name = "Consistency Group Namespace - $($CGObj.Name)"
List = $false
ColumnWidths = 30, 10, 9, 10, 11, 10, 10, 10
}
if ($Report.ShowTableCaptions) {
$TableParams['Caption'] = "- $($TableParams.Name)"
}
$CGNamespaceObj | Sort-Object -Property Name | Table @TableParams
}
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}

end {}

}
96 changes: 96 additions & 0 deletions Src/Private/Get-AbrOntapVserverNamespaceStorage.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
function Get-AbrOntapVserverNamespaceStorage {
<#
.SYNOPSIS
Used by As Built Report to retrieve NetApp ONTAP vserver namespace information from the Cluster Management Network
.DESCRIPTION
.NOTES
Version: 0.6.7
Author: Jonathan Colon
Twitter: @jcolonfzenpr
Github: rebelinux
.EXAMPLE
.LINK
#>
param (
[Parameter (
Position = 0,
Mandatory)]
[string]
$Vserver
)

begin {
Write-PScriboMessage "Collecting ONTAP Vserver namespace information."
}

process {
try {
$VserverNamespace = Get-NcNvmeNamespace -VserverContext $Vserver -Controller $Arra
$VserverObj = @()
if ($VserverNamespace) {
foreach ($Item in $VserverNamespace) {
try {
$namespacemap = Get-NcNvmeSubsystemMap -Vserver $Vserver -Controller $Array | Where-Object { $_.Path -eq $Item.Path }
$namespacepath = $Item.Path.split('/')
$namespace = $namespacepath[3]
$available = $Item.Size - $Item.SizeUsed
$used = ($Item.SizeUsed / $Item.Size) * 100
$inObj = [ordered] @{
'Namespace Name' = $namespace
'Parent Volume' = $Item.Volume
'Path' = $Item.Path
'Serial Number' = $Item.Uuid
'Subsystem Map' = Switch (($namespacemap).count) {
0 { "None" }
default { $namespacemap.Subsystem }
}
'Home Node ' = $Item.Node
'Capacity' = $Item.Size | ConvertTo-FormattedNumber -Type Datasize -ErrorAction SilentlyContinue
'Available' = $available | ConvertTo-FormattedNumber -Type Datasize -ErrorAction SilentlyContinue
'Used' = $used | ConvertTo-FormattedNumber -Type Percent -ErrorAction SilentlyContinue
'OS Type' = $Item.Ostype
'Is Mapped' = Switch ([string]::IsNullOrEmpty($Item.Subsystem)) {
$true { "No" }
$false { "Yes" }
default { $Item.Subsystem }
}
'ReadOnly' = ConvertTo-TextYN $Item.IsReadOnly
'Status' = Switch ($Item.State) {
'online' { 'Up' }
'offline' { 'Down' }
default { $Item.Online }
}
}
$VserverObj = [pscustomobject]$inobj

if ($Healthcheck.Vserver.Status) {
$VserverObj | Where-Object { $_.'Status' -like 'Down' } | Set-Style -Style Warning -Property 'Status'
$VserverObj | Where-Object { $_.'Used' -ge 90 } | Set-Style -Style Critical -Property 'Used'
$VserverObj | Where-Object { $_.'Is Mapped' -eq 'No' } | Set-Style -Style Warning -Property 'Is Mapped'
}

$TableParams = @{
Name = "Namespace - $($namespace)"
List = $true
ColumnWidths = 25, 75
}
if ($Report.ShowTableCaptions) {
$TableParams['Caption'] = "- $($TableParams.Name)"
}
$VserverObj | Sort-Object -Property 'Namespace Name' | Table @TableParams
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}
}
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}

end {}

}
70 changes: 70 additions & 0 deletions Src/Private/Get-AbrOntapVserverNonMappedNamespace.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
function Get-AbrOntapVserverNonMappedNamespace {
<#
.SYNOPSIS
Used by As Built Report to retrieve NetApp ONTAP NVMW Non Mapped amespace information from the Cluster Management Network
.DESCRIPTION
.NOTES
Version: 0.6.7
Author: Jonathan Colon
Twitter: @jcolonfzenpr
Github: rebelinux
.EXAMPLE
.LINK
#>
param (
[Parameter (
Position = 0,
Mandatory)]
[string]
$Vserver
)

begin {
Write-PScriboMessage "Collecting ONTAP NVME Non Mapped Namespace information."
}

process {
try {
$NamespaceFilter = Get-NcNvmeNamespace -VserverContext $Vserver -Controller $Array | Where-Object { -Not $_.Subsystem }
$OutObj = @()
if ($NamespaceFilter) {
foreach ($Item in $NamespaceFilter) {
try {
$namespacename = (($Item.Path).split('/'))[3]
$inObj = [ordered] @{
'Volume Name' = $Item.Volume
'Lun Name' = $namespacename
'Type' = $Item.Ostype
'Mapped' = "No"
'State' = $Item.State
}
$OutObj += [pscustomobject]$inobj
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}
if ($Healthcheck.Vserver.Status) {
$OutObj | Set-Style -Style Warning
}

$TableParams = @{
Name = "HealthCheck - Non-Mapped Namespace - $($Vserver)"
List = $false
ColumnWidths = 30, 30, 10, 10, 20
}
if ($Report.ShowTableCaptions) {
$TableParams['Caption'] = "- $($TableParams.Name)"
}
$OutObj | Table @TableParams
}
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}

end {}

}
82 changes: 82 additions & 0 deletions Src/Private/Get-AbrOntapVserverSubsystem.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
function Get-AbrOntapVserverSubsystem {
<#
.SYNOPSIS
Used by As Built Report to retrieve NetApp ONTAP vserver subsystem information from the Cluster Management Network
.DESCRIPTION
.NOTES
Version: 0.6.7
Author: Jonathan Colon
Twitter: @jcolonfzenpr
Github: rebelinux
.EXAMPLE
.LINK
#>
param (
[Parameter (
Position = 0,
Mandatory)]
[string]
$Vserver
)

begin {
Write-PScriboMessage "Collecting ONTAP Vserver Subsystem information."
}

process {
try {
$VserverSubsystem = Get-NcNvmeSubsystem -VserverContext $Vserver -Controller $Array
$VserverObj = @()
if ($VserverSubsystem) {
foreach ($Item in $VserverSubsystem) {
try {
$namespacemap = Get-NcNvmeSubsystemMap -Controller $Array | Where-Object { $_.Subsystem -eq $Item.Subsystem } | Select-Object -ExpandProperty Path
$MappedNamespace = @()
foreach ($namespace in $namespacemap) {
try {
$namespacename = $namespace.split('/')
$MappedNamespace += $namespacename[3]
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}
$inObj = [ordered] @{
'Subsystem Name' = $Item.Subsystem
'Type' = $Item.Ostype
'Target NQN' = $Item.TargetNqn
'Host NQN' = $Item.Hosts.Nqn
'Mapped Namespace' = Switch (($MappedNamespace).count) {
0 { "None" }
default { $MappedNamespace }
}
}
$VserverObj = [pscustomobject]$inobj
if ($Healthcheck.Vserver.Status) {
$VserverObj | Where-Object { ($_.'Mapped Namespace').count -eq 0 } | Set-Style -Style Warning -Property 'Mapped Namespace'
}

$TableParams = @{
Name = "Subsystem - $($Item.Subsystem)"
List = $true
ColumnWidths = 25, 75
}
if ($Report.ShowTableCaptions) {
$TableParams['Caption'] = "- $($TableParams.Name)"
}
$VserverObj | Table @TableParams
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}
}
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
}

end {}

}
Loading

0 comments on commit eae10b7

Please sign in to comment.