REST API knowledge exchange
Post Reply
sturmtr
Service Provider
Posts: 11
Liked: never
Joined: Jul 25, 2022 10:30 am
Contact:

Veeam VBR (Enterprise Manager) Quota

Post by sturmtr »

Hello all,

We would like to prepare a report to our customers about their quota usage.
We will trigger an alarm (email) when their quota reaches >%80.
We are a service provider and using vloud director plugin for quota limitations over enterprise manager.

I have been searching for a method to get customer (using organization id) quota but couldnt manage to do so.
I have also looked at these below links, I think there are related with VCC?

https://github.com/wombatonfire/veeam-p ... Report.ps1

It will be great if you can provide me a script or commands to get quota information.
In our vbrvientity output we have organization id in name field, does this output contains quota?
I will be able to gather backup size usage and compare these two.
Can you help me please?
Mildur
Product Manager
Posts: 9848
Liked: 2607 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Veeam VBR (Enterprise Manager) Quota

Post by Mildur »

Hello Sturmtr

Have you tried the enterprise managers REST API? It allows you to query the following values for all vCloud orgs:
https://helpcenter.veeam.com/docs/backu ... ml?ver=110

<QuotaGb>500</QuotaGb>
<UsedQuotaMb>0</UsedQuotaMb>


Thanks
Fabian
Product Management Analyst @ Veeam Software
sturmtr
Service Provider
Posts: 11
Liked: never
Joined: Jul 25, 2022 10:30 am
Contact:

Re: Veeam VBR (Enterprise Manager) Quota

Post by sturmtr »

Hello Fabian,

Thank you for your reply but we are not familiar with RestAPI.
We can try it in the last resort but I think it will take time to learn.
Mildur
Product Manager
Posts: 9848
Liked: 2607 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Veeam VBR (Enterprise Manager) Quota

Post by Mildur »

Let me see if I can provide you with the correct PowerShell cmdlets to get this data from our Rest API.
I already have the query with curl:

Code: Select all

# Authentificate against RestAPI:
curl -X POST -k -v -u <username>:<password> https://<EM-SERVER>:9398/api/sessionMngr/?v=latest -H "Content-Length: 0"

# Querying vOrgs with their quota seeing and quota used:
curl --location --request GET "https://<EM-SERVER>:9398/api/vCloud/orgConfigs?format=Entity" --header "X-RestSvcSessionId: <Use the value from the auth request>"
Update: PowerShell example:

Code: Select all

# Authorization
$credentials = Get-Credential
$response = Invoke-WebRequest "https://<EM-SERVER>:9398/api/sessionMngr/?v=latest" -Method Post -Credential $credentials

# Create header for query
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("X-RestSvcSessionId", $response.Headers["X-RestSvcSessionId"])
$headers.Add("Content-Type", "application/json")

# Query the endpoint
$response = Invoke-RestMethod "https://<EM-SERVER>:9398/api/vCloud/orgConfigs?format=Entity" -Method Get -Headers $headers

# Display Tenant Name with Friendly Repository Name and Quota/UsedQuota
$response.VCloudOrganizationConfigs | select name,RepositoryFriendlyName,QuotaGb,UsedQuotaMb
Product Management Analyst @ Veeam Software
Mildur
Product Manager
Posts: 9848
Liked: 2607 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Veeam VBR (Enterprise Manager) Quota

Post by Mildur »

Hi Sturmtr

I added an example for PowerShell. You can use it to query quota usage with REST API from your EM server.
For the org ID. Could you explain to me which ID you are referring to? Is it an ID in VBR or vCloud Director?

Thanks
Fabian
Product Management Analyst @ Veeam Software
sturmtr
Service Provider
Posts: 11
Liked: never
Joined: Jul 25, 2022 10:30 am
Contact:

Re: Veeam VBR (Enterprise Manager) Quota

Post by sturmtr »

Hello Mildur,

You are great :)

Sharing sampling output, these are what we want actually.
This is org id from vcloud.

Note: Just to add for other users maybe, include -UseBasicParsing if you get error during invoke.

Name RepositoryFriendlyName QuotaGb UsedQuotaMb
---- ---------------------- ------- -----------
76590471 ICT4 Backup Repository 35000 0
11277161 ICT4 Backup Repository 1000 0
76522864 ICT4 Backup Repository 60000 0
76509893 ICT4 Backup Repository 13000 0
76083303 ICT4 Backup Repository 30000 0
11121396 ICT4 Backup Repository 500 0
76509908 ICT4 Backup Repository 70000 11492534
Mildur
Product Manager
Posts: 9848
Liked: 2607 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Veeam VBR (Enterprise Manager) Quota

Post by Mildur »

I believe we don't expose the vCloud Org API with RestAPI or PowerShell.
Also "quota" is a setting of the enterprise manager. The enterprise manager doesn't have an integration with PowerShell.
So RestAPI must be used for automation.

Could you create a mapping table with PowerCLI and Get-Org. Then map the retrieved name from Get-Org to the name you get with the EM RestAPI? That should allow you to link the OrgID to the quota.
https://developer.vmware.com/docs/power ... g/#Default

Thanks
Fabian
Product Management Analyst @ Veeam Software
sturmtr
Service Provider
Posts: 11
Liked: never
Joined: Jul 25, 2022 10:30 am
Contact:

Re: Veeam VBR (Enterprise Manager) Quota

Post by sturmtr »

Hello,

I am trying to get orgid and mail adress as a parameter.
As we already have this information per customer we will pass this to script and get quota just for that.

param ($orgid,$mail1,$mail2)

In order to get usage from just this organization, I think I will need uuid of this first and call rest api using "/vCloud/orgConfigs/{ID}" right?
I have actually tried but couldnt get data.

Thanks.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Veeam VBR (Enterprise Manager) Quota

Post by oleg.feoktistov »

Hi,

Moved this topic to REST API section since it concerns mainly EM REST now.
By default what you get with /vCloud/orgConfigs/{id} is of reference type with UID, Name and Links only. You need to append ?format=Entity to the endpoint path to receive a response of Entity type with all the information:
/vCloud/orgConfigs/{id}?format=Entity

Thanks,
Oleg
sturmtr
Service Provider
Posts: 11
Liked: never
Joined: Jul 25, 2022 10:30 am
Contact:

Re: Veeam VBR (Enterprise Manager) Quota

Post by sturmtr »

Hi,

I have been runnig this script for a while.
But I have now noticed that it has started to get an error as below.
It seems to be a certificate problem? Any idea?

$response = Invoke-WebRequest "https://link:9398/api/sessionMngr/?v=latest" -Method Post -Credential $credentials -UseBasicParsing
Invoke-WebRequest : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS
secure channel.
At line:1 char:13
Mildur
Product Manager
Posts: 9848
Liked: 2607 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Veeam VBR (Enterprise Manager) Quota

Post by Mildur »

You have to use a valid cert for the RestAPI service or disable certficiate check for your powershell session:
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
Product Management Analyst @ Veeam Software
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests