Reporting on space consumed by each backup job

PowerShell script exchange

Reporting on space consumed by each backup job

Veeam Logoby resruss » Tue Mar 24, 2015 1:59 am

I've recently learned how great PowerShell can be (PowerCLI to report on storage and CPU / RAM for a folder) and looking to generate a report or script that can be used to show how much space is consumed by backups, per job
I understand this can't be done at a VM level, that's fine

I had a bit of a play with some partial scripts on here, but just can't see to stitch it together

Basically just after something to run and even just spit out into the PowerShell itself with output such as:
Job Name
Space Used

Anyone able to give me any pointers or show me where to start?
Even better, anyone got such a script they're willing to share?
resruss
Service Provider
 
Posts: 56
Liked: 6 times
Joined: Mon Apr 30, 2012 2:04 am

Re: Reporting on space consumed by each backup job

Veeam Logoby v.Eremin » Tue Mar 24, 2015 11:17 am

Is a target a Windows-based repository? If so, take a look at this script. Thanks.
v.Eremin
Veeam Software
 
Posts: 13701
Liked: 1020 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Reporting on space consumed by each backup job

Veeam Logoby tsightler » Tue Mar 24, 2015 2:53 pm 1 person likes this post

If you have mulitple repositories that are a mix of Windows and Linux, calculating based on scanning the actual directory may be challenging since you have to work out paths, and potentially remote powershell/ssh, etc. I regularly use the following one-liner to get the size of the backup files on disk directly from the Veeam server. It's not quite 100% accurate because it doesn't account for metadata, but it's really close, with the exception of jobs that include periodic SQL log backups as those would need a little more code to grab the child job.
Code: Select all
((Get-VBRBackup -Name "<Backup_Name>").GetStorages().Stats.BackupSize | Measure-Object -Sum).Sum

This returns the size of the restore points on disk in bytes, which you can of course round however you wish if you prefer MB/GB/TB.
tsightler
Veeam Software
 
Posts: 4872
Liked: 1819 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Reporting on space consumed by each backup job

Veeam Logoby resruss » Thu Apr 02, 2015 1:25 am

tsightler wrote:If you have mulitple repositories that are a mix of Windows and Linux, calculating based on scanning the actual directory may be challenging since you have to work out paths, and potentially remote powershell/ssh, etc. I regularly use the following one-liner to get the size of the backup files on disk directly from the Veeam server. It's not quite 100% accurate because it doesn't account for metadata, but it's really close, with the exception of jobs that include periodic SQL log backups as those would need a little more code to grab the child job.
Code: Select all
((Get-VBRBackup -Name "<Backup_Name>").GetStorages().Stats.BackupSize | Measure-Object -Sum).Sum

This returns the size of the restore points on disk in bytes, which you can of course round however you wish if you prefer MB/GB/TB.


This is pretty much exactly what I'm after, thanks!

Quick question, I'm still a bit of a noob with PowerShell, how would I wrap that into a command or script to execute, looping through each job?
resruss
Service Provider
 
Posts: 56
Liked: 6 times
Joined: Mon Apr 30, 2012 2:04 am

Re: Reporting on space consumed by each backup job

Veeam Logoby tsightler » Thu Apr 02, 2015 2:41 am

You could do something like:
Code: Select all
Get-VBRBackup | Select @{N="Job Name";E={$_.Name}}, @{N="Size (GB)";E={[math]::Round(($_.GetStorages().Stats.BackupSize | Measure-Object -Sum).Sum/1GB,1)}} | Format-Table -AutoSize

Which should give you output something like:
Code: Select all
Job Name    Size (GB)
--------    ---------
Job_1            13.3
Job_2           310.9
Job_3            16.5
Job_4             7.7

You could even export to a CSV file by simply replacing the Format-Table cmdlet with Export-Csv <path_to_file>.
tsightler
Veeam Software
 
Posts: 4872
Liked: 1819 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

[MERGED] : PowerShell V8 Command for backup size

Veeam Logoby cwidhelm » Mon Feb 08, 2016 10:48 pm

I am needing to figure out the "backup size" with as much granularity as possible.

For example, Get-VBRRestorePoint gets me the granularity I want, however, ApproxSize is the Original Size and not the Backup Size.

Thanks
cwidhelm
Lurker
 
Posts: 2
Liked: never
Joined: Mon Feb 08, 2016 10:45 pm
Full Name: Chris Widhelm

Re: PowerShell V8 Command for backup size

Veeam Logoby vmniels » Tue Feb 09, 2016 11:08 am

VCP-DCV
Veeam Certified Architect (VMCA)
http://foonet.be
vmniels
Veeam Software
 
Posts: 1623
Liked: 360 times
Joined: Mon Jul 15, 2013 11:09 am
Full Name: Niels Engelen

Re: Reporting on space consumed by each backup job

Veeam Logoby v.Eremin » Tue Feb 09, 2016 11:29 am

Hi, Chris,

Kindly, take a look at the script provided above and see whether it meets your expectations.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13701
Liked: 1020 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Reporting on space consumed by each backup job

Veeam Logoby cwidhelm » Tue Feb 09, 2016 3:09 pm

I suppose it will have to do. The GetStorages gets me the storage information for the entire restore point. I was hoping to have per VM statistics.

It would be great if there were object documentation in the PowerShell docs so we could see what methods and properties are available in the returned types.

Thanks
cwidhelm
Lurker
 
Posts: 2
Liked: never
Joined: Mon Feb 08, 2016 10:45 pm
Full Name: Chris Widhelm

Re: Reporting on space consumed by each backup job

Veeam Logoby v.Eremin » Wed Feb 10, 2016 1:02 pm

Due to deduplication it's not possible to estimate how much space a particular VM consumes inside a backup file. Thanks.
v.Eremin
Veeam Software
 
Posts: 13701
Liked: 1020 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

[MERGED] Repository space per job

Veeam Logoby bjdboyer » Mon Jan 30, 2017 8:38 pm

I need a quick script that will take a backup job and tell me how much repository space is being used. We do billing based on how much "occupancy" each customer is using in the repository. Need like size-on-disk for each VM's points. Tried looping through the GetAllStorages() and looking at the stats.DataSize, but that total doesn't match what's in the /backup directory for that job. The VeeamOne billing report just doesn't cut it for our needs. We just need the total when we run the script. Month end.

TIA,
Bill
bjdboyer
Influencer
 
Posts: 23
Liked: 1 time
Joined: Mon Nov 16, 2015 5:52 pm
Full Name: Bill Boyer

Re: Reporting on space consumed by each backup job

Veeam Logoby v.Eremin » Tue Jan 31, 2017 12:48 pm

Hi, Bill,

Can you tell me whether this one-liner meets your expectations?

Code: Select all
Get-VBRBackup | Select @{N="Job Name";E={$_.Name}}, @{N="Size (GB)";E={[math]::Round(($_.GetAllStorages().Stats.BackupSize | Measure-Object -Sum).Sum/1GB,1)}} | Format-Table -AutoSiz


Thanks.
v.Eremin
Veeam Software
 
Posts: 13701
Liked: 1020 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 1 guest