HPE SimpliVity

Simplivity Total Backup Report

 
sampiyonts
Frequent Advisor

Simplivity Total Backup Report

Hello,

Is it possible In 4.0.0 version, is there a script how much data used for total backup and  for backup report per virtual server

4 REPLIES 4
Shivam1
HPE Pro

Re: Simplivity Total Backup Report

Hi,

 

This feature is availaible in 4.0.1 as SimpliVity backup reporting for a centrally managed federation (MVA) and not 4.0.0.

 

HPE Employee


I work for HPE

Accept or Kudo

guan8
Advisor

Re: Simplivity Total Backup Report

I recently wrote a powershell script that uses the Simplivity REST API and calculates the unique size (physical storage consumption) of all backups. It returns the 50 most disk consuming ones, or all of them if you want. I'm a powershell newbie, so it's kind of ugly, but it works. I think it's pretty self explanatory and I also commented it.

The first time you run it, it will calculate a lot of backups, because you haven't calculated any of them before, so you might want to monitor that the first time. I don't know how CPU intensive it is, but I didn't notice anything and we have 2000 backups on a 2 node cluster.

I run this script every night and e-mail myself the results.

Oh, and it uses Windows Subsystem for Linux because I couldn't be bothered with working out how curl works in powershell...

/Gustav

 

 

#fetches all Simplivity backups, calculates their unique backup size and returns the 50 biggest backups. //Gustav 2020-07-22

$auth = $null
$result = $null
$backupArr = $null
$reportString = ""
$ovcIP = "x" # change me
$ovcUsername = "y" # change me
$ovcPassword = "z" # change me

#fetch token.
$auth = (wsl curl -k https://simplivity@$ovcIP/api/oauth/token -d grant_type=password -d username=$ovcUsername -d password=$ovcPassword) | convertfrom-json
$token = $auth.access_token

#fetch all backups. maximum number for the "limit" query parameter is 3000, so don't edit that to be any higher.
$result = (wsl curl -k https://simplivity@$ovcIP/api/backups?limit=3000 -H "Authorization: Bearer $($token)") | convertfrom-json

#calculate unique backup size for backups not yet calculated.
$counter = 0

foreach ($backup in $result.backups) {
  if ($backup.unique_size_timestamp -eq "NA") {
    $counter++
    write-host "`n`n$($backup.virtual_machine_name) $($backup.name) unique backup size has not been calculated yet. Calculating...`n"
    wsl curl -XPOST -k "https://simplivity@$ovcIP/api/backups/$($backup.id)/calculate_unique_size" -H "Authorization: Bearer $($token)" -H "Content-Type: application/vnd.simplivity.v1.1+json" -H "Content-Length: 0"
  }
}

$reportString += "$($counter) backups calculated for its unique backup size.`n`n"

#get unique backup size in MB for all backups that have been calculated and consume more than 0 bytes of space.
foreach ($backup in $result.backups) {
  if ($backup.unique_size_timestamp -ne "NA" -And $backup.unique_size_bytes -ne 0) {
    $sizeInMB = [math]::Round($backup.unique_size_bytes / 1024 / 1024)
    $backupArr += @(@{name=$backup.virtual_machine_name; cluster=$backup.omnistack_cluster_name; backupName=$backup.name; size=$sizeInMB})
  }
}

#sort the array of backups by unique backup size and include only the 50 biggest objects. modify this value if you want to return more or less results.
$backupArr = $backupArr | Sort-Object {$_.size} -descending | select-object -first 50

foreach ($obj in $backupArr) {
  $reportString += "VM: $($obj.name). Backup: $($obj.backupName). Cluster: $($obj.cluster). Size: $($obj.size) MB`n"
}

$to = ""
$from = ""
$smtpServer = ""
$subject = "SVT backup size"

Send-MailMessage -from $from -to $to -subject $subject -body $reportString -smtpServer $smtpServer -encoding "utf8"

 

 

 

sampiyonts
Frequent Advisor

Re: Simplivity Total Backup Report

Hello,

I create a case to HPE send to us a script, now we are try,

steez
Frequent Advisor

Re: Simplivity Total Backup Report

It looks like the script is not working in Windows 11.

In order to use the script I needed to get Linux Subsystem for Windows, which requires Windows insider programme. Script worked great until the programme decided to enroll the computer to Windows 11.

Error:

convertfrom-json Invalid JSON primitive W.
At CalculateUniqueBackup.ps112 char158
+ ... ovcUsername -d password=$ovcPassword) Out-String convertfrom-json
+ ~~~~~~~~~~~~~~~~

Tried both -RAW and Out-String parameters, they dont work.

It has issues with the ConvertFrom-JSON, tried different PS versions, no luck.