-
- Influencer
- Posts: 12
- Liked: 1 time
- Joined: Jul 12, 2021 6:30 pm
- Full Name: Juan Palmero
- Contact:
How to get Used Space from Repository
Hello,
I have a number of S3-compatible repositories that reside on a Cloudian storage array. I'd like to put together a PS script that reports on used space.
On my Veeam console under Backup Repositories I see several "buckets" that show the "Used Space" for each bucket.
Any suggestions on which PS command to use?
Thank you.
I have a number of S3-compatible repositories that reside on a Cloudian storage array. I'd like to put together a PS script that reports on used space.
On my Veeam console under Backup Repositories I see several "buckets" that show the "Used Space" for each bucket.
Any suggestions on which PS command to use?
Thank you.
-
- Veeam Software
- Posts: 2010
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: How to get Used Space from Repository
Hi Juan,
Does the method below reflect the actual used size for your s3 compatible repos?
Thanks,
Oleg
Does the method below reflect the actual used size for your s3 compatible repos?
Code: Select all
$repo = Get-VBRObjectStorageRepository -Type AmazonS3Compatible
[Veeam.Backup.Core.CBackupRepository]::CalcArchiveRepositoryUsedSizeByIndices($repo.Id)
Oleg
-
- Influencer
- Posts: 12
- Liked: 1 time
- Joined: Jul 12, 2021 6:30 pm
- Full Name: Juan Palmero
- Contact:
Re: How to get Used Space from Repository
Hi Oleg,
First of all, I really appreciate your taking the time to help. Here is additional information; I'm fairly new to Veeam, recently installed, it is functional, but I'm still in the process of configuration. I have a Cloudian array that is S3 compatible, and used for immutable backups as a scale out repository (SOBR).
The first statement works. It returns an array of the repositories. Here is an example of one of them:
On the console, under "Backup Infrastructure" "Backup Repositories" I see that this specific bucket has used 33TB.
However, the second command throws an error:
Again, thank you.
First of all, I really appreciate your taking the time to help. Here is additional information; I'm fairly new to Veeam, recently installed, it is functional, but I'm still in the process of configuration. I have a Cloudian array that is S3 compatible, and used for immutable backups as a scale out repository (SOBR).
The first statement works. It returns an array of the repositories. Here is an example of one of them:
Code: Select all
AmazonS3Folder : PRD
ServicePoint : https://s3-west.mydomain.intranet
BackupImmutabilityEnabled : True
ImmutabilityPeriod : 15
Type : AmazonS3Compatible
UseGatewayServer : False
GatewayServer :
SizeLimitEnabled : False
SizeLimit : 10240
Id : 45eb2fc1-0418-4475-94be-f6846fec2832
Name : bkup_rep-object-cloudian_veeam.prd
Description : Cloudian S3 - veeam.prd
Code: Select all
Name Type Capacity Free Used Description
bkup_rep-object-cloudian_veeam.prd S3-Compatible N/A N/A 33TB Cloudian S3 - veeam.prd
Code: Select all
PS > Veeam.Backup.Core.CBackupRepository]::CalcArchiveRepositoryUsedSizeByIndices($repo.Id)
Veeam.Backup.Core.CBackupRepository]::CalcArchiveRepositoryUsedSizeByIndices : The term
'Veeam.Backup.Core.CBackupRepository]::CalcArchiveRepositoryUsedSizeByIndices' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At line:1 char:1
+ Veeam.Backup.Core.CBackupRepository]::CalcArchiveRepositoryUsedSizeBy ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Veeam.Backup.Co...edSizeByIndices:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
-
- Veteran
- Posts: 643
- Liked: 312 times
- Joined: Aug 04, 2019 2:57 pm
- Full Name: Harvey
- Contact:
Re: How to get Used Space from Repository
Hey Juan,
Check your syntax, you dropped a "[" character at the start
Oleg is calling .NET methods here with Powershell Reflections, and you just missed the opening bracket.
Edit: oh! sorry Juan, actually you did nothing wrong Oleg just had a copying error it looks and his code got truncated.
Change it to:
and see if it works.
Check your syntax, you dropped a "[" character at the start
Oleg is calling .NET methods here with Powershell Reflections, and you just missed the opening bracket.
Edit: oh! sorry Juan, actually you did nothing wrong Oleg just had a copying error it looks and his code got truncated.
Change it to:
Code: Select all
[Veeam.Backup.Core.CBackupRepository]::CalcArchiveRepositoryUsedSizeByIndices($repo.Id)
-
- Veeam Software
- Posts: 2010
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: How to get Used Space from Repository
Hey Juan,
Harvey is right, my bad. I had "[" truncated for some reason, sorry for that.
Fixed it in my initial script.
Please have a look.
Oleg
Harvey is right, my bad. I had "[" truncated for some reason, sorry for that.
Fixed it in my initial script.
Please have a look.
Oleg
-
- Influencer
- Posts: 12
- Liked: 1 time
- Joined: Jul 12, 2021 6:30 pm
- Full Name: Juan Palmero
- Contact:
Re: How to get Used Space from Repository
Unfortunately still getting an error.
In case it makes a difference, note that I'm using the power shell environment launched from the Veeam console while logged into the backup server itself.
Thank you.
Juan.
Code: Select all
PS C:\> [Veeam.Backup.Core.CBackupRepository]::CalcArchiveRepositoryUsedSizeByIndices($repo.Id)
Cannot convert argument "repositoryId", with value: "System.Object[]", for "CalcArchiveRepositoryUsedSizeByIndices" to
type "System.Guid": "Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Guid"."
At line:1 char:1
+ [Veeam.Backup.Core.CBackupRepository]::CalcArchiveRepositoryUsedSizeB ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument
PS C:\>
Thank you.
Juan.
-
- Veeam Software
- Posts: 2010
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: How to get Used Space from Repository
It looks like you have an array of repositories held in $repo, and CalcArchiveRepositoryUsedSizeByIndices() method receives a single object only.
You need to explicitly choose one repo you would like to get this info for:
or loop through each repo if you want to get used space property for all of them:
Thanks!
You need to explicitly choose one repo you would like to get this info for:
Code: Select all
# Option 1. By name
$repo = Get-VBRObjectStorageRepository -Type AmazonS3Compatible -Name 'bkup_rep-object-cloudian_veeam.prd'
[Veeam.Backup.Core.CBackupRepository]::CalcArchiveRepositoryUsedSizeByIndices($repo.Id)
# Option 2. By index
$repo = Get-VBRObjectStorageRepository -Type AmazonS3Compatible
[Veeam.Backup.Core.CBackupRepository]::CalcArchiveRepositoryUsedSizeByIndices($repo[0].Id)
Code: Select all
$repos = Get-VBRObjectStorageRepository -Type AmazonS3Compatible
foreach ($repo in $repos) {
$usedSpace = [Veeam.Backup.Core.CBackupRepository]::CalcArchiveRepositoryUsedSizeByIndices($repo.Id)
$repo | select Name, Description, @{n='UsedSpace';e={$usedSpace}}
}
-
- Influencer
- Posts: 12
- Liked: 1 time
- Joined: Jul 12, 2021 6:30 pm
- Full Name: Juan Palmero
- Contact:
Re: How to get Used Space from Repository
Hi Oleg,
I don't know how I missed the fact that it returns an array. It's now working with the the foreach loop.
Really appreciate yours and everyone else's help!
Now all I need is to do is figure out how to launch the script as a scheduled task from one of the servers that we use to schedule such reports. I'm finding out that when launching from a remote server I first need to connect to my Veeam server using Connect-VBRServer. However, this command requires server name, port and credentials. Is there a way to run remotely within the context of a service account without providing the credentials in clear text?
Thanks again.
I don't know how I missed the fact that it returns an array. It's now working with the the foreach loop.
Really appreciate yours and everyone else's help!
Now all I need is to do is figure out how to launch the script as a scheduled task from one of the servers that we use to schedule such reports. I'm finding out that when launching from a remote server I first need to connect to my Veeam server using Connect-VBRServer. However, this command requires server name, port and credentials. Is there a way to run remotely within the context of a service account without providing the credentials in clear text?
Thanks again.
-
- Influencer
- Posts: 12
- Liked: 1 time
- Joined: Jul 12, 2021 6:30 pm
- Full Name: Juan Palmero
- Contact:
Re: How to get Used Space from Repository
One question, you used CalcArchiveRepositoryUsedSizeByIndices. Is there documentation or some list of what other methods are exposed? I would also like to get total TB capacity on my Cloudian to perform some calculations.
Thanks again.
Thanks again.
-
- Veeam Software
- Posts: 2010
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: How to get Used Space from Repository
Hey Juan,
If you want to dig into .NET, a good way to begin with would be to explore an output of different cmdlets with Show-Object cmdlet from PowershellCookbook module.
A more advanced way would be to use any .NET assembly decompiler to read .NET assembly members and search through them.
Hope it helps,
Oleg
You could save VBR server's credentials to credentials manager on the server where VBR console is installed, get them and pass to connect cmdlet.Is there a way to run remotely within the context of a service account without providing the credentials in clear text?
.NET classes and methods is rather unofficial way to interact with VBR resources. We usually provide those as a workaround if something is not yet covered with our Powershell API. All you see in the Powershell documentation is, in contrast, and thus supported.Is there documentation or some list of what other methods are exposed?
If you want to dig into .NET, a good way to begin with would be to explore an output of different cmdlets with Show-Object cmdlet from PowershellCookbook module.
A more advanced way would be to use any .NET assembly decompiler to read .NET assembly members and search through them.
If you are talking about the Capacity like reflected in VBR console, in powershell it is reflected in SizeLimit property of your S3 compatible repo:I would also like to get total TB capacity on my Cloudian to perform some calculations.
Code: Select all
$s3 = Get-VBRObjectStorageRepository -Name 'repo' -Type AmazonS3Compatible
$s3.SizeLimit
Oleg
Who is online
Users browsing this forum: No registered users and 22 guests