Reporting help

PowerShell script exchange

Reporting help

Veeam Logoby Stirlin » Wed Jun 12, 2013 2:13 pm

OK, so, 1st post, might be a bit of an ask.

I have been doing some research and trawling these forums as well as other ps forums and am a little stuck.

I am currently trying to find out why we have issues with backups and perfromance across the estate and need to get a very detailed view of what is happening in VEEAM. I know the information around the jobs are there in the client app (if I go into each one, it shows the detail I want Time of snapshot taken, how long, throughput) But I need this for all of the jobs and we have 17 with 1 - 8 VM's in each job. Is there a report for this? I have tried other peoples powershell scripts as I am no programmer but cant get what I need.

Any help appreciated.

I need full detaisl from each job, incuding all steps, time started, resources ssigned, snapshot taken, throughput, snapshot removed. And with times agains each one.

A big ask I guess. :mrgreen:
Stirlin
Lurker
 
Posts: 2
Liked: 1 time
Joined: Wed Jun 12, 2013 2:06 pm
Full Name: Steve Davis

Re: Reporting help

Veeam Logoby Vitaliy S. » Wed Jun 12, 2013 2:30 pm

Hello Steve,

No, there is no report like that, however to narrow down the possible reasons for performance issues, I would suggest looking at job bottleneck stats first and then based on that number query Veeam backup via PowerShell further.

Thank you!
Vitaliy S.
Veeam Software
 
Posts: 19558
Liked: 1102 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: Reporting help

Veeam Logoby v.Eremin » Thu Jun 13, 2013 11:42 am 1 person likes this post

Providing I’ve understood you correctly, the following script should meet your expectations:

Code: Select all
Add-PSSnapin VeeamPSSnapin
$Job = Get-VBRJob -Name "Name of your Job"
$LastSession = $Job.FindLastSession()
$TaskSessions = $LastSession | Get-VBRTaskSession
$TaskSessions.Logger.GetLog().UpdatedRecords | Select-Object title, starttime, updatetime


Hope this helps.
Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Reporting help

Veeam Logoby Stirlin » Mon Jun 17, 2013 9:56 am 1 person likes this post

v.Eremin wrote:Providing I’ve understood you correctly, the following script should meet your expectations:

Code: Select all
Add-PSSnapin VeeamPSSnapin
$Job = Get-VBRJob -Name "Name of your Job"
$LastSession = $Job.FindLastSession()
$TaskSessions = $LastSession | Get-VBRTaskSession
$TaskSessions.Logger.GetLog().UpdatedRecords | Select-Object title, starttime, updatetime


Hope this helps.
Thanks.


Thank you. This definetly put me on the right track. I sat down with one of our script guys and we got the code below to run. it gets details for each job, and each VM in the job and punts it out to an email in HTML.
=================================================================================================================================================
Code: Select all
Clear

Add-PSSnapin VeeamPSSnapin -ErrorAction SilentlyContinue

#Generate Data

$Tasks = @()

Get-VBRJob | ForEach-Object {
   $NewTask = New-Object -TypeName PSObject -Property @{
      Name = $_.Name
      Sessions = @()
   }
   
   $_.FindLastSession() | ForEach-Object -Process {
      $NewSession = New-Object -TypeName PSObject -Property @{
         TaskSessions = @()
      }
      
      Get-VBRTaskSession -Session $_ | ForEach-Object -Process {         
         $NewTaskSession = New-Object -TypeName PSObject -Property @{
            Name = $_.Name
            Records = @()
         }
         
         Try {
            $_.Logger.GetLog().UpdatedRecords | Sort-Object -Property UpdateTime | ForEach-Object -Process {
               $NewRecord = New-Object -TypeName PSObject -Property @{
                  Title = $_.Title
                  StartTime = $_.StartTime
                  UpdateTime = $_.UpdateTime
               }
               
               $NewTaskSession.Records += $NewRecord
            }
         } Catch {
         }
         $NewSession.TaskSessions += $NewTaskSession
      }
      $NewTask.Sessions += $NewSession
   }
   $Tasks += $NewTask
}

#Output Data

$OutputHTML = "<html>`n<head>`n<style>`nTABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}`nTH{border-width: 1px;padding: 2px;border-style: solid;border-color: black;background-color:orange}`nTD{border-width: 1px;padding: 2px;border-style: solid;border-color: black;background-color:lightblue}`ntr.special {background: #000080;} <tr class=`"special`"></tr>`n</style></head>`n<body>`n"

$Tasks | ForEach-Object -Process {
   $OutputHTML += "<h1>{0}</h1>`n" -f $_.Name
   $_.Sessions | ForEach-Object -Process {
      $_.TaskSessions | ForEach-Object -Process {
         $OutputHTML += "<h2>{0}</h2>`n<table>`n<tr>`n<th>Title</th><th>StartTime</th><th>UpdateTime</th>`n</tr>`n" -f $_.Name
         $_.Records | ForEach-Object -Process {
            $OutputHTML += "<tr>`n<td>{0}</td><td>{1}</td><td>{2}</td>`n</tr>`n" -f $_.Title,$_.StartTime,$_.UpdateTime
         }
         $OutputHTML += "</table>`n"
      }
   }
}

$OutputHTML += "</body>`n</html>"

#Add details here
$From = "FromEmailAddress"
$To = @("ToEmailAddress","2ndToEmailAddress")
$Subject = "Subject Line" 
$Smtp = "FQDN of your Email Server"

Send-MailMessage -SmtpServer $Smtp -To $To -From $From -Subject $Subject -Body $OutputHTML -BodyAsHtml

=================================================================================================================================================
I hope someone else finds this useful.

Steve
(Credit to Matt Waters for the PowerShell Assist)
Stirlin
Lurker
 
Posts: 2
Liked: 1 time
Joined: Wed Jun 12, 2013 2:06 pm
Full Name: Steve Davis

Re: Reporting help

Veeam Logoby v.Eremin » Mon Jun 17, 2013 11:06 am

Nice and handy script, indeed. Thanks for sharing; highly-appreciated.

Also it might be worth adding the following line to the beginning of the script; so that, you will be asked about what job you’re willing to get a message:

Code: Select all
$JobName = Read-Host "Specify a name of a job about which you're willing to get the information"
Get-VBRJob -name $Jobname | ForEach-Object {...}


Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 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 3 guests