-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from rebelinux/dev
Nvme Improvements
- Loading branch information
Showing
7 changed files
with
365 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {} | ||
|
||
} |
Oops, something went wrong.