Skip to content

Commit 42ba118

Browse files
committed
vSAN section fix, updated vCenter Alarms
1 parent 5a2992c commit 42ba118

File tree

6 files changed

+102
-49
lines changed

6 files changed

+102
-49
lines changed

AsBuiltReport.VMware.vSphere.Style.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ Style -Name 'Normal' -Size 10 -Color '565656' -Default
1616
Style -Name 'TOC' -Size 16 -Color '006A91'
1717
Style -Name 'TableDefaultHeading' -Size 10 -Color 'FAFAFA' -BackgroundColor '485969'
1818
Style -Name 'TableDefaultRow' -Size 10 -Color '565656'
19-
Style -Name 'Critical' -Size 10 -BackgroundColor 'F5DBD9'
20-
Style -Name 'Warning' -Size 10 -BackgroundColor 'FEF3B5'
21-
Style -Name 'Info' -Size 10 -BackgroundColor 'E1F1F6'
22-
Style -Name 'OK' -Size 10 -BackgroundColor 'DFF0D0'
19+
Style -Name 'Critical' -Size 10 -Color '565656' -BackgroundColor 'F5DBD9'
20+
Style -Name 'Warning' -Size 10 -Color '565656' -BackgroundColor 'FEF3B5'
21+
Style -Name 'Info' -Size 10 -Color '565656' -BackgroundColor 'E1F1F6'
22+
Style -Name 'OK' -Size 10 -Color '565656' -BackgroundColor 'DFF0D0'
2323

