Discussions related to using object storage as a backup target.
Post Reply
ConradGoodman
Expert
Posts: 109
Liked: 5 times
Joined: Apr 21, 2020 11:45 am
Full Name: Conrad Goodman
Contact:

SOBR offload report improvements.

Post by ConradGoodman »

I cannot find a way to get a report that tells me if a backup has successfully offloaded to the capacity tier.

I have been through this with support, and they said the only report is an RPO monitor, which only fires for the performance tier. Alongside the standard job success report, but it doesn't trigger a warning or failure if it doesn't get offloaded to Capacity Tier.

I get a daily email report: "Scale-out backup repository - $repository name".

This is very limited in use as I have to open the email for each repository and check for 'Success'.

I can't find any monitoring for this in Veeam ONE, I can't find any way to fire an SNMP trap or email.

It is so important that our backups are in capacity tier, yet I am currently having to manually read all these emails.

Is there a way around this, or a feature in the pipeline for v11?
dalbertson
Veeam Software
Posts: 492
Liked: 175 times
Joined: Jul 21, 2015 12:38 pm
Full Name: Dustin Albertson
Contact:

Re: SOBR offload report improvements.

Post by dalbertson » 3 people like this post

Hi

You can poll powershell for some stats....I will take the Feature Request as well.

The code below would print out the offload tasks and their status

Code: Select all

Connect-VBRServer -server "servername"
$sobrOffload = [Veeam.Backup.Model.EDbJobType]::ArchiveBackup #This type corresponds to SOBR Offload job
$jobs = [Veeam.Backup.Core.CBackupSession]::GetByTypeAndTimeInterval($sobrOffload,(Get-Date).adddays(-1), (Get-Date).adddays(1)) 
write $jobs
Dustin Albertson | Director of Product Management - Cloud & Applications | Veeam Product Management, Alliances
ConradGoodman
Expert
Posts: 109
Liked: 5 times
Joined: Apr 21, 2020 11:45 am
Full Name: Conrad Goodman
Contact:

Re: SOBR offload report improvements.

Post by ConradGoodman »

That's great, thanks for the code.

I'll get our DevOps guy to roll this out to our nagios environment checking for SUCCESS.
dalbertson
Veeam Software
Posts: 492
Liked: 175 times
Joined: Jul 21, 2015 12:38 pm
Full Name: Dustin Albertson
Contact:

Re: SOBR offload report improvements.

Post by dalbertson »

Just to mention...the offload tasks run automatically every 4 hours. These will show a success as well even if they dont offload data. This may be fine for your use but you could also report on failed to check if there was an issue.
Dustin Albertson | Director of Product Management - Cloud & Applications | Veeam Product Management, Alliances
veremin
Product Manager
Posts: 20727
Liked: 2398 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: SOBR offload report improvements.

Post by veremin » 1 person likes this post

Small clarification:

* move offload session is executed automatically every 4 hours
* copy session is executed automatically upon completion of a backup (or backup copy) job

Thanks!
Gostev
Chief Product Officer
Posts: 32309
Liked: 7656 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: SOBR offload report improvements.

Post by Gostev »

Actually, copy session starts the moment a backup file for any machine is created... there's no waiting for the entire backup or backup copy job completion.
lmbutault
Service Provider
Posts: 32
Liked: 7 times
Joined: Oct 21, 2011 2:11 pm
Full Name: Louis-Marie BUTAULT
Contact:

Re: SOBR offload report improvements.

Post by lmbutault » 1 person likes this post

Hello folks,
I have created a script that collects all SOBR Offload sessions from 6PM Day-2 to 6PM Day-1, it is scheduled to run at Day just after midnight.
why 6PM ? because it is time when our backup jobs starts for the night, and we have a high load and need about 22 hours per day for all offloads.
So, for correct amount of data calculation, 6PM is the moment we should have no offload sessions running. This because if a session has started before 6PM, all datas amounts transfered before 6PM is also counted.

The output of script is:

A daily HTML page with:
- Global amount of data offload
- number of success and failed sessions
- a graph showing for every session name, when it starts and when it stops and a color code in the text depending on status.
- list of all sessions with start time, stop time, status and quantity of data offloaded
This one is for daily monitoring

In a monthly csv
- quantity of data offload each day
This one this helps us to provision our internet bandwith

It must be planned in the scheduler with an account without MFA.

hope you will like it !

Code: Select all

# Configuration
$hostname = $env:COMPUTERNAME
$server = $hostname
$now = Get-Date
$analysisDate = $now.AddDays(-1).Date
$startTime = $analysisDate.AddDays(-1).AddHours(18)  # From 18:00 the day before yesterday
$endTime = $analysisDate.AddHours(18)  # To 18:00 yesterday
$reportFolderRoot = "C:\scripts\result"
$reportFolder = Join-Path $reportFolderRoot $analysisDate.ToString("yyyy-MM-dd")

# Create daily report folder if it doesn't exist
if (-not (Test-Path $reportFolder)) {
    New-Item -ItemType Directory -Path $reportFolder | Out-Null
}

# Output file names with server name and analysis date
$serverClean = $server -replace '[^a-zA-Z0-9]', '_'
$baseName = "${serverClean}_$($analysisDate.ToString("yyyy-MM-dd"))"
$csvPath = Join-Path $reportFolder "$baseName.csv"
$chartPath = Join-Path $reportFolder "$baseName.png"
$htmlReport = Join-Path $reportFolder "$baseName.html"
$monthlyStatsFile = Join-Path $reportFolderRoot "Monthly_Transferred_$($analysisDate.ToString("yyyy_MM")).csv"

# Connect to local Veeam server
Connect-VBRServer -Server $server

# Retrieve Offload sessions from the specified interval
$sobrOffload = [Veeam.Backup.Model.EDbJobType]::ArchiveBackup
$jobs = [Veeam.Backup.Core.CBackupSession]::GetByTypeAndTimeInterval($sobrOffload, $startTime, $endTime)

# Process job data
$data = @()
foreach ($job in $jobs) {
    $start = $job.CreationTime
    $end = $job.EndTime
    $status = $job.Result.ToString()
    $size = 0

    foreach ($task in $job.GetTaskSessions()) {
        if ($task.Progress -and $task.Progress.TransferedSize -gt 0) {
            $size += $task.Progress.TransferedSize
        }
    }

    $sizeGB = [Math]::Round($size / 1GB, 2)

    $data += [PSCustomObject]@{
        JobName = $job.Name
        StartTime = $start
        EndTime = $end
        Status = $status
        Transferred_GB = $sizeGB
    }
}
Disconnect-VBRServer

# Export session data to CSV
$data | Sort-Object StartTime | Export-Csv -Path $csvPath -NoTypeInformation -Encoding UTF8

# Append daily transfer summary to monthly CSV
$transferredTotal = ($data.Transferred_GB | Measure-Object -Sum).Sum
$dailyLine = "$($analysisDate.ToString("yyyy-MM-dd")),$([Math]::Round($transferredTotal,2))"
if (-not (Test-Path $monthlyStatsFile)) {
    "Date,Transferred_GB" | Out-File -FilePath $monthlyStatsFile -Encoding UTF8
}
Add-Content -Path $monthlyStatsFile -Value $dailyLine

# Generate chart image
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing

$sessionHeight = 16
$sessionSpacing = 2
$graphHeight = ($data.Count * ($sessionHeight + $sessionSpacing)) + 100
$graphWidth = 2000
$bitmap = New-Object Drawing.Bitmap $graphWidth, $graphHeight
$graphics = [Drawing.Graphics]::FromImage($bitmap)
$graphics.SmoothingMode = 'AntiAlias'
$graphics.Clear([Drawing.Color]::White)

$font = New-Object Drawing.Font("Arial", 6)
$greenBrush = New-Object Drawing.SolidBrush ([Drawing.Color]::Green)
$redBrush = New-Object Drawing.SolidBrush ([Drawing.Color]::Red)
$grayBrush = New-Object Drawing.SolidBrush ([Drawing.Color]::LightGray)
$penGrid = New-Object Drawing.Pen ([Drawing.Color]::LightGray), 1
$linePen = New-Object Drawing.Pen ([Drawing.Color]::LightGray), 0.5

# Draw hourly grid lines for 18h (day-1) to 18h (day)
for ($h = 0; $h -le 24; $h++) {
    $displayHour = (18 + $h) % 24
    $x = $h * ($graphWidth / 24)
    $graphics.DrawLine($penGrid, $x, 0, $x, $graphHeight)
    $graphics.DrawString(("{0:00}:00" -f $displayHour), $font, [Drawing.Brushes]::Black, $x + 2, $graphHeight - 15)
}

# Sort sessions oldest to newest (top to bottom)
$dataSorted = $data | Sort-Object StartTime

# Draw sessions
for ($i = 0; $i -lt $dataSorted.Count; $i++) {
    $s = $dataSorted[$i]
    $y = 20 + ($i * ($sessionHeight + $sessionSpacing))

    $x1 = [Math]::Round(($s.StartTime - $startTime).TotalMinutes * ($graphWidth / 1440))
    $x2 = [Math]::Round(($s.EndTime - $startTime).TotalMinutes * ($graphWidth / 1440))
    if ($x1 -lt 0) { $x1 = 0 }
    if ($x2 -gt $graphWidth) { $x2 = $graphWidth }
    if ($x2 -lt $x1) { $x2 = $x1 + 1 }

    $barHeight = $sessionHeight
    $graphics.FillRectangle($grayBrush, $x1, $y, ($x2 - $x1), $barHeight)

    $textBrush = if ($s.Status -eq "Success") { $greenBrush } else { $redBrush }
    $fontStyle = if ($s.Status -eq "Success") { $font } else { New-Object Drawing.Font("Arial", 6, [System.Drawing.FontStyle]::Bold) }

    $textY = $y + ($barHeight - $font.Height) / 2
    $graphics.DrawString($s.JobName, $fontStyle, $textBrush, $x1 + 2, $textY)

    $graphics.DrawLine($penGrid, 0, $y + $barHeight + $sessionSpacing, $graphWidth, $y + $barHeight + $sessionSpacing)
}

# Save chart image
$bitmap.Save($chartPath, [System.Drawing.Imaging.ImageFormat]::Png)
$graphics.Dispose()
$bitmap.Dispose()

# Create HTML report
$successCount = ($data | Where-Object { $_.Status -eq "Success" }).Count
$failCount = ($data | Where-Object { $_.Status -ne "Success" }).Count

$html = @"
<html><head><title>SOBR Offload Report - $server - $($analysisDate.ToString("yyyy-MM-dd"))</title></head>
<body style='font-family: Arial; font-size: 12px;'>
<h2>SOBR Offload Report - $server - $($analysisDate.ToString("yyyy-MM-dd"))</h2>
<p><b>Successful sessions:</b> $successCount<br>
<b>Failed sessions:</b> $failCount<br>
<b>Total transferred:</b> $([Math]::Round($transferredTotal, 2)) GB</p>
<img src='$($baseName).png' style='width:100%; height:auto;'><br><br>
<table border='1' cellspacing='0' cellpadding='4'>
<tr><th>Job Name</th><th>Start</th><th>End</th><th>Status</th><th>Transferred (GB)</th></tr>
"@

foreach ($row in ($data | Sort-Object StartTime)) {
    $style = ""
    if ($row.Status -ne "Success") {
        $style = "style='color:red;font-weight:bold;'"
    }
    $html += "<tr><td $style>$($row.JobName)</td><td $style>$($row.StartTime)</td><td $style>$($row.EndTime)</td><td $style>$($row.Status)</td><td $style>$($row.Transferred_GB)</td></tr>`n"
}

$html += "</table></body></html>"
Set-Content -Path $htmlReport -Value $html -Encoding UTF8
Post Reply

Who is online

Users browsing this forum: Google Adsense [Bot] and 1 guest