Report Veeam backup copy job sessions
VBR 12+ backup copy jobs showed as Unknown. Get-VBRJob returns the copy (policy) job, but Get-VBRBackupSession only returns sessions of its hidden worker jobs, whose JobId matches no listed job, so they were dropped. Confirmed on a VBR 13.0.2 server with the new diagnostics script. - File worker sessions under their policy job via Session.GetJob().PolicyJobId (looked up once per worker job), and record the source job in details.copied_from - Add Get-VeeamCollectorDiagnostics.ps1, a read-only report of jobs, unmatched sessions and their link properties - Mock: backup copy policy/worker case and a session from a deleted job Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -44,9 +44,23 @@ $global:MockJobs = @(
|
||||
# Older VBR versions return NextRun as a culture-formatted string
|
||||
(New-MockJob 'SQL01 – Logs' 'Backup' $now.AddMinutes(40).ToString()),
|
||||
(New-MockJob 'Offsite Copy' 'BackupSync' $null),
|
||||
(New-MockJob 'Old Exchange' 'Backup' $now.AddDays(1) $false)
|
||||
(New-MockJob 'Old Exchange' 'Backup' $now.AddDays(1) $false),
|
||||
# VBR 12+ backup copy job (immediate mode, no schedule): the "policy" job Get-VBRJob returns
|
||||
(New-MockJob 'Cloud Copy' 'SimpleBackupCopyPolicy' $null)
|
||||
)
|
||||
$fs, $sql, $copy, $old = $global:MockJobs
|
||||
$fs, $sql, $copy, $old, $cloud = $global:MockJobs
|
||||
|
||||
# Its hidden worker job, one per source job. Get-VBRJob doesn't return it, and Get-VBRBackupSession
|
||||
# returns only the worker's sessions. Shape taken from a real VBR 13 server.
|
||||
$cloudWorker = [pscustomobject]@{
|
||||
Id = New-StableGuid 'Cloud Copy\File Server – Nightly'; Name = 'Cloud Copy\File Server – Nightly'
|
||||
JobType = 'SimpleBackupCopyWorker'; PolicyJobId = $cloud.Id
|
||||
}
|
||||
function New-MockWorkerSession($Start, $End, $Result) {
|
||||
$s = New-MockSession $cloudWorker $Start $End 'Stopped' $Result -Size 40GB
|
||||
$s | Add-Member ScriptMethod GetJob { $cloudWorker }
|
||||
$s
|
||||
}
|
||||
|
||||
$global:MockSessions = @(
|
||||
(New-MockSession $fs $now.AddDays(-1).AddHours(-2) $now.AddDays(-1).AddHours(-1) 'Stopped' 'Success' -Size 128GB -Tasks @(
|
||||
@@ -58,7 +72,11 @@ $global:MockSessions = @(
|
||||
-LogRecords @(
|
||||
[pscustomobject]@{ Title = 'Preparing backup chain'; Status = 'ESucceeded' },
|
||||
[pscustomobject]@{ Title = 'Network path not found (0x80070035)'; Status = 'EFailed' })),
|
||||
(New-MockSession $old $now.AddDays(-10) $now.AddDays(-10).AddHours(1) 'Stopped' 'Success') # outside 48h lookback
|
||||
(New-MockSession $old $now.AddDays(-10) $now.AddDays(-10).AddHours(1) 'Stopped' 'Success'), # outside 48h lookback
|
||||
(New-MockWorkerSession $now.AddDays(-1).AddMinutes(-55) $now.AddDays(-1).AddMinutes(-30) 'Success'),
|
||||
(New-MockWorkerSession $now.AddMinutes(-55) $now.AddMinutes(-35) 'Warning'),
|
||||
# A session from a job the collector doesn't know (e.g. deleted): must be ignored, not crash
|
||||
(New-MockSession ([pscustomobject]@{ Id = New-StableGuid 'gone'; Name = 'Deleted job' }) $now.AddHours(-2) $now.AddHours(-1) 'Stopped' 'Success')
|
||||
)
|
||||
|
||||
function Get-VBRJob { [CmdletBinding()] param() $global:MockJobs }
|
||||
|
||||
Reference in New Issue
Block a user