PowerShell script exchange
Post Reply
spijkerfestijn
Lurker
Posts: 2
Liked: 1 time
Joined: Jul 31, 2024 6:08 am
Full Name: Hans van Dam
Contact:

show backup status of object within a job with mesg..

Post by spijkerfestijn »

We use powershell to display the backupstatus of backup jobs in our xymon monitortool. This works like a charm.
however when I get errors or warnings I want to display these also in my monitoring tool.
I can't figure out how to display the backup status of the VM's that are in the job.

So I get the Job information with
$job = Get-VBRJob -Name 'BackupServersStorage01'

Then I read out the Objects in the job.
$objects = Get-VBRJobObject -Job $job

And then I want to find the status per object to list it..
Server Status Message
====================================
Server01 Success -
Sever02 Warning VSS in use
....
david.domask
Veeam Software
Posts: 2629
Liked: 611 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: show backup status of object within a job with mesg..

Post by david.domask »

Hi Hans,

This information on the result of each task is returned by Get-VBRTaskSession.

The easiest way to get this is to pass a CBackupSession object returned from Get-VBRBackupSession:

$bSess = Get-VBRBackupSession -Name "[that job name]"
$tSess = Get-VBRTaskSession -Session $bSess

$tSess will contain the result for each given task within the job.

Thanks!
David Domask | Product Management: Principal Analyst
spijkerfestijn
Lurker
Posts: 2
Liked: 1 time
Joined: Jul 31, 2024 6:08 am
Full Name: Hans van Dam
Contact:

Re: show backup status of object within a job with mesg..

Post by spijkerfestijn » 1 person likes this post

Thanks.
The commands helped a lot... I only want to display the last status info... so i had to tune a bit

$bSess = Get-VBRBackupSession -Name "[BackupJobName]+[*]" | Sort creationtime -Descending | select -First 1
$tSess = Get-VBRTaskSession -Session $bSess | select-object Name,Status,Retrycounter | Sort-Object Name
Then walking through the tSess object and do the xymon magic.
david.domask
Veeam Software
Posts: 2629
Liked: 611 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: show backup status of object within a job with mesg..

Post by david.domask »

Glad to hear you got it going :) And naturally, the data you want is bespoke, so I left that off, but glad you got what you needed. (and indeed CreationTime with -Descending is in almost all of my functions that have to do with session parsing so that the most recent is always first)
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests