PowerShell script exchange
Post Reply
Bureau205
Service Provider
Posts: 3
Liked: never
Joined: Feb 03, 2022 8:58 am
Full Name: Bureau205
Contact:

Powershell - Veeam Job Entime Inconsistent value

Post by Bureau205 »

Hello,

In a supervision context, I work on scripts to be alerted when jobs are running for too long.

I make the difference between the start time of the last running job and the current time to get a value in hours, and if this one is higher than X, the check goes to critical.

However, the value that comes out when I run the command "Get-VBRSession -Job $JobCheck -Last" (where $Jobcheck = Get-VBRJob -Name $args[0]) seems to be wrong.

I let you observe the attached screenshot to see the problem.

Am I doing the wrong commands to get the information I want?

Thanks in advance

Image
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Powershell - Veeam Job Entime Inconsistent value

Post by david.domask » 1 person likes this post

Hi @Bureau205,

I couldn't reproduce in Lab with some simple code:

$Jobs = Get-VBRJob
Foreach($j in $jobs){
$jName = $j.Name
$Sess = Get-VBRSession -Job $j -Last
if($Sess.EndTime -lt $Sess.CreationTime){
$Jname
Write-Host "Start Time = $($Sess.CreationTime)"
Write-Host "End Time = $($Sess.EndTime)"
}
}

This returned clean for me (i.e., no results since nothing met the If condition), and if it was a bug with the Get-VBRSession, I guess I would have expected it to hit on at least one of my jobs, so maybe there is just an issue in the Configuration Database, but it's unclear right now.

Can I ask you to open a case and provide:

1. Copy of the Veeam Configuration Database: https://www.veeam.com/kb1471
2. The job you tested with.
3. Please also provide the Session ID that you tested with in your screenshot (Just do $Sess = Get-VBRSession -Job $JobVariable -Last; $Sess.id)

That should be enough for Support to check what's up with that session entry.
David Domask | Product Management: Principal Analyst
Bureau205
Service Provider
Posts: 3
Liked: never
Joined: Feb 03, 2022 8:58 am
Full Name: Bureau205
Contact:

Re: Powershell - Veeam Job Entime Inconsistent value

Post by Bureau205 »

Hello and thank you for your answer,

I get the same result with your code.

I will open a case to the support with the information you sent me, thank you again, I'll keep you informed!

Edit : Veeam Support Case ID : #02306538
david.domask
Veeam Software
Posts: 1226
Liked: 322 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Powershell - Veeam Job Entime Inconsistent value

Post by david.domask »

Happy to help and thank you for your cooperation! If you could update the thread with the case number once opened, I'll check on the case also and work with my Engineers.
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests