Skip to content

Commit

Permalink
v0.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelinux committed Dec 26, 2023
1 parent 4e3263c commit 3410a75
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 25 deletions.
30 changes: 17 additions & 13 deletions Src/Private/Get-DiagBackupToRepo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Get-DiagBackupToRepo {
.DESCRIPTION
Build a diagram of the configuration of Veeam VBR in PDF/PNG/SVG formats using Psgraph.
.NOTES
Version: 0.5.3
Version: 0.5.4
Author: Jonathan Colon
Twitter: @jcolonfzenpr
Github: rebelinux
Expand Down Expand Up @@ -39,7 +39,7 @@ function Get-DiagBackupToRepo {
# Node used for subgraph centering
node LocalReposDummy @{Label='LocalReposDummy'; style=$SubGraphDebug.style; color=$SubGraphDebug.color; shape='plain'}
$Rank = @()
if ($LocalBackupRepo.count -le 4) {
if ($LocalBackupRepo.count -le 3) {
foreach ($REPOOBJ in ($LocalBackupRepo | Sort-Object -Property Name)) {
$REPOHASHTABLE = @{}
$REPOOBJ.psobject.properties | ForEach-Object {$REPOHASHTABLE[$_.Name] = $_.Value }
Expand All @@ -48,10 +48,11 @@ function Get-DiagBackupToRepo {
edge -from LocalReposDummy -to $LocalBackupRepo.Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color}
}
else {
$Group = Split-array -inArray ($LocalBackupRepo | Sort-Object -Property Name) -size 4
$Group = Split-array -inArray ($LocalBackupRepo | Sort-Object -Property Name) -size 3
$Number = 0
while ($Number -ne $Group.Length) {
SubGraph "LocalBackupGroup$($Number)" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} {
$Random = Get-Random
SubGraph "LocalBackupGroup$($Number)_$Random" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} {
$Group[$Number] | ForEach-Object {
$REPOHASHTABLE = @{}
$_.psobject.properties | ForEach-Object {$REPOHASHTABLE[$_.Name] = $_.Value }
Expand All @@ -76,7 +77,7 @@ function Get-DiagBackupToRepo {
if ($RemoteBackupRepo) {
SubGraph RemoteRepos -Attributes @{Label='Deduplicating Storage Appliances'; fontsize=18; penwidth=1.5; labelloc='t'; style='dashed,rounded'} {
node RemoteReposDummy @{Label='RemoteReposDummy'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'}
if ($RemoteBackupRepo.count -le 4) {
if ($RemoteBackupRepo.count -le 3) {
foreach ($REPOOBJ in ($RemoteBackupRepo | Sort-Object -Property Name)) {
$REPOHASHTABLE = @{}
$REPOOBJ.psobject.properties | ForEach-Object { $REPOHASHTABLE[$_.Name] = $_.Value }
Expand All @@ -85,10 +86,11 @@ function Get-DiagBackupToRepo {
edge -from RemoteReposDummy -to $RemoteBackupRepo.Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color}
}
else {
$Group = Split-array -inArray ($RemoteBackupRepo| Sort-Object -Property Name) -size 4
$Group = Split-array -inArray ($RemoteBackupRepo| Sort-Object -Property Name) -size 3
$Number = 0
while ($Number -ne $Group.Length) {
SubGraph "RemoteBackupRepo$($Number)" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} {
$Random = Get-Random
SubGraph "RemoteBackupRepo$($Number)_$Random" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} {
$Group[$Number] | ForEach-Object {
$REPOHASHTABLE = @{}
$_.psobject.properties | ForEach-Object {$REPOHASHTABLE[$_.Name] = $_.Value }
Expand All @@ -114,7 +116,7 @@ function Get-DiagBackupToRepo {
if ($ObjStorage) {
SubGraph ObjectStorage -Attributes @{Label='Object Repository'; fontsize=18; penwidth=1.5; labelloc='t'; style='dashed,rounded'} {
node ObjectStorageDummy @{Label='ObjectStorageDummy'; style=$SubGraphDebug.style; color=$SubGraphDebug.color; shape='plain'}
if ($ObjStorage.count -le 4) {
if ($ObjStorage.count -le 3) {
foreach ($STORAGEOBJ in ($ObjStorage | Sort-Object -Property Name)) {
$OBJHASHTABLE = @{}
$STORAGEOBJ.psobject.properties | ForEach-Object { $OBJHASHTABLE[$_.Name] = $_.Value }
Expand All @@ -123,10 +125,11 @@ function Get-DiagBackupToRepo {
edge -from ObjectStorageDummy -to $ObjStorage.Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color}
}
else {
$Group = Split-array -inArray ($ObjStorage| Sort-Object -Property Name) -size 4
$Group = Split-array -inArray ($ObjStorage| Sort-Object -Property Name) -size 3
$Number = 0
while ($Number -ne $Group.Length) {
SubGraph "ObjectStorage$($Number)" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} {
$Random = Get-Random
SubGraph "ObjectStorage$($Number)_$Random" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} {
$Group[$Number] | ForEach-Object {
$REPOHASHTABLE = @{}
$_.psobject.properties | ForEach-Object {$REPOHASHTABLE[$_.Name] = $_.Value }
Expand All @@ -151,7 +154,7 @@ function Get-DiagBackupToRepo {
if ($ArchiveObjStorage) {
SubGraph ArchiveObjectStorage -Attributes @{Label='Archive Object Repository'; fontsize=18; penwidth=1.5; labelloc='t'; style='dashed,rounded'} {
node ArchiveObjectStorageDummy @{Label='ArchiveObjectStorageDummy'; style=$EdgeDebug.style; color=$EdgeDebug.color; shape='plain'}
if ($ArchiveObjStorage.count -le 4) {
if ($ArchiveObjStorage.count -le 3) {
foreach ($STORAGEArchiveOBJ in ($ArchiveObjStorage | Sort-Object -Property Name)) {
$ARCHOBJHASHTABLE = @{}
$STORAGEArchiveOBJ.psobject.properties | ForEach-Object { $ARCHOBJHASHTABLE[$_.Name] = $_.Value }
Expand All @@ -160,10 +163,11 @@ function Get-DiagBackupToRepo {
edge -from ArchiveObjectStorageDummy -to $ArchiveObjStorage.Name @{minlen=1; style=$EdgeDebug.style; color=$EdgeDebug.color}
}
else {
$Group = Split-array -inArray ($ArchiveObjStorage| Sort-Object -Property Name) -size 4
$Group = Split-array -inArray ($ArchiveObjStorage| Sort-Object -Property Name) -size 3
$Number = 0
while ($Number -ne $Group.Length) {
SubGraph "ArchiveObjectStorage$($Number)" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} {
$Random = Get-Random
SubGraph "ArchiveObjectStorage$($Number)_$Random" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} {
$Group[$Number] | ForEach-Object {
$REPOHASHTABLE = @{}
$_.psobject.properties | ForEach-Object {$REPOHASHTABLE[$_.Name] = $_.Value }
Expand Down
9 changes: 5 additions & 4 deletions Src/Private/Get-DiagBackupToTape.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Get-DiagBackupToTape {
.DESCRIPTION
Build a diagram of the configuration of Veeam VBR in PDF/PNG/SVG formats using Psgraph.
.NOTES
Version: 0.5.3
Version: 0.5.4
Author: Jonathan Colon
Twitter: @jcolonfzenpr
Github: rebelinux
Expand Down Expand Up @@ -52,7 +52,7 @@ function Get-DiagBackupToTape {
node $TSLibraryOBJ -NodeScript {$_.Id} @{Label=$TSLHASHTABLE.Label; fontname="Segoe Ui"}
if ($BackupTapeDrives) {
$TapeLibraryDrives = ($BackupTapeDrives | Where-Object {$_.LibraryId -eq $TSLibraryOBJ.Id} | Sort-Object -Property Name)
if ($TapeLibraryDrives.count -le 4) {
if ($TapeLibraryDrives.count -le 3) {
foreach ($TSDriveOBJ in $TapeLibraryDrives) {
$TSDHASHTABLE = @{}
$TSDriveOBJ.psobject.properties | ForEach-Object {$TSDHASHTABLE[$_.Name] = $_.Value }
Expand All @@ -61,10 +61,11 @@ function Get-DiagBackupToTape {
}
}
else {
$Group = Split-array -inArray $TapeLibraryDrives -size 4
$Group = Split-array -inArray $TapeLibraryDrives -size 3
$Number = 0
while ($Number -ne $Group.Length) {
SubGraph "TDGroup$($Number)" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} {
$Random = Get-Random
SubGraph "TDGroup$($Number)_$Random" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} {
$Group[$Number] | ForEach-Object {
$TSDHASHTABLE = @{}
$_.psobject.properties | ForEach-Object {$TSDHASHTABLE[$_.Name] = $_.Value }
Expand Down
8 changes: 5 additions & 3 deletions Src/Private/Get-DiagBackupToViProxy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Get-DiagBackupToViProxy {
.DESCRIPTION
Build a diagram of the configuration of Veeam VBR in PDF/PNG/SVG formats using Psgraph.
.NOTES
Version: 0.5.3
Version: 0.5.4
Author: Jonathan Colon
Twitter: @jcolonfzenpr
Github: rebelinux
Expand Down Expand Up @@ -64,7 +64,8 @@ function Get-DiagBackupToViProxy {
$Group = Split-array -inArray $EsxiObjs -size 4
$Number = 0
while ($Number -ne $Group.Length) {
SubGraph "SAESXiGroup$($Number)" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} {
$Random = Get-Random
SubGraph "SAESXiGroup$($Number)_$Random" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} {
$Group[$Number] | ForEach-Object { node $_.Name @{Label=(Get-NodeIcon -Name $_.Name -Type 'VBR_ESXi_Server' -Align "Center" -Rows ($ESXiInfo = @{Version = $_.Info.ViVersion.ToString(); IP = try {$_.getManagmentAddresses().IPAddressToString} catch {"Unknown"}})) }}
}
$Number++
Expand Down Expand Up @@ -117,7 +118,8 @@ function Get-DiagBackupToViProxy {
$Group = Split-array -inArray $EsxiHosts -size 4
$Number = 0
while ($Number -ne $Group.Length) {
SubGraph "ESXiGroup$($Number)" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} {
$Random = Get-Random
SubGraph "ESXiGroup$($Number)_$Random" -Attributes @{Label=' '; style=$SubGraphDebug.style; color=$SubGraphDebug.color; fontsize=18; penwidth=1} {
$Group[$Number] | ForEach-Object { node $_.Name @{Label=(Get-NodeIcon -Name $_.Name -Type 'VBR_ESXi_Server' -Align "Center" -Rows ($ESXiInfo = @{Version = $_.Info.ViVersion.ToString(); IP = try {$_.getManagmentAddresses().IPAddressToString} catch {"Unknown"}}))}}
}
$Number++
Expand Down
6 changes: 3 additions & 3 deletions Src/Public/New-VeeamDiagram.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function New-VeeamDiagram {
.PARAMETER EnableErrorDebug
Control to enable error debugging.
.NOTES
Version: 0.5.1
Version: 0.5.4
Author(s): Jonathan Colon
Twitter: @jcolonfzenpr
Github: rebelinux
Expand Down Expand Up @@ -133,7 +133,7 @@ param (
HelpMessage = 'Please provide the path to the diagram output file'
)]
[ValidateScript( { Test-Path -Path $_ -IsValid })]
[string] $OutputFolderPath = (Join-Path ([System.IO.Path]::GetTempPath()) "$Filename.$Format"),
[string] $OutputFolderPath = [System.IO.Path]::GetTempPath(),

[Parameter(
Mandatory = $false,
Expand Down Expand Up @@ -411,7 +411,7 @@ process {
foreach ($OutputFormat in $Format) {
if ($Filename) {
Try {
if ($OutputFormat -ne "base64") {
if ($OutputFormat -ne "base64") {
if($OutputFormat -ne "svg") {
$Document = Export-PSGraph -Source $Graph -DestinationPath "$($OutputFolderPath)$($FileName)" -OutputFormat $OutputFormat
Write-ColorOutput -Color green "Diagram '$FileName' has been saved to '$OutputFolderPath'."
Expand Down
4 changes: 2 additions & 2 deletions Veeam.Diagrammer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'Veeam.Diagrammer.psm1'

# Version number of this module.
ModuleVersion = '0.5.3'
ModuleVersion = '0.5.4'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand All @@ -27,7 +27,7 @@ Author = 'Jonathan Colon'
CompanyName = 'Zen PR Solutions'

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

# Description of the functionality provided by this module
Description = 'A PowerShell module to generate an Veeam Backup & Replication infrastructure diagram'
Expand Down

0 comments on commit 3410a75

Please sign in to comment.