Search code examples
phppythonibm-cloud-infrastructure

SoftLayer - getting bandwidth usage by datacenter


Similar to another posted question at softlayer - getting bandwidth usage per datacenter , my question(s):

How can I use the API get a value (not graph) that represents the amount of bandwidth used by our entire account (1), and by specific data centers (2).

Which API calls are the correct entries to accomplish these goals? We are prototyping in PHP, but Python is also welcome.


Solution

  • Unfortunately, It's not possible making a single call, but this can be a workaround:

    Retrieve Vitual Guests and Hardware objects from account

    Then, we should get the bandwidth data, from each one with the following request:

    If you want for a specific datacenter, it is necessary to filter the hardware objects and virtual guests per datacenter.

    Here a Rest request, to filter for Dal05 datacenter. The same idea should be applied for hardware objects.

    https://$user:$apiKey@api.softlayer.com/rest/v3.1/SoftLayer_Account/getVirtualGuests?objectMask=mask[datacenter]&objectFilter={"virtualGuests":{"datacenter":{"name":{"operation":"dal05"}}}}
    
    Method: Get