manifests/collectors/Monitor/AutoscaleSettings.psd1
|
# # GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Monitor/AutoscaleSettings.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 = @( 'microsoft.insights/autoscalesettings' ) ResourceTypeMatching = 'Grouped' AdditionalFilter = $null FilterPreamble = '' RowLoopVariable = '1' Preamble = @' $ResUCount = 1 $sub1 = $SUB | Where-Object { $_.Id -eq $1.subscriptionId } $data = $1.PROPERTIES $Tags = if (![string]::IsNullOrEmpty($1.tags.psobject.properties)) { $1.tags.psobject.properties } else { '0' } # Target resource $targetId = if ($data.targetResourceUri) { $data.targetResourceUri } else { 'N/A' } $targetName = if ($targetId -ne 'N/A') { ($targetId -split '/')[-1] } else { 'N/A' } $targetLoc = if ($data.targetResourceLocation) { $data.targetResourceLocation } else { 'N/A' } # Profiles summary $profileCount = if ($data.profiles) { @($data.profiles).Count } else { 0 } $profileNames = if ($data.profiles) { (@($data.profiles) | ForEach-Object { $_.name }) -join '; ' } else { '' } # Capacity across all profiles (use first/default profile) $defaultProfile = if ($data.profiles) { @($data.profiles)[0] } else { $null } $capacityMin = if ($defaultProfile -and $defaultProfile.capacity) { $defaultProfile.capacity.minimum } else { 'N/A' } $capacityMax = if ($defaultProfile -and $defaultProfile.capacity) { $defaultProfile.capacity.maximum } else { 'N/A' } $capacityDefault = if ($defaultProfile -and $defaultProfile.capacity) { $defaultProfile.capacity.default } else { 'N/A' } $defaultRulesCount = if ($defaultProfile -and $defaultProfile.rules) { @($defaultProfile.rules).Count } else { 0 } # Notifications $notifyEmails = @() $notifyWebhooks = @() if ($data.notifications) { foreach ($notif in @($data.notifications)) { if ($notif.email) { if ($notif.email.sendToSubscriptionAdministrator) { $notifyEmails += 'Sub Admin' } if ($notif.email.sendToSubscriptionCoAdministrators) { $notifyEmails += 'Co-Admins' } if ($notif.email.customEmails) { $notifyEmails += @($notif.email.customEmails) } } if ($notif.webhooks) { $notifyWebhooks += @($notif.webhooks) | ForEach-Object { $_.serviceUri } } } } '@ AdditionalRowLoops = @() TagLoop = @{ Variable = 'Tag' Source = '$Tags' Preamble = '' } Fields = @( @{ Name = 'ID' Expression = '$1.id' } @{ Name = 'Subscription' Expression = '$sub1.Name' } @{ Name = 'Resource Group' Expression = '$1.RESOURCEGROUP' } @{ Name = 'Autoscale Setting Name' Expression = '$1.NAME' } @{ Name = 'Location' Expression = '$1.LOCATION' } @{ Name = 'Enabled' Expression = 'if ($data.enabled) { ''Yes'' } else { ''No'' }' } @{ Name = 'Target Resource' Expression = '$targetName' } @{ Name = 'Target Resource ID' Expression = '$targetId' } @{ Name = 'Target Location' Expression = '$targetLoc' } @{ Name = 'Profiles Count' Expression = '$profileCount' } @{ Name = 'Profile Names' Expression = '$profileNames' } @{ Name = 'Default Profile Min' Expression = '$capacityMin' } @{ Name = 'Default Profile Max' Expression = '$capacityMax' } @{ Name = 'Default Profile Default' Expression = '$capacityDefault' } @{ Name = 'Default Profile Rules' Expression = '$defaultRulesCount' } @{ Name = 'Notification Emails' Expression = '$notifyEmails -join ''; ''' } @{ Name = 'Notification Webhooks' Expression = '$notifyWebhooks -join ''; ''' } @{ Name = 'Resource U' Expression = '$ResUCount' } @{ Name = 'Tag Name' Expression = '[string]$Tag.Name' } @{ Name = 'Tag Value' Expression = '[string]$Tag.Value' } ) Export = @{ WorksheetName = 'Autoscale Settings' TableNamePrefix = 'AutoscaleTable_' Columns = @( 'Subscription' 'Resource Group' 'Autoscale Setting Name' 'Location' 'Enabled' 'Target Resource' 'Target Location' 'Profiles Count' 'Profile Names' 'Default Profile Min' 'Default Profile Max' 'Default Profile Default' 'Default Profile Rules' 'Notification Emails' 'Notification Webhooks' 'Resource U' ) TagColumns = @() TagColumnsBefore = $null NumberFormat = '0' ConditionalText = @() } SourceCollector = 'Modules/Public/InventoryModules/Monitor/AutoscaleSettings.ps1' } |