manifests/collectors/Monitor/Outages.psd1
|
# # GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Monitor/Outages.ps1 (AB#5660). # Field expressions are copied verbatim from the original collector and evaluate in an # equivalent scope -- see docs/design/decisions/declarative-collectors.md. # Review before trusting; regenerate rather than hand-patch if the source collector changes. # @{ ResourceTypes = @( 'AZSC/Monitor/Outage' ) ResourceTypeMatching = 'Grouped' AdditionalFilter = $null FilterPreamble = '' RowLoopVariable = '1' Preamble = @' $SourceOutage = $1.properties.SourceResource $ImpactedSubs = $SourceOutage.properties.impact.impactedRegions.impactedSubscriptions | Select-Object -Unique $ResUCount = 1 $Data = $SourceOutage.properties $DescriptionSections = $1.properties.DescriptionSections '@ AdditionalRowLoops = @( @{ Variable = 'Sub0' Source = '$ImpactedSubs' # AB#6845: the loop exists ONLY to resolve the 'Subscription' column -- every other # column (outage id, title, status, timings, and the five post-incident narrative # sections) comes from the outage itself. An outage whose payload carries no # impactedSubscriptions therefore lost the entire incident record to save one cell. # The collector already emits blank-subscription rows for out-of-scope subscription # ids, so a blank cell here is the shape the sheet already has. EmitNullWhenEmpty = $true Preamble = @' $sub1 = $SUB | Where-Object { $_.id -eq $Sub0 } # AB#6845: `[datetime]$null` throws "Cannot convert null to type # System.DateTime" and takes the whole Outages worksheet with it. An # ongoing incident legitimately has NO impactMitigationTime -- it has not # been mitigated yet -- which is the outage a reader most wants to see. # Before this loop emitted a row for an outage with no impacted # subscriptions, that outage was dropped silently and the throw was never # reached; now that it is reached, both casts have to be guarded. $StartTime = Get-AZSCSafeProperty -InputObject $Data -Path 'impactStartTime' $StartTime = if ($StartTime) { ([datetime]$StartTime).ToString("yyyy-MM-dd HH:mm") } else { $null } $Mitigation = Get-AZSCSafeProperty -InputObject $Data -Path 'impactMitigationTime' $Mitigation = if ($Mitigation) { ([datetime]$Mitigation).ToString("yyyy-MM-dd HH:mm") } else { $null } $ImpactedService = if (@($SourceOutage.properties.impact.impactedService).count -gt 1) { $SourceOutage.properties.impact.impactedService | ForEach-Object { $_ + ' ,' } }else { $SourceOutage.properties.impact.impactedService} $ImpactedService = [string]$ImpactedService $ImpactedService = if ($ImpactedService -like '* ,*') { $ImpactedService -replace ".$" }else { $ImpactedService } '@ } ) TagLoop = $null Fields = @( @{ Name = 'ID' Expression = '$SourceOutage.id' } @{ Name = 'Subscription' Expression = '(Get-AZSCSafeProperty -InputObject $sub1 -Path ''name'')' } @{ Name = 'Outage ID' Expression = '(Get-AZSCSafeProperty -InputObject $SourceOutage -Path ''name'')' } @{ Name = 'Event Type' Expression = '$Data.eventType' } @{ Name = 'Status' Expression = '$Data.status' } @{ Name = 'Event Level' Expression = '$Data.eventlevel' } @{ Name = 'Title' Expression = '$Data.title' } @{ Name = 'Impact Start Time' Expression = '$StartTime' } @{ Name = 'Impact Mitigation Time' Expression = '$Mitigation' } @{ Name = 'Impacted Services' Expression = '$ImpactedService' } @{ Name = 'What happened' Expression = '$DescriptionSections.''What happened''' } @{ Name = 'What went wrong and why' Expression = '$DescriptionSections.''What went wrong and why''' } @{ Name = 'How did we respond' Expression = '$DescriptionSections.''How did we respond''' } @{ Name = 'How are we making incidents like this less likely or less impactful' Expression = '$DescriptionSections.''How are we making incidents like this less likely or less impactful''' } @{ Name = 'How can customers make incidents like this less impactful' Expression = '$DescriptionSections.''How can customers make incidents like this less impactful''' } @{ Name = 'Resource U' Expression = '$ResUCount' } ) Export = @{ WorksheetName = 'Outages' TableNamePrefix = 'OutageTab_' Columns = @( 'Subscription' 'Outage ID' 'Event Type' 'Status' 'Event Level' 'Title' 'Impact Start Time' 'Impact Mitigation Time' 'Impacted Services' 'What happened' 'What went wrong and why' 'How did we respond' 'How are we making incidents like this less likely or less impactful' 'How can customers make incidents like this less impactful' ) TagColumns = @() TagColumnsBefore = $null NumberFormat = '0' ConditionalText = @() } SourceCollector = 'Modules/Public/InventoryModules/Monitor/Outages.ps1' } |