Link Search Menu Expand Document

Billing - Storage

Storage Consumption

Obtaining storage consumption statistics from VCD tenants requires querying several Veeam Backup Enterprise Manager REST API endpoints and aggregating the numbers in the client code.

Workflow

  1. Get a list of tenants

    GET /api/vCloud/orgConfigs.
    When using XML we are interested in the “Name” attribute of the first level element (JSON responses basically reflect the same structure. Using XML is easier as it allows to get specific elements with XPath):

    Tenants

    Warning: it also returns “default” configuration so you might want to filter out the configuration named “Other organizations”.

  2. Map tenants to jobs.

    The source of the jobs information is GET /api/jobs. Response looks like this:

    Tenants

    In this response we are interested in two attributes: Name and UID.

    Names are needed for mapping jobs to tenants. Veeam Backup and Replication prefixes all jobs created by the VCD tenants with “TENANTNAME_”, this is how we can do the mapping while the respective properties are not exposed in the API.

    Algorithmically you can do the mapping in several ways. In the end we need to get a map of tenants and its jobs. Example:

     {
         "Tenant1": 
         {
             "Tenant1_Backup Job": "urn:veeam:Job:62638c60-74b6-4d6d-8d13-4cd32039f522"
         },
         "Tenant2":
         {
             "Tenant2_VMs Backup": "urn:veeam:Job:da4a15c2-04e7-4135-b876-577249d3d720"
         }
     }
    

    For the next steps, we need either names or UIDs. We will use UIDs as they are generally more reliable.

  3. Get information about backups

    Provided we have the mapping, the following steps are pretty straightforward. Now we need to get the list of backups created by the job. For this we use the query service and filter by:

    GET /api/query?type=Backup&filter=JobUid==UID

    For every job, we are interested in where the UID is the corresponding value. The result of the query will be similar to this:

    Tenants

    In normal conditions there should be only one result here. In this response we are interested in the Link of type BackupFileReferenceList or alternatively you can construct it yourself by taking Href attribute.

  4. Get backup files details.

    This is the final step where we get the actual numbers. The issue here is that the link we got previously is of BackupFileReferenceList type and this endpoint will return object references that do not contain any backup files’ details.

    The simplest way to get what we need is to just manually add the “?format=Entity” query parameter to BackupFileReferenceList to get similar to

    https://hostname:9398/api/backups/086c40ab-4fc5-4b41-b913-c097cb425932/backupFiles?format=Entity.

    This will be the URL we need to GET in order to obtain a list of backup files with the necessary numbers including size, compression ratio and some others. These will be returned in XML elements:

    Tenants

    At this point it is just a matter of aggregating these numbers and some math to get a per-tenant usage.

NOTE: Currently there is no official and supported way to get Performance/Capacity Tier Usage information.


Back to top

Copyright © 2019-2022 Solutions Architects, Veeam Software.