Skip to content

Commit

Permalink
Merge pull request #51 from rebelinux/dev
Browse files Browse the repository at this point in the history
Fix issue with diagramming empty vSphere Cluster
  • Loading branch information
rebelinux authored Nov 13, 2024
2 parents b4a5a02 + d780e91 commit 31e6b29
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 46 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.6.14] - 2024-11-13

### Fixed

- Fix issue with diagramming empty vSphere Cluster


## [0.6.13] - 2024-11-13

### Added
Expand Down
86 changes: 43 additions & 43 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.6.13
Version: 0.6.14
Author: Jonathan Colon
Twitter: @jcolonfzenpr
Github: rebelinux
Expand Down Expand Up @@ -35,56 +35,56 @@ function Get-DiagBackupToViProxy {
Edge $BackupServerInfo.Name -To ViProxies:n @{minlen = 2 }
}

$vSphereObj = Get-VbrBackupvSphereInfo | Sort-Object

# vSphere Graphviz Cluster
$VivCenterNodes = @()
foreach ($vCenter in $vSphereObj | Where-Object {$_.Name -ne '192.168.5.2'}) {
$vCenterNodeArray = @()
$ViClustersNodes = @()
$vCenterNodeArray += $vCenter.Label
try {
$ViClustersChildsNodes = foreach ($ViCluster in $vCenter.Childs) {
if ($ViCluster.EsxiHost.Name) {
Get-DiaHTMLTable -ImagesObj $Images -Rows $ViCluster.EsxiHost.Name -Align 'Center' -ColumnSize 3 -IconDebug $IconDebug -Subgraph -SubgraphIconType "VBR_ESXi_Server" -SubgraphLabel $ViCluster.Name -SubgraphLabelPos "top" -fontColor $Fontcolor -TableStyle "dashed,rounded" -TableBorderColor $Edgecolor -TableBorder "1" -NoFontBold
} else {
Get-DiaHTMLTable -ImagesObj $Images -Rows 'No Esxi Host' -Align 'Center' -ColumnSize 3 -IconDebug $IconDebug -Subgraph -SubgraphIconType "VBR_ESXi_Server" -SubgraphLabel $ViCluster.Name -SubgraphLabelPos "top" -fontColor $Fontcolor -TableStyle "dashed,rounded" -TableBorderColor $Edgecolor -TableBorder "1" -NoFontBold
if ($vSphereObj = Get-VbrBackupvSphereInfo | Sort-Object) {
$VivCenterNodes = @()
foreach ($vCenter in $vSphereObj | Where-Object {$_.Name -ne '192.168.5.2'}) {
$vCenterNodeArray = @()
$ViClustersNodes = @()
$vCenterNodeArray += $vCenter.Label
try {
$ViClustersChildsNodes = foreach ($ViCluster in $vCenter.Childs) {
if ($ViCluster.EsxiHost.Name) {
Get-DiaHTMLTable -ImagesObj $Images -Rows $ViCluster.EsxiHost.Name -Align 'Center' -ColumnSize 3 -IconDebug $IconDebug -Subgraph -SubgraphIconType "VBR_ESXi_Server" -SubgraphLabel $ViCluster.Name -SubgraphLabelPos "top" -fontColor $Fontcolor -TableStyle "dashed,rounded" -TableBorderColor $Edgecolor -TableBorder "1" -NoFontBold
} else {
Get-DiaHTMLTable -ImagesObj $Images -Rows 'No Esxi Host' -Align 'Center' -ColumnSize 3 -IconDebug $IconDebug -Subgraph -SubgraphIconType "VBR_ESXi_Server" -SubgraphLabel $ViCluster.Name -SubgraphLabelPos "top" -fontColor $Fontcolor -TableStyle "dashed,rounded" -TableBorderColor $Edgecolor -TableBorder "1" -NoFontBold
}
}
} catch {
Write-Verbose "Error: Unable to create vSphere Esxi table Objects. Disabling the section"
Write-Debug "Error Message: $($_.Exception.Message)"
}
} catch {
Write-Verbose "Error: Unable to create vSphere Esxi table Objects. Disabling the section"
Write-Debug "Error Message: $($_.Exception.Message)"
}
try {
if ($ViClustersChildsNodes) {
$ViClustersNodes += Get-DiaHTMLSubGraph -ImagesObj $Images -TableArray $ViClustersChildsNodes -Align 'Center' -IconDebug $IconDebug -Label 'vSphere Clusters' -LabelPos "top" -fontColor $Fontcolor -TableStyle "dashed,rounded" -TableBorderColor $Edgecolor -TableBorder "1" -columnSize 3
$vCenterNodeArray += $ViClustersNodes
try {
if ($ViClustersChildsNodes) {
$ViClustersNodes += Get-DiaHTMLSubGraph -ImagesObj $Images -TableArray $ViClustersChildsNodes -Align 'Center' -IconDebug $IconDebug -Label 'vSphere Clusters' -LabelPos "top" -fontColor $Fontcolor -TableStyle "dashed,rounded" -TableBorderColor $Edgecolor -TableBorder "1" -columnSize 3
$vCenterNodeArray += $ViClustersNodes
}
} catch {
Write-Verbose "Error: Unable to create vSphere Clusters Objects. Disabling the section"
Write-Debug "Error Message: $($_.Exception.Message)"
}
} catch {
Write-Verbose "Error: Unable to create vSphere Clusters Objects. Disabling the section"
Write-Debug "Error Message: $($_.Exception.Message)"
}
try {
if ($vCenterNodeArray) {
$VivCenterNodes += Get-DiaHTMLSubGraph -ImagesObj $Images -TableArray $vCenterNodeArray -Align 'Center' -IconDebug $IconDebug -Label 'vCenter Server' -LabelPos "top" -fontColor $Fontcolor -TableStyle "dashed,rounded" -TableBorderColor $Edgecolor -TableBorder "1" -columnSize 1
try {
if ($vCenterNodeArray) {
$VivCenterNodes += Get-DiaHTMLSubGraph -ImagesObj $Images -TableArray $vCenterNodeArray -Align 'Center' -IconDebug $IconDebug -Label 'vCenter Server' -LabelPos "top" -fontColor $Fontcolor -TableStyle "dashed,rounded" -TableBorderColor $Edgecolor -TableBorder "1" -columnSize 1
}
} catch {
Write-Verbose "Error: Unable to create vCenter Server Objects. Disabling the section"
Write-Debug "Error Message: $($_.Exception.Message)"
}
} catch {
Write-Verbose "Error: Unable to create vCenter Server Objects. Disabling the section"
Write-Debug "Error Message: $($_.Exception.Message)"
}
}

if ($VivCenterNodes) {
try {
$ViClustersSubgraphNode = Node -Name "ViCluster" -Attributes @{Label = (Get-DiaHTMLSubGraph -ImagesObj $Images -TableArray $VivCenterNodes -Align 'Center' -IconDebug $IconDebug -IconType 'VBR_vSphere' -Label 'VMware vSphere Infrastructure' -LabelPos "top" -fontColor $Fontcolor -TableStyle "dashed,rounded" -TableBorderColor $Edgecolor -TableBorder "1" -columnSize 3); shape = 'plain'; fillColor = 'transparent'; fontsize = 14; fontname = "Segoe Ui" }
} catch {
Write-Verbose "Error: Unable to create ViCluster Objects. Disabling the section"
Write-Debug "Error Message: $($_.Exception.Message)"
}
if ($VivCenterNodes) {
try {
$ViClustersSubgraphNode = Node -Name "ViCluster" -Attributes @{Label = (Get-DiaHTMLSubGraph -ImagesObj $Images -TableArray $VivCenterNodes -Align 'Center' -IconDebug $IconDebug -IconType 'VBR_vSphere' -Label 'VMware vSphere Infrastructure' -LabelPos "top" -fontColor $Fontcolor -TableStyle "dashed,rounded" -TableBorderColor $Edgecolor -TableBorder "1" -columnSize 3); shape = 'plain'; fillColor = 'transparent'; fontsize = 14; fontname = "Segoe Ui" }
} catch {
Write-Verbose "Error: Unable to create ViCluster Objects. Disabling the section"
Write-Debug "Error Message: $($_.Exception.Message)"
}

if ($ViClustersSubgraphNode) {
$ViClustersSubgraphNode
Edge ViProxies -To ViCluster @{minlen = 2 }
if ($ViClustersSubgraphNode) {
$ViClustersSubgraphNode
Edge ViProxies -To ViCluster @{minlen = 2 }
}
}
}
}
Expand Down
11 changes: 9 additions & 2 deletions Src/Private/Get-VbrBackupvSphereInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ function Get-VbrBackupvSphereInfo {
$HyObjsInfo = @()
if ($HyObjs) {
foreach ($HyObj in $HyObjs) {
$ESXis = Find-VBRViEntity -Server $HyObj | Where-Object { ($_.type -eq "esx") }
$ESXis = try { Find-VBRViEntity -Server $HyObj | Where-Object { ($_.type -eq "esx") } } catch {
Write-Verbose -Message $_.Exception.Message
}
$Rows = @{
IP = Get-NodeIP -Hostname $HyObj.Info.DnsName
Version = $HyObj.Info.ViVersion
Expand All @@ -37,7 +39,12 @@ function Get-VbrBackupvSphereInfo {
Label = Get-DiaNodeIcon -Name $HyObj.Name -IconType "VBR_vCenter_Server" -Align "Center" -Rows $Rows -ImagesObj $Images -IconDebug $IconDebug
AditionalInfo = $Rows
Childs = & {
foreach ($Cluster in (Find-VBRViEntity -Server $HyObj | Where-Object { ($_.type -eq "cluster") }) ) {
$VIClusters = try {
(Find-VBRViEntity -Server $HyObj | Where-Object { ($_.type -eq "cluster") })
} catch {
Write-Verbose -Message $_.Exception.Message
}
foreach ($Cluster in $VIClusters) {
[PSCustomObject]@{
Name = $Cluster.Name
Label = Get-DiaNodeIcon -Name $Esxi.Name -IconType "VBR_vSphere_Cluster" -Align "Center" -Rows $Rows -ImagesObj $Images -IconDebug $IconDebug
Expand Down
2 changes: 1 addition & 1 deletion 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.6.13'
ModuleVersion = '0.6.14'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down

0 comments on commit 31e6b29

Please sign in to comment.