Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AsBuiltReport.NetApp.ONTAP.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#CompanyName = 'Unknown'

# Copyright statement for this module
Copyright = '(c) 2025 Jonathan Colon Feliciano. All rights reserved.'
Copyright = '(c) 2026 Jonathan Colon Feliciano. All rights reserved.'

# Description of the functionality provided by this module
Description = 'A PowerShell module to generate an as built report on the configuration of NetApp ONTAP.'
Expand Down Expand Up @@ -62,7 +62,7 @@
},
@{
ModuleName = 'Diagrammer.Core';
ModuleVersion = '0.2.36'
ModuleVersion = '0.2.37'
}
)

Expand Down
19 changes: 5 additions & 14 deletions AsBuiltReport.NetApp.ONTAP.psm1
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
# Get assemblies files and import them
$assemblyName = switch ($PSVersionTable.PSEdition) {
switch ($PSVersionTable.PSEdition) {
'Core' {
if ($IsMacOS) {
@(Get-ChildItem -Path ("$PSScriptRoot{0}Src{0}Bin{0}Assemblies{0}net90{0}osx-x64{0}*.dll" -f [System.IO.Path]::DirectorySeparatorChar) -ErrorAction SilentlyContinue)
Import-Module ("$PSScriptRoot{0}Src{0}Tools{0}Bin{0}osx-x64{0}AsBuiltReportChart.dll" -f [System.IO.Path]::DirectorySeparatorChar)
} elseif ($IsLinux) {
@(Get-ChildItem -Path ("$PSScriptRoot{0}Src{0}Bin{0}Assemblies{0}net90{0}linux-x64{0}*.dll" -f [System.IO.Path]::DirectorySeparatorChar) -ErrorAction SilentlyContinue)
Import-Module ("$PSScriptRoot{0}Src{0}Tools{0}Bin{0}linux-x64{0}AsBuiltReportChart.dll" -f [System.IO.Path]::DirectorySeparatorChar)
} elseif ($IsWindows) {
@(Get-ChildItem -Path ("$PSScriptRoot{0}Src{0}Bin{0}Assemblies{0}net90{0}win-x64{0}*.dll" -f [System.IO.Path]::DirectorySeparatorChar) -ErrorAction SilentlyContinue)
Import-Module ("$PSScriptRoot{0}Src{0}Tools{0}Bin{0}windows-x64{0}AsBuiltReportChart.dll" -f [System.IO.Path]::DirectorySeparatorChar)
}
}
'Desktop' {
@(Get-ChildItem -Path ("$PSScriptRoot{0}Src{0}Bin{0}Assemblies{0}net48{0}*.dll" -f [System.IO.Path]::DirectorySeparatorChar) -ErrorAction SilentlyContinue)
Import-Module ("$PSScriptRoot{0}Src{0}Tools{0}Bin{0}windows-x64{0}AsBuiltReportChart.dll" -f [System.IO.Path]::DirectorySeparatorChar)
}
default {
Write-Verbose -Message 'Unable to find compatible assemblies.'
}
}

foreach ($Assembly in $assemblyName) {
try {
Write-Verbose -Message "Loading assembly '$($Assembly.Name)'."
Add-Type -Path $Assembly.FullName -Verbose
} catch {
Write-Error -Message "Failed to add assembly $($Assembly.FullName): $_"
}
}

# Get public and private function definition files and dot source them
$Public = @(Get-ChildItem -Path $PSScriptRoot\Src\Public\*.ps1 -ErrorAction SilentlyContinue)
$Private = @(Get-ChildItem -Path $PSScriptRoot\Src\Private\*.ps1 -ErrorAction SilentlyContinue)
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Apply powershell best practices
- Add ConvertTo-HashToYN function
- Add EMS configuration setting health check
- Add support for charts
- Aggragate Usage
- Per Node Disk Assignment

### Changed

Expand All @@ -33,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix Volume SnapShot Configuration section showing healthcheck for non violated item
- Fix CodeQL analysis issues 27
- Fix diagram size not respecting document border size
- Fix HealthCheck - Volume without deduplication section displaying incorrect values

### Removed

Expand Down
1,689 changes: 1,214 additions & 475 deletions Samples/Sample NetApp As-Built Report.html

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions Src/Private/Get-AbrOntapDiskAssign.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ function Get-AbrOntapDiskAssign {
try {
$NodeDiskCount = Get-NcDisk -Controller $Array | ForEach-Object { $_.DiskOwnershipInfo.HomeNodeName } | Group-Object
if ($NodeDiskCount) {
$ChartData = @()
$OwnerName = @()
$OutObj = @()
foreach ($Disks in $NodeDiskCount) {
$OwnerName += $Disks.Name
$ChartData += $Disks.Count
$inObj = [ordered] @{
'Node' = $Disks.Name
'Disk Count' = $Disks | Select-Object -ExpandProperty Count
Expand All @@ -44,6 +48,16 @@ function Get-AbrOntapDiskAssign {
}
$OutObj | Table @TableParams
}
try {
$Chart = New-BarChart -Values $ChartData -Labels $OwnerName -Title 'Disk Assignment' -EnableLegend -LegendOrientation Horizontal -LegendAlignment UpperCenter -Width 600 -Height 600 -Format base64 -LabelYAxis 'Disk Count' -LabelXAxis 'Nodes' -TitleFontSize 20 -TitleFontBold -AreaOrientation Vertical -EnableCustomColorPalette -CustomColorPalette @('#395879', '#59779a', '#7b98bc', '#9dbae0', '#c0ddff') -AxesMarginsTop 0.5
if ($Chart) {
Section -Style NOTOCHeading5 -ExcludeFromTOC 'Per Node Disk Assignment - Chart' {
Image -Text 'Per Node Disk Assignment - Chart' -Align 'Center' -Percent 100 -Base64 $Chart
}
}
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
} catch {
Write-PScriboMessage -IsWarning $_.Exception.Message
}
Expand Down
2 changes: 1 addition & 1 deletion Src/Private/Get-AbrOntapEfficiencyAggr.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ function Get-AbrOntapEfficiencyAggr {
$OutObj | Table @TableParams
}
try {
$OutObj = @()
$Data = Get-NcAggr -Controller $Array | Where-Object { $_.AggrRaidAttributes.HasLocalRoot -ne 'True' }
$Savingfilter = (Get-NcAggrEfficiency -Controller $Array | Select-Object -ExpandProperty AggrEfficiencyAdditionalDetailsInfo).NumberOfSisDisabledVolumes | Measure-Object -Sum
if ($Data -and $Savingfilter.Sum -gt 0 -and $Healthcheck.Storage.Efficiency) {
$OutObj = @()
foreach ($Item in $Data) {
try {
$Saving = (Get-NcAggrEfficiency -Aggregate $Item.Name -Controller $Array | Select-Object -ExpandProperty AggrEfficiencyAdditionalDetailsInfo).NumberOfSisDisabledVolumes
Expand Down
4 changes: 2 additions & 2 deletions Src/Private/Get-AbrOntapRepRelations.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function Get-AbrOntapRepRelationship {
'Destination Vserver' = $Item.DestinationVserver
'Destination Location' = $Item.DestinationLocation
'Mirror State' = $Item.MirrorState
'Schedule' = ${Item}?.Schedule.toUpper()
'Schedule' = ${Item}?.Schedule?.toUpper()
'Relationship Type' = switch ($Item.RelationshipType) {
'extended_data_protection' { 'XDP' }
'data_protection' { 'DP' }
Expand All @@ -51,7 +51,7 @@ function Get-AbrOntapRepRelationship {
'Policy Type' = $Item.PolicyType
'Unhealthy Reason' = ($Null -eq $Item.UnhealthyReason) ? 'None': $Item.UnhealthyReason
'Lag Time' = $lagtime
'Status' = ${Item}?.Status.toUpper()
'Status' = ${Item}?.Status?.toUpper()
}
$ReplicaObj = [pscustomobject](ConvertTo-HashToYN $inObj)

Expand Down
14 changes: 13 additions & 1 deletion Src/Private/Get-AbrOntapStorageAGGR.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ function Get-AbrOntapStorageAGGR {
try {
$ObjectData = Get-NcAggr -Controller $Array
if ($ObjectData) {
$ChartData = @()
$AggrName = @()
$ObjectDataInfo = @()
foreach ($Data in $ObjectData) {
try {
if (-not (Get-NcAggr -Name $Data.Name -Controller $Array).AggrRaidAttributes.IsRootAggregate) {
$AggrName += $Data.Name
$ChartData += , @([math]::Round((($Data.Totalsize - $Data.Available) / $Data.TotalSize * 100), 0), [math]::Round(($Data.Available / $Data.TotalSize) * 100, 0))
}
$AggrOwner = (Get-NcAggr -Name $Data.Name ).AggrOwnershipAttributes
$inObj = [Ordered]@{
'Name' = $Data.Name
Expand All @@ -39,7 +45,7 @@ function Get-AbrOntapStorageAGGR {
'Available' = ($Data.Available | ConvertTo-FormattedNumber -ErrorAction SilentlyContinue -NumberFormatString 0.0 -Type Datasize) ?? '--'
'Used' = (($Data.Totalsize - $Data.Available ) | ConvertTo-FormattedNumber -ErrorAction SilentlyContinue -NumberFormatString 0.0 -Type Datasize) ?? '--'
'Disk Count' = $Data.Disks
'Root' = ((Get-NcAggr -Name $Data.Name -Controller $Array | ForEach-Object { $_.AggrRaidAttributes.HasLocalRoot }) -eq 'False') ? 'No': 'Yes'
'Root' = ((Get-NcAggr -Name $Data.Name -Controller $Array).AggrRaidAttributes.IsRootAggregate) ? 'Yes': 'No'
'Raid Type' = (($Data.RaidType.Split(',')[0]).ToUpper()) ?? '--'
'Raid Size' = $Data.RaidSize
'Volumes in Aggregate' = $Data.Volumes
Expand Down Expand Up @@ -104,6 +110,12 @@ function Get-AbrOntapStorageAGGR {
BlankLine
}
}
$Chart = New-StackedBar -Values $ChartData -Labels $AggrName -LegendCategories @('Used', 'Free') -Title 'Aggregates Usage' -EnableLegend -LegendOrientation Horizontal -LegendAlignment UpperCenter -Width 600 -Height 600 -Format base64 -LabelYAxis '%' -LabelXAxis 'Aggregates' -TitleFontSize 20 -TitleFontBold -AreaOrientation Horizontal -EnableCustomColorPalette -CustomColorPalette @('#7b98bc', '#c0ddff')
if ($Chart) {
Section -Style NOTOCHeading4 -ExcludeFromTOC 'Aggragate Usage - Chart' {
Image -Text 'Aggragate Usage - Chart' -Align 'Center' -Percent 100 -Base64 $Chart
}
}
}
} catch {
Write-PScriboMessage -IsWarning $($_.Exception.Message)
Expand Down
Loading