Search vbrBackupSession for any warnings or failures

PowerShell script exchange

Search vbrBackupSession for any warnings or failures

Veeam Logoby gk87 » Mon Jul 17, 2017 11:04 am

I'd like to search a vbrBackupSession for any warnings or failures in case the last vbrBackupSession is failed and the currently "idle" one is finished but "Waiting for the new copy interval" which can take hours / days.
This is to prevent false positives in our monitoring tool. Any ideas on how to get this data?

Example data:
Name: Backup Copy Job 1
State: Stopped
Result: Failed

CreationTime: 13-7-2017 00:00:32

Name: Backup Copy Job 1
State: Idle
Result: None

CreationTime: 13-7-2017 00:36:59
gk87
Influencer
 
Posts: 10
Liked: never
Joined: Fri Jun 09, 2017 11:47 am

Re: Search vbrBackupSession for any warnings or failures

Veeam Logoby v.Eremin » Mon Jul 17, 2017 2:21 pm

Assuming I got it right, you need to do the following:

1) Backup copy jobs that satisfy two conditions (Latest State = Idle, Latest Result = None)
2) For those satisfying the conditions, get second to last sessions
3) Check state of those sessions

Feel free to check this subforum, there are several examples doing similar stuff.

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

Re: Search vbrBackupSession for any warnings or failures

Veeam Logoby gk87 » Wed Jul 19, 2017 7:18 am

Let me clarify my request with a screenshot. The below session has state Idle and status None but it does contain errors. How can I check that idle ("Waiting for the new copy interval") session for those errors/warnings?

Image
gk87
Influencer
 
Posts: 10
Liked: never
Joined: Fri Jun 09, 2017 11:47 am

Re: Search vbrBackupSession for any warnings or failures

Veeam Logoby v.Eremin » Wed Jul 19, 2017 3:20 pm

Ahh, in this case you will need to check log of the latest job session, finding "Error" entities. Something like this:

Code: Select all
$Session = (Get-VBRJob -name "Name ").FindLastSession()
$Log = $Session.Logger.GetLog().updatedrecords | where {$_.status -eq "Efailed"} | select Title

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

Re: Search vbrBackupSession for any warnings or failures

Veeam Logoby gk87 » Fri Jul 21, 2017 5:42 am

That's great, thank you Vladimir :-)
gk87
Influencer
 
Posts: 10
Liked: never
Joined: Fri Jun 09, 2017 11:47 am

Re: Search vbrBackupSession for any warnings or failures

Veeam Logoby gk87 » Fri Jul 21, 2017 10:54 am

You wouldn't happen to know how I can check for the number of total running sessions right? (including all type of jobs: Endpoint backups, surebackups, SQLlogBackups, replications, etc.)

I was thinking of doing the following but it looks a bit rough and I was wondering if I have everything covered with this:

Code: Select all
$jobs = @()
$jobs += Get-VBREPJob | Where {$_.LastState -ne "Stopped"} # Get status of VBREP jobs
$jobs += Get-VSBJob | Where {$_.GetLastState() -ne "Stopped"} # Get status of VSB jobs
$jobs += Get-VBRJob| Where {$_.GetLastState() -ne "Stopped" -and $_.GetLastState() -ne "Idle"} # Get status of VBR jobs
$jobs +=  Foreach ($vbrJob in (Get-VBRJob) | where {$_.FindChildSqlLogBackupJob()}) {$vbrJob.FindChildSqlLogBackupJob() | Where {$_.GetLastState() -ne "Stopped"}} # Get status of SQL jobs

($jobs | measure).count # How many jobs are working?
$jobs | select name, @{Name="LatestRun"; Expression = {$_.ScheduleOptions.LatestRunLocal}}, @{Name="LatestState"; Expression = {$_.GetLastState()}} # Give back information
gk87
Influencer
 
Posts: 10
Liked: never
Joined: Fri Jun 09, 2017 11:47 am

Re: Search vbrBackupSession for any warnings or failures

Veeam Logoby v.Eremin » Fri Jul 21, 2017 11:13 am

Seems more or less OK. Don't forget about SQL jobs and tape ones (if you have any):

Code: Select all
Get-VBRTapeJob | where {$_.LastState -ne "Stopped"}

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

Re: Search vbrBackupSession for any warnings or failures

Veeam Logoby gk87 » Wed Aug 02, 2017 10:04 am

I couldn't find anything on the following:

Some sessions are sometimes reported as warning. The session's warning is "Processing finished with warnings at 3/2/2017 1:18:02 AM" which doesn't say much.
The specific warning is located under the warning status of one or more VM's: "Changed block tracking cannot be enabled: one or more snapshots present.".

Is it somehow possible to exclude specific warnings and report the session as Success if no other kind of warnings are present using Powershell?
gk87
Influencer
 
Posts: 10
Liked: never
Joined: Fri Jun 09, 2017 11:47 am

Re: Search vbrBackupSession for any warnings or failures

Veeam Logoby v.Eremin » Wed Aug 02, 2017 11:32 am

VM specific issues are reported in task session log (Get-VBRTaskSession).

So, you will need to:

- Check task session log first
- See whether there are any warnings
- If either there are no warnings or the only warning reported there is the one about snapshot presence, mark such job as successful

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


Return to PowerShell



Who is online

Users browsing this forum: tdewin, v.Eremin and 12 guests