Skip to content

Commit c1f5fe1

Browse files
committed
Added NVME Namespace storage
1 parent 538ed4b commit c1f5fe1

File tree

2 files changed

+120
-1
lines changed

2 files changed

+120
-1
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
function Get-AbrOntapVserverNamespaceStorage {
2+
<#
3+
.SYNOPSIS
4+
Used by As Built Report to retrieve NetApp ONTAP vserver namespace information from the Cluster Management Network
5+
.DESCRIPTION
6+
7+
.NOTES
8+
Version: 0.6.7
9+
Author: Jonathan Colon
10+
Twitter: @jcolonfzenpr
11+
Github: rebelinux
12+
.EXAMPLE
13+
14+
.LINK
15+
16+
#>
17+
param (
18+
[Parameter (
19+
Position = 0,
20+
Mandatory)]
21+
[string]
22+
$Vserver
23+
)
24+
25+
begin {
26+
Write-PScriboMessage "Collecting ONTAP Vserver namespace information."
27+
}
28+
29+
process {
30+
try {
31+
$VserverNamespace = Get-NcNvmeNamespace -VserverContext $Vserver -Controller $Arra
32+
$VserverObj = @()
33+
if ($VserverNamespace) {
34+
foreach ($Item in $VserverNamespace) {
35+
try {
36+
$namespacemap = Get-NcNvmeSubsystemMap -Vserver $Vserver -Controller $Array | Where-Object { $_.Path -eq $Item.Path }
37+
$namespacepath = $Item.Path.split('/')
38+
$namespace = $namespacepath[3]
39+
$available = $Item.Size - $Item.SizeUsed
40+
$used = ($Item.SizeUsed / $Item.Size) * 100
41+
$inObj = [ordered] @{
42+
'Namespace Name' = $namespace
43+
'Parent Volume' = $Item.Volume
44+
'Path' = $Item.Path
45+
'Serial Number' = $Item.Uuid
46+
'Subsystem Map' = Switch (($namespacemap).count) {
47+
0 { "None" }
48+
default { $namespacemap.Subsystem }
49+
}
50+
'Home Node ' = $Item.Node
51+
'Capacity' = $Item.Size | ConvertTo-FormattedNumber -Type Datasize -ErrorAction SilentlyContinue
52+
'Available' = $available | ConvertTo-FormattedNumber -Type Datasize -ErrorAction SilentlyContinue
53+
'Used' = $used | ConvertTo-FormattedNumber -Type Percent -ErrorAction SilentlyContinue
54+
'OS Type' = $Item.Ostype
55+
'Is Mapped' = Switch ([string]::IsNullOrEmpty($Item.Subsystem)) {
56+
$true { "No" }
57+
$false { "Yes" }
58+
default { $Item.Subsystem }
59+
}
60+
'ReadOnly' = ConvertTo-TextYN $Item.IsReadOnly
61+
'Status' = Switch ($Item.State) {
62+
'online' { 'Up' }
63+
'offline' { 'Down' }
64+
default { $Item.Online }
65+
}
66+
}
67+
$VserverObj = [pscustomobject]$inobj
68+
69+
if ($Healthcheck.Vserver.Status) {
70+
$VserverObj | Where-Object { $_.'Status' -like 'Down' } | Set-Style -Style Warning -Property 'Status'
71+
$VserverObj | Where-Object { $_.'Used' -ge 90 } | Set-Style -Style Critical -Property 'Used'
72+
$VserverObj | Where-Object { $_.'Is Mapped' -eq 'No' } | Set-Style -Style Warning -Property 'Is Mapped'
73+
}
74+
75+
$TableParams = @{
76+
Name = "Namespace - $($namespace)"
77+
List = $true
78+
ColumnWidths = 25, 75
79+
}
80+
if ($Report.ShowTableCaptions) {
81+
$TableParams['Caption'] = "- $($TableParams.Name)"
82+
}
83+
$VserverObj | Sort-Object -Property 'Namespace Name' | Table @TableParams
84+
} catch {
85+
Write-PScriboMessage -IsWarning $_.Exception.Message
86+
}
87+
}
88+
}
89+
} catch {
90+
Write-PScriboMessage -IsWarning $_.Exception.Message
91+
}
92+
}
93+
94+
end {}
95+
96+
}

Src/Public/Invoke-AsBuiltReport.NetApp.ONTAP.ps1

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ function Invoke-AsBuiltReport.NetApp.ONTAP {
448448
Get-AbrOntapVserverNvmeFcAdapter -Vserver $SVM
449449
}
450450
}
451-
HomePort if (Get-NcNvmeInterface -VserverContext $Vserver -Controller $Array | Where-Object { $_.PhysicalProtocol -eq 'ethernet' }) {
451+
if (Get-NcNvmeInterface -VserverContext $Vserver -Controller $Array | Where-Object { $_.PhysicalProtocol -eq 'ethernet' }) {
452452
Section -ExcludeFromTOC -Style Heading6 'Nvme TCP Physical Adapter' {
453453
Get-AbrOntapVserverNvmeTcpAdapter -Vserver $SVM
454454
}
@@ -518,6 +518,29 @@ function Invoke-AsBuiltReport.NetApp.ONTAP {
518518
}
519519
}
520520
#---------------------------------------------------------------------------------------------#
521+
# NameSpace & Subsystem Storage Section #
522+
#---------------------------------------------------------------------------------------------#
523+
if (Get-NcNvmeNamespace -Controller $Array | Where-Object { $_.Vserver -eq $SVM }) {
524+
Section -Style Heading5 'Namespace Storage' {
525+
Paragraph "The following section provides the Namespace Storage Information on $($SVM)."
526+
BlankLine
527+
Get-AbrOntapVserverNamespaceStorage -Vserver $SVM
528+
# if (Get-NcIgroup -Vserver $SVM -Controller $Array) {
529+
# Section -ExcludeFromTOC -Style Heading6 'Igroup Mapping' {
530+
# Get-AbrOntapVserverLunIgroup -Vserver $SVM
531+
# }
532+
# $NonMappedLun = Get-AbrOntapVserverNonMappedLun -Vserver $SVM
533+
# if ($Healthcheck.Vserver.Status -and $NonMappedLunFCP) {
534+
# Section -ExcludeFromTOC -Style Heading6 'HealthCheck - Non-Mapped Lun Information' {
535+
# Paragraph "The following section provides information of Non Mapped Lun on $($SVM)."
536+
# BlankLine
537+
# $NonMappedLun
538+
# }
539+
# }
540+
# }
541+
}
542+
}
543+
#---------------------------------------------------------------------------------------------#
521544
# Consistency Groups Section #
522545
#---------------------------------------------------------------------------------------------#
523546
$CGs = Get-NetAppOntapAPI -uri "/api/application/consistency-groups?svm=$SVM&fields=**&return_records=true&return_timeout=15"

0 commit comments

Comments
 (0)