PowerShell script exchange
Post Reply
StLaurie
Novice
Posts: 4
Liked: never
Joined: Sep 27, 2017 11:27 pm
Full Name: Laurie Street
Contact:

More details of tape backup jobs

Post by StLaurie »

I am trying to create a report on our tape backup jobs but I can't find the following information in the provided cmdlets.

I can get a fair amount of detail using:

Code: Select all

[veeam.backup.core.cbackupsession]::GetByJob($job.id)
but I am wondering if there is anymore detail in:

Code: Select all

[Veeam.Backup.Core.CBackupSessionWorkDetails]
or

Code: Select all

[Veeam.Backup.Model.CBackupStats]
if there is I am at a loss on how to extract the data for the specific job I am reporting on.
Any help would be appreciated.

Cheers,
Laurie
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: More details of tape backup jobs

Post by veremin »

Can you tell us what particular information you'd like to get? Thanks.
StLaurie
Novice
Posts: 4
Liked: never
Joined: Sep 27, 2017 11:27 pm
Full Name: Laurie Street
Contact:

Re: More details of tape backup jobs

Post by StLaurie »

I've actually been able to get all the information I need! :D
Start with:

Code: Select all

Get-VBRTapeJob -Name $JobName
$Session = [veeam.backup.core.cbackupsession]::GetByJob($job.id)

$Session.SessionInfo.Progress
$Session.GetTaskSessions().progress.totalsize
The last two lines were what gave me everything I needed
Cheers,
Laurie
mzhen
Influencer
Posts: 11
Liked: 4 times
Joined: Apr 01, 2015 12:19 am
Full Name: Marcus Zheng
Contact:

Re: More details of tape backup jobs

Post by mzhen » 1 person likes this post

After a bit of hacking, I found the following function is much faster than Get-VBRTapeJob. It returns the results instantly. It can be used to list all the tape backup jobs. The following example only show you one tape backup job. You can then fetch useful information such endtime, backup size, etc.

Code: Select all

$TapeJob = [Veeam.Backup.Core.CBackupJob]::GetAllBackupSyncAndTape() | Where Name -eq "FileServer1"
$LastSession = $TapeJob.FindLastSession()
$LastSession.endtime
$LastSession.Info.Progress.TotalUsedSize
$LastSession.Info.Progress.ReadSize
$LastSession.Info.Progress.TransferedSize
This function returns all VM and Veeam Agent jobs instantly as well

Code: Select all

[Veeam.Backup.Core.CBackupJob]::GetAll()
yakamoneye18
Enthusiast
Posts: 54
Liked: 7 times
Joined: May 03, 2018 6:20 am
Full Name: Tobias
Contact:

Re: More details of tape backup jobs

Post by yakamoneye18 »

Hey everyone,

I just tried the

Code: Select all

[Veeam.Backup.Core.CBackupJob]::GetAllBackupSyncAndTape()
command which works great, but I saw that it does not show my single File to Tape job I have running. Does this command not cover these jobs, or is the problem something else? When I run Get-VBRTapeJob I get this job too, but this command is so painfully slow that I am trying to get it done with the other command.

Thanks!
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: More details of tape backup jobs

Post by oleg.feoktistov »

Hi Tobias,

Looks like GetAllBackupSyncAndTape() method doesn't work with file to tape jobs. Another unofficial method I could find out resides in DB manager realm, so please treat it as a workaround:

Code: Select all

[Veeam.Backup.DBManager.CDBManager]::Instance.TapeJobs.GetByType('FileTapeBackup')
When you say that Get-VBRTapeJob is painfully slow, what exactly do you mean? Do you have any particular metrics to share?

Thanks,
Oleg
yakamoneye18
Enthusiast
Posts: 54
Liked: 7 times
Joined: May 03, 2018 6:20 am
Full Name: Tobias
Contact:

Re: More details of tape backup jobs

Post by yakamoneye18 »

Hi Oleg,

my problem occours in our monitoring tool. We are using check_mk, and I installed the default "Veeam Backup Status" script that comes with the installation. This script always was running a long time (between 10-20 seconds), but started to get much slower in the last months (maybe after a Veeam update? not sure...), so I tried to look for the problem.

This is the part in the script that tries to get the tape jobs:

Code: Select all


