From e62df22093caad9c2bf8b06714bb303062f52a3b Mon Sep 17 00:00:00 2001 From: Jonathan Colon Date: Sat, 31 Aug 2024 12:51:01 -0400 Subject: [PATCH] Added Nas Repositories --- Src/Private/Get-DiagBackupToRepo.ps1 | 64 ++++++++++++++++++++++----- Src/Private/Get-VbrBackupRepoInfo.ps1 | 16 ++++--- Src/Private/Images.ps1 | 1 + Src/Private/SharedUtilsFunctions.ps1 | 8 +++- 4 files changed, 69 insertions(+), 20 deletions(-) diff --git a/Src/Private/Get-DiagBackupToRepo.ps1 b/Src/Private/Get-DiagBackupToRepo.ps1 index 699a323..47f0dba 100644 --- a/Src/Private/Get-DiagBackupToRepo.ps1 +++ b/Src/Private/Get-DiagBackupToRepo.ps1 @@ -28,15 +28,16 @@ function Get-DiagBackupToRepo { try { $BackupRepo = Get-VbrBackupRepoInfo $LocalBackupRepo = Get-VbrBackupRepoInfo | Where-Object { $_.Role -like '*Local' } - $RemoteBackupRepo = Get-VbrBackupRepoInfo | Where-Object { $_.Role -like 'Dedup*' } + $DedupBackupRepo = Get-VbrBackupRepoInfo | Where-Object { $_.Role -like 'Dedup*' } $ObjStorage = Get-VbrBackupObjectRepoInfo $ArchiveObjStorage = Get-VbrBackupArchObjRepoInfo + $NASBackupRepo = Get-VbrBackupRepoInfo | Where-Object { $_.Role -like '*Share' } if ($BackupServerInfo) { if ($BackupRepo) { - SubGraph MainSubGraph -Attributes @{Label = 'Backup Repository'; fontsize = 22; penwidth = 1; labelloc = 't'; style = 'dashed,rounded'; color = $SubGraphDebug.color } { + SubGraph MainSubGraph -Attributes @{Label = 'Backup Repositories'; fontsize = 22; penwidth = 1; labelloc = 't'; style = 'dashed,rounded'; color = $SubGraphDebug.color } { if ($LocalBackupRepo) { - SubGraph LocalRepos -Attributes @{Label = 'Local Repository'; fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { + SubGraph LocalRepos -Attributes @{Label = 'Local Repositories'; fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { # Node used for subgraph centering Node LocalReposDummy @{Label = 'LocalReposDummy'; style = $SubGraphDebug.style; color = $SubGraphDebug.color; shape = 'plain' } if (($LocalBackupRepo | Measure-Object).count -le 3) { @@ -74,23 +75,62 @@ function Get-DiagBackupToRepo { } Edge -From MainSubGraph:s -To LocalReposDummy @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } - if ($RemoteBackupRepo) { + if ($NASBackupRepo) { + SubGraph NasRepos -Attributes @{Label = 'NAS Repositories'; fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { + # Node used for subgraph centering + Node NasReposDummy @{Label = 'NasReposDummy'; style = $SubGraphDebug.style; color = $SubGraphDebug.color; shape = 'plain' } + if (($NASBackupRepo | Measure-Object).count -le 3) { + foreach ($REPOOBJ in ($NASBackupRepo | Sort-Object -Property Name)) { + $REPOHASHTABLE = @{} + $REPOOBJ.psobject.properties | ForEach-Object { $REPOHASHTABLE[$_.Name] = $_.Value } + Node $REPOOBJ -NodeScript { $_.Name } @{Label = $REPOHASHTABLE.Label; fontname = "Segoe Ui" } + } + + Edge -From NasReposDummy -To $NASBackupRepo.Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } + } else { + $Group = Split-array -inArray ($NASBackupRepo | Sort-Object -Property Name) -size 3 + $Number = 0 + while ($Number -ne $Group.Length) { + $Random = Get-Random + SubGraph "NasBackupGroup$($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 } + Node $_.Name @{Label = $REPOHASHTABLE.Label; fontname = "Segoe Ui" } + } + } + $Number++ + } + + Edge -From NasReposDummy -To $Group[0].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } + $Start = 0 + $NasRepoNum = 1 + while ($NasRepoNum -ne $Group.Length) { + Edge -From $Group[$Start].Name -To $Group[$NasRepoNum].Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } + $Start++ + $NasRepoNum++ + } + } + } + Edge -From MainSubGraph:s -To NasReposDummy @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } + } + if ($DedupBackupRepo) { 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 | Measure-Object).count -le 3) { - foreach ($REPOOBJ in ($RemoteBackupRepo | Sort-Object -Property Name)) { + if (($DedupBackupRepo | Measure-Object).count -le 3) { + foreach ($REPOOBJ in ($DedupBackupRepo | Sort-Object -Property Name)) { $REPOHASHTABLE = @{} $REPOOBJ.psobject.properties | ForEach-Object { $REPOHASHTABLE[$_.Name] = $_.Value } Node $REPOOBJ -NodeScript { $_.Name } @{Label = $REPOHASHTABLE.Label; fontname = "Segoe Ui" } } - Edge -From RemoteReposDummy -To $RemoteBackupRepo.Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } + Edge -From RemoteReposDummy -To $DedupBackupRepo.Name @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } else { - $Group = Split-array -inArray ($RemoteBackupRepo | Sort-Object -Property Name) -size 3 + $Group = Split-array -inArray ($DedupBackupRepo | Sort-Object -Property Name) -size 3 $Number = 0 while ($Number -ne $Group.Length) { $Random = Get-Random - SubGraph "RemoteBackupRepo$($Number)_$Random" -Attributes @{Label = ' '; style = $SubGraphDebug.style; color = $SubGraphDebug.color; fontsize = 18; penwidth = 1 } { + SubGraph "DedupBackupRepo$($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 } @@ -114,7 +154,7 @@ function Get-DiagBackupToRepo { } if ($ObjStorage) { - SubGraph ObjectStorage -Attributes @{Label = 'Object Repository'; fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { + SubGraph ObjectStorage -Attributes @{Label = 'Object Repositories'; fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { Node ObjectStorageDummy @{Label = 'ObjectStorageDummy'; style = $SubGraphDebug.style; color = $SubGraphDebug.color; shape = 'plain' } if (($ObjStorage | Measure-Object).count -le 3) { foreach ($STORAGEOBJ in ($ObjStorage | Sort-Object -Property Name)) { @@ -152,7 +192,7 @@ function Get-DiagBackupToRepo { Edge -From MainSubGraph:s -To ObjectStorageDummy @{minlen = 1; style = $EdgeDebug.style; color = $EdgeDebug.color } } if ($ArchiveObjStorage) { - SubGraph ArchiveObjectStorage -Attributes @{Label = 'Archive Object Repository'; fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { + SubGraph ArchiveObjectStorage -Attributes @{Label = 'Archive Object Repositories'; fontsize = 18; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded' } { Node ArchiveObjectStorageDummy @{Label = 'ArchiveObjectStorageDummy'; style = $EdgeDebug.style; color = $EdgeDebug.color; shape = 'plain' } if (($ArchiveObjStorage | Measure-Object).count -le 3) { foreach ($STORAGEArchiveOBJ in ($ArchiveObjStorage | Sort-Object -Property Name)) { @@ -192,7 +232,7 @@ function Get-DiagBackupToRepo { } } - Edge -From $BackupServerInfo.Name -To MainSubGraph @{lhead='clusterMainSubGraph';minlen = 3 } + Edge -From $BackupServerInfo.Name -To MainSubGraph @{minlen = 3 } } } } catch { diff --git a/Src/Private/Get-VbrBackupRepoInfo.ps1 b/Src/Private/Get-VbrBackupRepoInfo.ps1 index 9b65996..ef25279 100644 --- a/Src/Private/Get-VbrBackupRepoInfo.ps1 +++ b/Src/Private/Get-VbrBackupRepoInfo.ps1 @@ -41,15 +41,19 @@ function Get-VbrBackupRepoInfo { if ($Role -like '*Local') { $Rows.add('Server', $BackupRepo.Host.Name.Split('.')[0]) $Rows.add('Path', $BackupRepo.FriendlyPath) - $Rows.add('Total Space', "$(($BackupRepo).GetContainer().CachedTotalSpace.InGigabytes) GB") - $Rows.add('Used Space', "$(($BackupRepo).GetContainer().CachedFreeSpace.InGigabytes) GB") + $Rows.add('Total-Space', "$(($BackupRepo).GetContainer().CachedTotalSpace.InGigabytes) GB") + $Rows.add('Used-Space', "$(($BackupRepo).GetContainer().CachedFreeSpace.InGigabytes) GB") } elseif ($Role -like 'Dedup*') { - $Rows.add('Dedup Type', $BackupRepo.TypeDisplay) - $Rows.add('Total Space', "$(($BackupRepo).GetContainer().CachedTotalSpace.InGigabytes) GB") - $Rows.add('Used Space', "$(($BackupRepo).GetContainer().CachedFreeSpace.InGigabytes) GB") + $Rows.add('DedupType', $BackupRepo.TypeDisplay) + $Rows.add('Total-Space', "$(($BackupRepo).GetContainer().CachedTotalSpace.InGigabytes) GB") + $Rows.add('Used-Space', "$(($BackupRepo).GetContainer().CachedFreeSpace.InGigabytes) GB") + } elseif ($Role -like '*Share') { + $Rows.add('Path', $BackupRepo.FriendlyPath) + $Rows.add('Total-Space', "$(($BackupRepo).GetContainer().CachedTotalSpace.InGigabytes) GB") + $Rows.add('Used-Space', "$(($BackupRepo).GetContainer().CachedFreeSpace.InGigabytes) GB") } - if (($Role -ne 'Dedup Appliances') -and ($Role -ne 'SAN') -and ($BackupRepo.Host.Name -in $ViBackupProxy.Host.Name -or $BackupRepo.Host.Name -in $HvBackupProxy.Host.Name)) { + if (($Role -ne 'Dedup Appliances') -and ($Role -ne 'SAN') -and ($Role -notlike '*Share') -and ($BackupRepo.Host.Name -in $ViBackupProxy.Host.Name -or $BackupRepo.Host.Name -in $HvBackupProxy.Host.Name)) { $BackupType = 'Proxy' } else { $BackupType = $BackupRepo.Type } diff --git a/Src/Private/Images.ps1 b/Src/Private/Images.ps1 index 5a9362d..9354cda 100644 --- a/Src/Private/Images.ps1 +++ b/Src/Private/Images.ps1 @@ -9,6 +9,7 @@ $script:Images = @{ "VBR_Proxy_Server" = "Proxy_Server.png" "VBR_Wan_Accel" = "WAN_accelerator.png" "VBR_SOBR" = "Scale-out_Backup_Repository.png" + "VBR_NAS" = "NAS.png" "VBR_LOGO" = "Veeam_logo.png" "VBR_No_Icon" = "no_icon.png" 'VBR_Storage_NetApp' = "Storage_NetApp.png" diff --git a/Src/Private/SharedUtilsFunctions.ps1 b/Src/Private/SharedUtilsFunctions.ps1 index 1866bd2..30e61d4 100644 --- a/Src/Private/SharedUtilsFunctions.ps1 +++ b/Src/Private/SharedUtilsFunctions.ps1 @@ -33,6 +33,8 @@ function Get-IconType { 'IndividualComputers' { 'VBR_AGENT_IC' } 'ActiveDirectory' { 'VBR_AGENT_AD' } 'CSV' { 'VBR_AGENT_CSV' } + 'CifsShare' {'VBR_NAS'} + 'NfsShare' {'VBR_NAS'} default { 'VBR_No_Icon' } } @@ -60,15 +62,17 @@ function Get-RoleType { 'DDBoost' { 'Dedup Appliances' } 'HPStoreOnceIntegration' { 'Dedup Appliances' } 'ExaGrid' { 'Dedup Appliances' } + 'InfiniGuard' { 'Dedup Appliances' } 'Cloud' { 'Cloud' } 'SanSnapshotOnly' { 'SAN' } "vmware" { 'VMware Backup Proxy' } "hyperv" { 'HyperV Backup Proxy' } "agent" { 'Agent & Files Backup Proxy' } "nas" { 'NAS Backup Proxy' } - default { 'Backup Repository' } + "CifsShare" { 'SMB Share' } + "NfsShare" { 'NFS Share' } + default { 'Unknown' } } - return $RoleType } function ConvertTo-TextYN {