Individual VM backup duration

PowerShell script exchange

Individual VM backup duration

Veeam Logoby jfrmilner » Sun Sep 30, 2012 12:56 pm 1 person likes this post

Hi all,

Using the GUI in B&R 6.1 you can right-click a job and select report, this provides me with a "Veeam Backup Session Report *.html". One of the things I like about this report is that it displays stats at the individual VM level as well as the whole job. I can see that I can get information regarding the whole job with the Get-VBRBackupSession cmdlet but I'm struggling to locate this information at the individual VM level, can anyone point me in the right location?
Regards,

jfrmilner
http://en.gravatar.com/jfrmilner
jfrmilner
Service Provider
 
Posts: 9
Liked: 1 time
Joined: Wed May 23, 2012 9:55 am
Full Name: John Milner

Re: Individual VM backup duration

Veeam Logoby Sethbartlett » Mon Oct 01, 2012 3:36 pm 1 person likes this post

Code: Select all
$Sessions = Get-VBRBackupSession -name "Name of Session"
$Sessions[0].Logger.GetLog().UpdatedRecords


The above code would look at the first session in a list of sessions and give you the XML data that you are seeing in the realtime statistics.
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me ;)
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
Sethbartlett
Expert
 
Posts: 282
Liked: 25 times
Joined: Wed Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett

Re: Individual VM backup duration

Veeam Logoby jfrmilner » Tue Oct 02, 2012 8:13 am

Sethbartlett,

Excellent thank you. How about Read, Transferred, Duration do you know where I could find this?
Regards,

jfrmilner
http://en.gravatar.com/jfrmilner
jfrmilner
Service Provider
 
Posts: 9
Liked: 1 time
Joined: Wed May 23, 2012 9:55 am
Full Name: John Milner

Re: Individual VM backup duration

Veeam Logoby Sethbartlett » Wed Oct 03, 2012 2:41 pm

Is this data available in the GUI for each VM? I typically only see this on the entire job.
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me ;)
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
Sethbartlett
Expert
 
Posts: 282
Liked: 25 times
Joined: Wed Nov 10, 2010 6:51 pm
Full Name: Seth Bartlett

Re: Individual VM backup duration

Veeam Logoby jfrmilner » Mon Oct 08, 2012 8:53 am

Sethbartlett,

Well it is available in the report which seems to be generated via the GUI, for example:

Image
photo hosting sites

Any help in extracting this information with PowerShell would be extremely helpful.
Regards,

jfrmilner
http://en.gravatar.com/jfrmilner
jfrmilner
Service Provider
 
Posts: 9
Liked: 1 time
Joined: Wed May 23, 2012 9:55 am
Full Name: John Milner

Re: Individual VM backup duration

Veeam Logoby jfrmilner » Tue Nov 06, 2012 9:29 am

Anyone else? Maybe I could extract this from SQL?
Regards,

jfrmilner
http://en.gravatar.com/jfrmilner
jfrmilner
Service Provider
 
Posts: 9
Liked: 1 time
Joined: Wed May 23, 2012 9:55 am
Full Name: John Milner

Re: Individual VM backup duration

Veeam Logoby Vitaliy S. » Fri Nov 09, 2012 12:04 pm 2 people like this post

Try this PS cmdlet to get the information you need:
Code: Select all
$session = Get-VBRBackupSession | use filters here
$task = GetVBRTaskSession $session | use filters here
$task.Progress – contains information about data size etc.
Vitaliy S.
Veeam Software
 
Posts: 19575
Liked: 1106 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: Individual VM backup duration

Veeam Logoby jfrmilner » Mon Nov 12, 2012 10:11 am

Exactly what I was looking for many thanks.
Regards,

jfrmilner
http://en.gravatar.com/jfrmilner
jfrmilner
Service Provider
 
Posts: 9
Liked: 1 time
Joined: Wed May 23, 2012 9:55 am
Full Name: John Milner

Re: Individual VM backup duration

Veeam Logoby masonit » Wed Sep 09, 2015 8:31 am 1 person likes this post

Vitaliy S. wrote:Try this PS cmdlet to get the information you need:
Code: Select all
$session = Get-VBRBackupSession | use filters here
$task = GetVBRTaskSession $session | use filters here
$task.Progress – contains information about data size etc.


Hi

Should this one still work in Veeam 8? I get this:

Code: Select all
add-pssnapin "VeeamPSSnapIn"
$session = Get-VBRBackupSession
$task = Get-VBRTasksession $session
$task.Progress
Get-VBRTaskSession : Cannot convert 'System.Object[]' to the type 'Veeam.Backup.Core.CBackupSession' required by parameter 'Session'. Specified method is not
supported.
At line:3 char:28
+ $task = Get-VBRTasksession $session
+                            ~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-VBRTaskSession], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,Veeam.Backup.PowerShell.Command.GetVBRTaskSession

\Masonit
masonit
Service Provider
 
Posts: 141
Liked: 10 times
Joined: Tue Oct 09, 2012 2:30 pm
Full Name: Magnus Andersson

Re: Individual VM backup duration

Veeam Logoby v.Eremin » Wed Sep 09, 2015 1:56 pm

Get-VBRTaskSession expects a single entity, not an array. Thus, the issues. Thanks.
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 974 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Individual VM backup duration

Veeam Logoby masonit » Thu Sep 10, 2015 7:16 am 1 person likes this post

Hi again

I have now created a script that shows the data i want. But the problem is that I would like to sort the entire result after ReadSize. But I can't get it to work and I guess the main problem is that the result is shown in multiple arrays based on Jobname?

Code: Select all
$BackupSessions = ""
add-pssnapin "VeeamPSSnapIn"
$Jobs = Get-VBRJob
foreach ($job in $Jobs) {
   $BackupSessions = Get-VBRBackupSession | where {$_.JobName -eq $job.Name} | Sort creationtime -Descending | select -First 1
   Get-VBRTaskSession $BackupSessions | Select-Object Name ,JobName ,Status,@{Name="StartTime"; Expression = {$_.Progress.StartTime}},@{Name="StopTime"; Expression = {$_.Progress.StopTime}},@{Name="ReadSize in GB"; Expression = {[math]::Round(($_.Progress.ReadSize/1024/1024/1024),1)}},@{Name="TransferedSize in GB"; Expression = {[math]::Round(($_.Progress.TransferedSize/1024/1024/1024),1)}} | Format-Table -auto
   }
masonit
Service Provider
 
Posts: 141
Liked: 10 times
Joined: Tue Oct 09, 2012 2:30 pm
Full Name: Magnus Andersson

Re: Individual VM backup duration

Veeam Logoby v.Eremin » Thu Sep 10, 2015 7:39 pm

What do you mean by "sort the entire Result after ReadSize"? Should some values be shown in desired order or something?
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 974 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Individual VM backup duration

Veeam Logoby tsightler » Fri Sep 11, 2015 2:15 am 2 people like this post

Hi Magnus. I'm not sure I followed you 100%, but here's a modification that loads the entire results from every Job/VM into a single array and thus allows the final output to be sorted by any column (example below sorts in descending order of read size). Also, it should run significantly faster by using $Job.FindLastSession() instead of running Get-VBRBackupSession mulitple times and filtering/sorting the entire list of sessions, which can be quite long. In my lab I have over 10,000 sessions and the original script took 30 seconds while the one below takes <1 second and seems to produce identical output.
Code: Select all
asnp "VeeamPSSnapIn"
$Output = @()
$Jobs = Get-VBRJob
ForEach ($Job in $Jobs) {
   $Output += Get-VBRTaskSession $Job.FindLastSession() | Select-Object Name ,JobName ,Status,@{Name="StartTime"; Expression = {$_.Progress.StartTime}},@{Name="StopTime"; Expression = {$_.Progress.StopTime}},@{Name="ReadSize in GB"; Expression = {[math]::Round(($_.Progress.ReadSize/1024/1024/1024),1)}},@{Name="TransferedSize in GB"; Expression = {[math]::Round(($_.Progress.TransferedSize/1024/1024/1024),1)}}
   }
$Output | Sort -Property "Readsize in GB" -Descending | Format-Table -AutoSize
tsightler
Veeam Software
 
Posts: 4775
Liked: 1742 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Individual VM backup duration

Veeam Logoby masonit » Fri Sep 11, 2015 8:30 am

You followed me 100%.. Looks great, thanks! :)

\Masonit
masonit
Service Provider
 
Posts: 141
Liked: 10 times
Joined: Tue Oct 09, 2012 2:30 pm
Full Name: Magnus Andersson

Re: Individual VM backup duration

Veeam Logoby marius roma » Fri Sep 11, 2015 11:30 am

It looks great!
Let me ask for 2 possible enhancements:
Is it possible to extend the search to the latest let's say 10 executions ot each job?
Is it possible to limit the analysis to replica jobs?
Regards
marius
marius roma
Expert
 
Posts: 317
Liked: 3 times
Joined: Wed Feb 01, 2012 12:04 pm
Full Name: Mario

Next

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 6 guests