Add new fabric validation test and misc fixes for Start-SdnDataCollection (#177)

* add test for scheduled task

* save changes

* save changes

* reduce noise generated

* fix type

* fix logic processing, update child path, pickup trace log

* add summary, change folder name
This commit is contained in:
Adam Rudell 2023-04-04 20:48:49 -05:00 коммит произвёл GitHub
Родитель 83663322ed
Коммит d01be14567
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 82 добавлений и 11 удалений

Просмотреть файл

@ -105,7 +105,8 @@ function Start-SdnDataCollection {
}
}
[System.IO.FileInfo]$OutputDirectory = Join-Path -Path $OutputDirectory.FullName -ChildPath (Get-FormattedDateTimeUTC)
[System.String]$childPath = 'SdnDataCollection_{0}' -f (Get-FormattedDateTimeUTC)
[System.IO.FileInfo]$OutputDirectory = Join-Path -Path $OutputDirectory.FullName -ChildPath $childPath
[System.IO.FileInfo]$workingDirectory = (Get-WorkingDirectory)
[System.IO.FileInfo]$tempDirectory = "$(Get-WorkingDirectory)\Temp"
@ -178,6 +179,19 @@ function Start-SdnDataCollection {
# ensure SdnDiagnostics installed across the data nodes and versions are the same
Install-SdnDiagnostics -ComputerName $dataCollectionNodes.Name -ErrorAction Stop
# collect control plane information without regardless of roles defined
$slbStateInfo = Get-SdnSlbStateInformation -NcUri $sdnFabricDetails.NcUrl -Credential $NcRestCredential
$slbStateInfo | ConvertTo-Json -Depth 100 | Out-File "$($OutputDirectory.FullName)\SlbState.Json"
Invoke-SdnResourceDump -NcUri $sdnFabricDetails.NcUrl -OutputDirectory $OutputDirectory.FullName -Credential $NcRestCredential
Get-SdnNetworkControllerState -NetworkController $NetworkController -OutputDirectory $OutputDirectory.FullName -Credential $Credential -NcRestCredential $NcRestCredential
Get-SdnNetworkControllerClusterInfo -NetworkController $NetworkController -OutputDirectory $OutputDirectory.FullName -Credential $Credential
$debugInfraHealthResults = Get-SdnFabricInfrastructureResult
if ($debugInfraHealthResults) {
$debugInfraHealthResults.Values | Export-ObjectToFile -FilePath $OutputDirectory.FullName -Name 'Get-SdnFabricInfrastructureResult_Summary' -FileType 'txt' -Format 'table'
$debugInfraHealthResults | Export-ObjectToFile -FilePath $OutputDirectory.FullName -Name 'Get-SdnFabricInfrastructureResult' -FileType 'json'
}
# enumerate through each role and collect appropriate data
foreach ($group in $groupedObjectsByRole | Sort-Object -Property Name) {
if ($PSCmdlet.ParameterSetName -eq 'Role') {
if ($group.Group.Name.Count -ge $Limit) {
@ -197,12 +211,6 @@ function Start-SdnDataCollection {
# to account for if filtering was applied
$filteredDataCollectionNodes += $dataNodes
$slbStateInfo = Get-SdnSlbStateInformation -NcUri $sdnFabricDetails.NcUrl -Credential $NcRestCredential
$slbStateInfo | ConvertTo-Json -Depth 100 | Out-File "$($OutputDirectory.FullName)\SlbState.Json"
Invoke-SdnResourceDump -NcUri $sdnFabricDetails.NcUrl -OutputDirectory $OutputDirectory.FullName -Credential $NcRestCredential
Get-SdnNetworkControllerState -NetworkController $NetworkController -OutputDirectory $OutputDirectory.FullName -Credential $Credential -NcRestCredential $NcRestCredential
Get-SdnNetworkControllerClusterInfo -NetworkController $NetworkController -OutputDirectory $OutputDirectory.FullName -Credential $Credential
"Collect configuration state details for {0} nodes: {1}" -f $group.Name, ($dataNodes -join ', ') | Trace-Output
switch ($group.Name) {
'Gateway' {
@ -322,7 +330,8 @@ function Start-SdnDataCollection {
"Performing cleanup of {0} directory across {1}" -f $tempDirectory.FullName, ($filteredDataCollectionNodes -join ', ') | Trace-Output
Clear-SdnWorkingDirectory -Path $tempDirectory.FullName -Recurse -ComputerName $filteredDataCollectionNodes -Credential $Credential
"Data collection completed" | Trace-Output
Copy-Item -Path (Get-TraceOutputFile) -Destination $OutputDirectory.FullName
"`Data collection completed. Logs have been saved to {0}" -f $OutputDirectory.FullName | Trace-Output -Level:Success
}
catch {
"{0}`n{1}" -f $_.Exception, $_.ScriptStackTrace | Trace-Output -Level:Error

Просмотреть файл

@ -34,12 +34,12 @@ function Test-EncapOverhead {
"[{0}] {1}" -f $object.Name, ($interface | Out-String -Width 4096) | Trace-Output -Level:Verbose
if($interface.EncapOverheadEnabled -eq $false -or $interface.EncapOverheadValue -lt $encapOverheadExpectedValue){
"EncapOverhead settings for {0} on {1} are disabled or not configured correctly" -f $interface.NetworkInterface, $object.Name | Trace-Output -Level:Warning
"EncapOverhead settings for {0} on {1} are disabled or not configured correctly" -f $interface.NetworkInterface, $object.Name | Trace-Output -Level:Verbose
$encapDisabled = $true
}
if($interface.JumboPacketEnabled -eq $false -or $interface.JumboPacketValue -lt $jumboPacketExpectedValue){
"JumboPacket settings for {0} on {1} are disabled or not configured correctly" -f $interface.NetworkInterface, $object.Name | Trace-Output -Level:Warning
"JumboPacket settings for {0} on {1} are disabled or not configured correctly" -f $interface.NetworkInterface, $object.Name | Trace-Output -Level:Verbose
$jumboPacketDisabled = $true
}
@ -47,6 +47,7 @@ function Test-EncapOverhead {
# and as such, environment would experience intermittent packet loss
if ($encapDisabled -and $jumboPacketDisabled) {
$sdnHealthObject.Result = 'FAIL'
"EncapOverhead and JumboPacket for interface {0} on {1} are disabled or not configured correctly." -f $interface.NetworkInterface, $object.Name | Trace-Output -Level:Exception
}
$array += $interface

Просмотреть файл

@ -50,7 +50,7 @@ function Test-ProviderNetwork {
# if standard MTU was success but jumbo MTU was failure, indication that jumbo packets or encap overhead has not been setup and configured
# either on the physical nic or within the physical switches between the provider addresses
if($jumboPacketResult.Status -ieq 'Failure' -and $standardPacketResult.Status -ieq 'Success'){
$sdnHealthObject.Remediation = "Ensure physical switch ports and network interfaces support 1660 byte payload using Jumbo Packets or EncapOverhead"
$sdnHealthObject.Remediation = "Ensure physical switches and network interfaces support 1660 byte payload using Jumbo Packets or EncapOverhead"
"Cannot send jumbo packets to {0} from {1} ({2})." `
-f $destinationAddress[0].DestinationAddress, $computer.Name, $destinationAddress[0].SourceAddress | Trace-Output -Level:Exception
}

Просмотреть файл

@ -0,0 +1,57 @@
function Test-ScheduledTaskEnabled {
<#
.SYNOPSIS
Ensures the scheduled task responsible for etl compression is enabled and running
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[SdnFabricHealthObject]$SdnEnvironmentObject,
[Parameter(Mandatory = $false)]
[System.Management.Automation.PSCredential]
[System.Management.Automation.Credential()]
$Credential = [System.Management.Automation.PSCredential]::Empty
)
$sdnHealthObject = [SdnHealth]::new()
$array = @()
$scriptBlock = {
try {
$result = Get-ScheduledTask -TaskName 'SDN Diagnostics Task' -ErrorAction Stop
return [PSCustomObject]@{
TaskName = $result.TaskName
State = $result.State.ToString()
}
}
catch {
return [PSCustomObject]@{
TaskName = 'SDN Diagnostics Task'
State = 'Not Available'
}
}
}
try {
$scheduledTaskReady = Invoke-PSRemoteCommand -ComputerName $SdnEnvironmentObject.ComputerName -Credential $Credential -ScriptBlock $scriptBlock -AsJob -PassThru
foreach ($result in $scheduledTaskReady) {
if ($result.State -ine 'Ready' -and $result.State -ine 'Running') {
"SDN Diagnostics Task state is {0} on {1}, which may result in uncontrolled log growth" -f $result.State, $result.PSComputerName | Trace-Output -Level:Exception
$sdnHealthObject.Result = 'FAIL'
}
$array += [PSCustomObject]@{
State = $result.State
Computer = $result.PSComputerName
}
}
$sdnHealthObject.Properties = $array
return $sdnHealthObject
}
catch {
"{0}`n{1}" -f $_.Exception, $_.ScriptStackTrace | Trace-Output -Level:Error
}
}

Просмотреть файл

@ -112,6 +112,7 @@ function Debug-SdnFabricInfrastructure {
Gateway = @(
Test-ResourceConfigurationState @restApiParams
Test-ServiceState @computerCredParams
Test-ScheduledTaskEnabled @computerCredParams
)
}
}
@ -121,6 +122,7 @@ function Debug-SdnFabricInfrastructure {
LoadBalancerMux = @(
Test-ResourceConfigurationState @restApiParams
Test-ServiceState @computerCredParams
Test-ScheduledTaskEnabled @computerCredParams
)
}
}
@ -131,6 +133,7 @@ function Debug-SdnFabricInfrastructure {
Test-ServiceState @computerCredParams
Test-ServiceFabricPartitionDatabaseSize @computerCredParams
Test-NetworkInterfaceAPIDuplicateMacAddress @restApiParams
Test-ScheduledTaskEnabled @computerCredParams
)
}
}
@ -146,6 +149,7 @@ function Debug-SdnFabricInfrastructure {
Test-VfpDuplicatePort @computerCredParams
Test-VMNetAdapterDuplicateMacAddress @computerCredParams
Test-HostRootStoreNonRootCert @computerCredParams
Test-ScheduledTaskEnabled @computerCredParams
)
}
}