Comprehensive data protection for all workloads
Post Reply
gingerdazza
Expert
Posts: 206
Liked: 14 times
Joined: Jul 23, 2013 9:14 am
Full Name: Dazza
Contact:

SureBackup - Random Jobs

Post by gingerdazza »

I was just wondering if there is an easy way to randomise the test surebackup tasks? It's normally unrealistic to run test restores of everything, so it would make sense to me to have the facility to create random test restore jobs. This can then be used as a frequent due diligence task for management.
foggy
Veeam Software
Posts: 21139
Liked: 2141 times
Joined: Jul 11, 2011 10:22 am
Full Name: Alexander Fogelson
Contact:

Re: SureBackup - Random Jobs

Post by foggy »

There's no such built-in capabilities, however you can configure jobs scheduling so that each of the jobs run on just some specific day, for example (instead of running every day). Not random, but still looks similar to what you're after.
gingerdazza
Expert
Posts: 206
Liked: 14 times
Joined: Jul 23, 2013 9:14 am
Full Name: Dazza
Contact:

Re: SureBackup - Random Jobs

Post by gingerdazza »

Thanks.

Is this not worthy of a feature request Veeam Support?
foggy
Veeam Software
Posts: 21139
Liked: 2141 times
Joined: Jul 11, 2011 10:22 am
Full Name: Alexander Fogelson
Contact:

Re: SureBackup - Random Jobs

Post by foggy »

Filed.
PTide
Product Manager
Posts: 6551
Liked: 765 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: SureBackup - Random Jobs

Post by PTide »

Hi,

You might want to play around with a PowerShell scripting in order to create custom script that can generate random SureBackup jobs. Please see this reference. If any scripting questions occur please create a separate topic in a corresponding PowerShell section of this forum.

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

Re: SureBackup - Random Jobs

Post by veremin »

Speaking about scripting, you will have to create a PS script that grabs all VM entities having been backed up successfully with last day (24 hours), selects a predefined number of those VMs randomly, and creates a new App Group, as well as, SureBackup job with new objects. Thanks.
dellock6
VeeaMVP
Posts: 6166
Liked: 1971 times
Joined: Jul 26, 2009 3:39 pm
Full Name: Luca Dell'Oca
Location: Varese, Italy
Contact:

Re: SureBackup - Random Jobs

Post by dellock6 »

thanks Vladimir for explaining the script I was actually developing with some Veeam solutions architects :)

This is the script we ended up with, and does exactly what's asked here: every run it picks X number of VMs from the backups that have at least one restore point in the last 24 hours, creates a new application group, a new surebackup job using that group, and runs. VMs are tested against the basic tests like heartbeat cause we cannot have custom tests. At the following run, both application group and surebackup job are deleted and recreated.
The only limit using application groups is that VMs are tested sequentially, which may slow down the process, but the biggest limit is that if a VM in the queue fails its test, the following VMs are not even started and the job fails. Say out of 20 VMs VM #6 fails, VMs from 7 to 20 are not tested. We are already thinking about creating X different jobs, each with only one VM, which will speed up the process and have the single VM failing not affecting the others.
But I think it's a good starting point.

Here it is:

Code: Select all

$NumberofVMs = 10
$AppGroupName = "Dynamic App Group"
$SbJobName = "Dynamic Surebackup Job"
$SbJobDesc = "Dynamic App Testing"
 
asnp "VeeamPSSnapIn" -ErrorAction SilentlyContinue
 
# Find all VM objest successfully backed up in last 1 days
$VbrObjs = (Get-VBRBackupSession | ?{$_.JobType -eq "Backup" -and $_.EndTime -ge $Date.adddays(-1)}).GetTaskSessions() | ?{$_.Status -eq "Success" -or $_.Status -eq "Warning" }
 
# Select random VMs to be tested
$TestVMs = $VbrObjs | Get-Random -Count $NumberofVMs
 
# Remove the old App Group
Remove-VSBJob -Job (Get-VSBJob -Name $SbJobName) -Confirm:$false
Remove-VSBApplicationGroup -AppGroup (Get-VSBApplicationGroup -Name $AppGroupName) -Confirm:$false
 
# Create the new App Group, SureBackup Job, Start the Job
$VirtualLab = Get-VSBVirtualLab -Name "Surebackup Lab”
$AppGroup = Add-VSBViApplicationGroup -Name $AppGroupName -VmFromBackup (Find-VBRViEntity -Name $TestVMs.Name)
$VsbJob = Add-VSBJob -Name $SbJobName -VirtualLab $VirtualLab -AppGroup $AppGroup -Description $SbJobDesc

Start-VSBJob -Job $VsbJob -RunAsync

Luca Dell'Oca
Principal EMEA Cloud Architect @ Veeam Software

@dellock6
https://www.virtualtothecore.com/
vExpert 2011 -> 2022
Veeam VMCE #1
gingerdazza
Expert
Posts: 206
Liked: 14 times
Joined: Jul 23, 2013 9:14 am
Full Name: Dazza
Contact:

Re: SureBackup - Random Jobs

Post by gingerdazza »

Luca - it might be worthwhile however having an option to include ALL vms in that random Surebackup job. If you think about it, it's not always just about "are my backups usable?", but it can also be "are the VMs I need even backed up at all?"
dellock6
VeeaMVP
Posts: 6166
Liked: 1971 times
Joined: Jul 26, 2009 3:39 pm
Full Name: Luca Dell'Oca
Location: Varese, Italy
Contact:

Re: SureBackup - Random Jobs

Post by dellock6 »

You can remove the part of the code "-and $_.EndTime -ge $Date.adddays(-1)}).GetTaskSessions()" and it will get any backup restore point, or you can change the -1 (which means 1 day back in time) to another value.
And for the list of VM with at least one restore point, you better look at VBR reports into Veeam ONE about protected/unprotected VMs, because then your problem is not if the VMs are recoverable, but if they were first backed up.
Luca Dell'Oca
Principal EMEA Cloud Architect @ Veeam Software

@dellock6
https://www.virtualtothecore.com/
vExpert 2011 -> 2022
Veeam VMCE #1
PTide
Product Manager
Posts: 6551
Liked: 765 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: SureBackup - Random Jobs

Post by PTide »

Dazza,

Just my 2 cents - technically speaking, there is no difference if you distribute 100 VMs across 5 weekly SureBackup Jobs (20 VMs each) as foggy has offered, or if you choose to run a Surebackup Job with 20 "random" VMs 5 times, one time per week. Moreover - with 100 VMs distibuted across 5 jobs you have a 100% guarantee that all 100 VMs will be checked eventually. With "random" jobs some VMs might get into the job more than one time while some of them would stay unchecked.
dellock6
VeeaMVP
Posts: 6166
Liked: 1971 times
Joined: Jul 26, 2009 3:39 pm
Full Name: Luca Dell'Oca
Location: Varese, Italy
Contact:

Re: SureBackup - Random Jobs

Post by dellock6 »

While on the other side, if you have a highly changing environment (like the origina use case of the script) you do not need to re-build every week the different surebackup jobs. Different goals, different solutions ;)
Luca Dell'Oca
Principal EMEA Cloud Architect @ Veeam Software

@dellock6
https://www.virtualtothecore.com/
vExpert 2011 -> 2022
Veeam VMCE #1
Post Reply

Who is online

Users browsing this forum: Mildur and 58 guests