2424
# Configure Table Styles
2525
$TableDefaultProperties = @{

AsBuiltReport.VMware.vSphere.json

58 Bytes
Binary file not shown.

AsBuiltReport.VMware.vSphere.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'AsBuiltReport.VMware.vSphere.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.1.3'
15+
ModuleVersion = '1.1.4'
1616

1717
# Supported PSEditions
1818
CompatiblePSEditions = 'Desktop'

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# VMware vSphere As Built Report Changelog
22

3+
## [Unreleased]
4+
### Added
5+
- vCenter Server database version
6+
- vCenter Server advanced system settings
7+
- vCenter Server alarm health check
8+
- Basic VM storage policy reporting
9+
10+
### Changed
11+
- Enhanced vCenter alarm reporting
12+
13+
### Fixed
14+
- Section error with vSAN InfoLevel 4 or above
15+
- Corrected text color for highlighted cells in default VMware style
16+
317
## [1.1.3 - 2020-02-04]
418
### Added
519
- Added vCenter Server certificate information (Fix #31)
@@ -26,7 +40,7 @@
2640
- Updated report JSON structure & default settings. A new report JSON must be generated for this release, use `New-AsBuiltReportConfig -Report VMware.vSphere -Path <path> -Overwrite`.
2741
- Updated README with minimum required privileges to generate a VMware vSphere As Built Report. Full administrator privileges should no longer be required.
2842

29-
## Fixed
43+
### Fixed
3044
- Resolved issue with VMHost PCI device reporting (Fix #33)
3145
- Resolved issue with reporting of ESXi boot device size (Fix #65)
3246
- Resolved issue with vSphere licensing (Fix #68 & #69)

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ The VMware vSphere As Built Report supports the following vSphere versions;
4545
- vSphere 6.7
4646

4747
## Pre-requisites
48-
The following PowerShell modules are required for generating a VMware vSphere As Built report.
48+
Windows PowerShell 5.1 and the following PowerShell modules are required for generating a VMware vSphere As Built report. PowerShell Core is not currently supported.
4949

5050
Each of these modules can be easily downloaded and installed via the PowerShell Gallery
5151

@@ -142,6 +142,7 @@ The **vCenter** sub-schema is used to configure health checks for vCenter Server
142142
| ------ | ---------- | ------- | ----------- | --------- |
143143
| vCenter | Mail | true / false | Highlights mail settings which are not configured | ![Critical](https://placehold.it/15/FFB38F/000000?text=+) Not Configured
144144
| vCenter | Licensing | true / false | Highlights product evaluation licenses | ![Warning](https://placehold.it/15/FFE860/000000?text=+) Product evaluation license in use
145+
| vCenter | Alarms | true / false | Highlights vCenter Server alarms which are disabled | ![Warning](https://placehold.it/15/FFE860/000000?text=+) Alarm disabled
145146

146147
#### Cluster
147148
The **Cluster** sub-schema is used to configure health checks for vSphere Clusters.

Src/Public/Invoke-AsBuiltReport.VMware.vSphere.ps1

Lines changed: 80 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ function Invoke-AsBuiltReport.VMware.vSphere {
55
.DESCRIPTION
66
Documents the configuration of VMware vSphere infrastucture in Word/HTML/XML/Text formats using PScribo.
77
.NOTES
8-
Version: 1.1.3
8+
Version: 1.1.4
99
Author: Tim Carman
1010
Twitter: @tpcarman
1111
Github: tpcarman
1212
Credits: Iain Brighton (@iainbrighton) - PScribo module
13-
1413
.LINK
1514
https://github.com/AsBuiltReport/AsBuiltReport.VMware.vSphere
1615
#>
@@ -453,15 +452,15 @@ function Invoke-AsBuiltReport.VMware.vSphere {
453452
}
454453

455454
Function Get-PciDeviceDetail {
456-
<#
455+
<#
457456
.SYNOPSIS
458457
Helper function to return PCI Devices Drivers & Firmware information for a specific host.
459458
.PARAMETER Server
460459
vCenter VISession object.
461460
.PARAMETER esxcli
462461
Esxcli session object associated to the host.
463462
.EXAMPLE
464-
$Credentials = Get-Crendentials
463+
$Credentials = Get-Credential
465464
$Server = Connect-VIServer -Server vcenter01.example.com -Credentials $Credentials
466465
$VMHost = Get-VMHost -Server $Server -Name esx01.example.com
467466
$esxcli = Get-EsxCli -Server $Server -VMHost $VMHost -V2
@@ -683,6 +682,7 @@ function Invoke-AsBuiltReport.VMware.vSphere {
683682
Section -Style Heading3 'Database Settings' {
684683
$vCenterDbInfo = [PSCustomObject]@{
685684
'Database Type' = $TextInfo.ToTitleCase(($vCenterAdvSettings | Where-Object { $_.name -eq 'config.vpxd.odbc.dbtype' }).Value)
685+
'Database Version' = $TextInfo.ToTitleCase(($vCenterAdvSettings | Where-Object { $_.name -eq 'config.vpxd.odbc.dbversion' }).Value)
686686
'Data Source Name' = ($vCenterAdvSettings | Where-Object { $_.name -eq 'config.vpxd.odbc.dsn' }).Value
687687
'Maximum Database Connection' = ($vCenterAdvSettings | Where-Object { $_.name -eq 'VirtualCenter.MaxDBConnection' }).Value
688688
}
@@ -767,8 +767,7 @@ function Invoke-AsBuiltReport.VMware.vSphere {
767767
$Tags = Get-Tag -Server $vCenter
768768
if ($Tags) {
769769
Section -Style Heading3 'Tags' {
770-
$Tags = $Tags | Select-Object Name, Description, Category
771-
$Tags | Sort-Object Name, Category | Table -Name 'Tags'
770+
$Tags | Sort-Object Name, Category | Table -Name 'Tags' -Columns Name, Description, Category
772771
}
773772
}
774773
#endregion vCenter Server Tags
@@ -787,41 +786,88 @@ function Invoke-AsBuiltReport.VMware.vSphere {
787786
$TagAssignments = Get-TagAssignment -Server $vCenter
788787
if ($TagAssignments) {
789788
Section -Style Heading3 'Tag Assignments' {
790-
$TagAssignments = $TagAssignments | Select-Object Tag, Entity
791-
$TagAssignments | Sort-Object Tag, Entity | Table -Name 'Tag Assignments' -ColumnWidths 50, 50
789+
$TagAssignments | Sort-Object Tag, Entity | Table -Name 'Tag Assignments' -Columns Tag, Entity -ColumnWidths 50, 50
792790
}
793791
}
794792
#endregion vCenter Server Tag Assignments
793+
794+
#region VM Storage Policies
795+
$SpbmStoragePolicies = Get-SpbmStoragePolicy | Sort-Object Name
796+
if ($SpbmStoragePolicies) {
797+
Section -Style Heading3 'VM Storage Policies' {
798+
$VmStoragePolicies = foreach ($SpbmStoragePolicy in $SpbmStoragePolicies) {
799+
[PSCustomObject]@{
800+
'VM Storage Policy' = $SpbmStoragePolicy.Name
801+
'Description' = $SpbmStoragePolicy.Description
802+
}
803+
}
804+
$VmStoragePolicies | Table -Name 'VM Storage Policies' -ColumnWidths 50, 50
805+
}
806+
}
807+
#endregion VM Storage Policies
795808
}
796809
#endregion vCenter Server Detailed Information
797810

798-
#region vCenter Alarms (Comprehensive Information)
799-
if ($InfoLevel.vCenter -ge 5) {
811+
#region vCenter Server Advanced Detail Information
812+
if ($InfoLevel.vCenter -ge 4) {
813+
#region vCenter Alarms
800814
Section -Style Heading3 'Alarms' {
801-
Paragraph ("The following table details the configuration of the vCenter Server " +
802-
"alarms for $vCenterServerName.")
803-
BlankLine
804-
$AlarmAction = Get-AlarmAction -Server $vCenter
805-
$AlarmActions = foreach ($Action in $AlarmAction) {
806-
[PSCustomObject]@{
807-
'Alarm Name' = $Action.AlarmDefinition
808-
'Enabled' = Switch ($Action.AlarmDefinition.Enabled) {
809-
$true { 'Enabled' }
810-
$false { 'Disabled' }
811-
}
812-
'Defined In' = $Action.AlarmDefinition.Entity
813-
'Action Type' = Switch ($Action.ActionType) {
814-
'SendSNMP' { 'Send SNMP traps' }
815-
'SendEmail' { 'Send email notifications' }
816-
'ExecuteScript' { 'Run Script' }
815+
$Alarms = Get-AlarmDefinition -PipelineVariable alarm | ForEach-Object -Process {
816+
Get-AlarmAction -AlarmDefinition $_ -PipelineVariable action | ForEach-Object -Process {
817+
Get-AlarmActionTrigger -AlarmAction $_ |
818+
Select-Object @{N = 'Alarm'; E = { $alarm.Name } },
819+
@{N = 'Description'; E = { $alarm.Description } },
820+
@{N = 'Enabled'; E = { Switch ($alarm.Enabled) {
821+
$true { 'Enabled' }
822+
$false { 'Disabled' }
823+
} }
824+
},
825+
@{N = 'Entity'; E = { $alarm.Entity.Type } },
826+
@{N = 'Trigger'; E = {
827+
"{0}:{1}->{2} (Repeat={3})" -f $action.ActionType,
828+
$_.StartStatus,
829+
$_.EndStatus,
830+
$_.Repeat
831+
}
832+
},
833+
@{N = 'Trigger Info'; E = { Switch ($action.ActionType) {
834+
'SendEmail' {
835+
"To: $($action.To -join ', ') `
836+
Cc: $($action.Cc -join ', ') `
837+
Subject: $($action.Subject) `
838+
Body: $($action.Body)"
839+
}
840+
'ExecuteScript' {
841+
"$($action.ScriptFilePath)"
842+
}
843+
default { '--' }
844+
}
845+
}
817846
}
818-
'Trigger' = $Action.Trigger -join [Environment]::NewLine
819847
}
820848
}
821-
$AlarmActions | Sort-Object 'Alarm Name' | Table -Name 'Alarm Actions' #-ColumnWidths 50, 20, 30
849+
if ($Healthcheck.vCenter.Alarms) {
850+
$Alarms | Where-Object { $_.'Enabled' -eq 'Disabled' } | Set-Style -Style Warning -Property 'Enabled'
851+
}
852+
if ($InfoLevel.vCenter -ge 5) {
853+
$Alarms | Sort-Object 'Alarm', 'Trigger' | Table -Name 'Alarms' -List -ColumnWidths 25, 75
854+
} else {
855+
$Alarms | Sort-Object 'Alarm', 'Trigger' | Table -Name 'Alarms' -Columns 'Alarm', 'Description', 'Enabled', 'Entity', 'Trigger'
856+
}
857+
}
858+
#endregion vCenter Alarms
859+
}
860+
#endregion vCenter Server Advanced Detail Information
861+
862+
#region vCenter Server Comprehensive Information
863+
if ($InfoLevel.vCenter -ge 5) {
864+
#region vCenter Advanced System Settings
865+
Section -Style Heading3 'Advanced System Settings' {
866+
$vCenterAdvSettings | Sort-Object Name | Table -Name 'vCenter Advanced System Settings' -Columns 'Name', 'Value' -ColumnWidths 50, 50
822867
}
868+
#endregion vCenter Advanced System Settings
823869
}
824-
#endregion vCenter Alarms (Comprehensive Information)
870+
#endregion vCenter Server Comprehensive Information
825871
}
826872
}
827873
#endregion vCenter Server Section
@@ -2069,9 +2115,9 @@ function Invoke-AsBuiltReport.VMware.vSphere {
20692115
Section -Style Heading5 'Storage Adapters' {
20702116
Paragraph "The following section details the storage adapter configuration for $VMHost."
20712117
foreach ($VMHostHba in $VMHostHbas) {
2072-
$Target = ((Get-View $VMHostHba.VMhost).Config.StorageDevice.ScsiTopology.Adapter | Where-Object {$_.Adapter -eq $VMHostHba.Key}).Target
2118+
$Target = ((Get-View $VMHostHba.VMhost).Config.StorageDevice.ScsiTopology.Adapter | Where-Object { $_.Adapter -eq $VMHostHba.Key }).Target
20732119
$LUNs = Get-ScsiLun -Hba $VMHostHba -LunType "disk" -ErrorAction SilentlyContinue
2074-
$Paths = ($Target | foreach {$_.Lun.Count} | Measure-Object -Sum)
2120+
$Paths = ($Target | foreach { $_.Lun.Count } | Measure-Object -Sum)
20752121
Section -Style Heading5 "$($VMHostHba.Device)" {
20762122
$VMHostStorageAdapter = [PSCustomObject]@{
20772123
'Adapter' = $VMHostHba.Device
@@ -2397,7 +2443,7 @@ function Invoke-AsBuiltReport.VMware.vSphere {
23972443
#region Section Standard Virtual Switches
23982444
Section -Style Heading5 'Standard Virtual Switches' {
23992445
Paragraph "The following section details the standard virtual switch configuration for $VMHost."
2400-
Blankline
2446+
BlankLine
24012447
$VSSwitchNicTeaming = $VSSwitches | Get-NicTeamingPolicy
24022448
#region ESXi Host Standard Virtual Switch Properties
24032449
$VSSProperties = foreach ($VSSwitchNicTeam in $VSSwitchNicTeaming) {
@@ -3186,6 +3232,7 @@ function Invoke-AsBuiltReport.VMware.vSphere {
31863232
}
31873233

31883234
Section -Style Heading4 'Disks' {
3235+
##ToDo: InfoLevel 4
31893236
$vDisks = foreach ($Disk in $VsanDisk) {
31903237
[PSCustomObject]@{
31913238
'Disk' = $Disk.Name
@@ -3206,16 +3253,7 @@ function Invoke-AsBuiltReport.VMware.vSphere {
32063253
}
32073254
}
32083255
$vDisks = $vDisks | Sort-Object 'Host', 'Disk Group', 'Disk Tier'
3209-
if ($InfoLevel.vSAN -ge 4) {
3210-
<#
3211-
foreach ($vDisk in ($vDisks)) {
3212-
Section -Style Heading4 $vDisk.Host {
3213-
}
3214-
}
3215-
#>
3216-
} else {
3217-
$vDisks | Select-Object 'Disk', 'Disk Group', 'Disk Type', 'Disk Tier', 'Capacity GB', 'Host' | Table -Name 'vSAN Disks'
3218-
}
3256+
$vDisks | Select-Object 'Disk', 'Disk Group', 'Disk Type', 'Disk Tier', 'Capacity GB', 'Host' | Table -Name 'vSAN Disks'
32193257
}
32203258

32213259
$VsanIscsiTargets = Get-VsanIscsiTarget -Cluster $VsanCluster.Cluster -ErrorAction SilentlyContinue

0 commit comments

Comments
 (0)