$tapeJobs = Get-VBRTapeJob
write-host "<<<veeam_tapejobs:sep(124)>>>"
write-host "JobName|JobID|LastResult|LastState"
foreach ($tapeJob in $tapeJobs)
    {
        $jobName = $tapeJob.Name
        $jobID = $tapeJob.Id
        $lastResult = $tapeJob.LastResult
        $lastState = $tapeJob.LastState
        write-host "$jobName|$jobID|$lastResult|$lastState"
    }
This returns all our 5 Backup2Tape and 1 File2Tape jobs - and takes 76 seconds to finish. I measured only the Get-VBRTapeJob command - similar result (~70 seconds)
I now changed the script to use the alternative method:

Code: Select all

$tapeJobs = ([Veeam.Backup.Core.CBackupJob]::GetAllBackupSyncAndTape()).findLastSession()
write-host "<<<veeam_tapejobs:sep(124)>>>"
write-host "JobName|JobID|LastResult|LastState"
foreach ($tapeJob in $tapeJobs)
    {
        $jobName = $tapeJob.Name
        $jobID = $tapeJob.Id
        $lastResult = $tapeJob.result
        $lastState = $tapeJob.State
        write-host "$jobName|$jobID|$lastResult|$lastState"
    }
This returns only the 5 Backup2Tape jobs, and takes 1.25 seconds to finish.

The rest of the script (getting all other jobs, getting the status of each single vm...) needs about 3-5 seconds.

Our backup server is not the most powerfull, but I do not think this is the problem: Xeon Silver 4110 DualCore 2.1GHz, 64GB Memory, and during the tests it did not run any task other than 2 SQL Transaction Log backups (idle at the time of the test).

Regards,

Tobias
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: More details of tape backup jobs

Post by oleg.feoktistov »

Tobias,

Thank you for the detailed reply! That's quite a lot for just 6 entities. However, it is hard to tell the root cause through forums in such situations. Could you, please, contact our support to investigate this further? Also, would appreciate if you could share your case id here.

Does the workaround work for you though?

Best regards,
Oleg
yakamoneye18
Enthusiast
Posts: 54
Liked: 7 times
Joined: May 03, 2018 6:20 am
Full Name: Tobias
Contact:

Re: More details of tape backup jobs

Post by yakamoneye18 »

Hi Oleg,

I will try to open a ticket in the next days, at the moment we are fully packed, and since this is not critical at the moment... But am I correct, this command should not take so long? Like mzhen already wrote in this thread before, it looks like the Get-VBRTapeJob-Command is at least not very fast...

The workaround looks like it does not work - I cannot see information about the last job execution, without this the monitoring plugin would fail I think. For now it is okay, the file job is "only" the Veeam config2Tape copy job, and we get emails if jobs fail - so for now it is okay.

But I will try to contact support as soon as I get some air here...

Thanks,

Tobias
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: More details of tape backup jobs

Post by oleg.feoktistov »

Hi Tobias,

I would say that it could take that long, but not for just 6 entities. Tested in my lab, the longest it took for Get-VBRTapeJob to execute was just 10 seconds (and that was on powershell initialization). While you are figuring out with the case, try this workaround with the last session for each tape job:

Code: Select all

$jobs = [Veeam.Backup.DBManager.CDBManager]::Instance.TapeJobs.GetByType('FileTapeBackup')

foreach ($job in $jobs) {
[Veeam.Backup.Core.CbackupSession]::FindLast($job.Id)
}
Just don't forget to replace it all with Get-VBRTapeJob as soon as all is good with cmdlet performance.

Thanks,
Oleg
meelisn
Influencer
Posts: 19
Liked: never
Joined: Jun 09, 2020 2:21 pm
Full Name: Meelis Nigols
Contact:

Re: More details of tape backup jobs

Post by meelisn »

I also have problem with slow Get-VBRTapeJob. It takes 1 minute and 23 seconds to get 18 tape jobs.

The previously proposed GetAllBackupSyncAndTape() also picks up SimpleBackupCopyPolicy job. Fortunately that can be filtered out.

Is there anything that could be done to troubleshoot the situation?
david.domask
Veeam Software
Posts: 2123
Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: More details of tape backup jobs

Post by david.domask »

Hi!

There was a hotfix made to address some identified unoptimized elements of Get-VBRTapeJob.

Please open a case and reference issue ID 352887, and your engineer can provide a hotfix. Please ensure you're on fully patched v11a with the most recent Cumulative Patch.
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 8 guests