Projected Data for Bandwidth in Softlayer

坚强是说给别人听的谎言 提交于 2019-12-12 03:37:20

问题


I am developing a projected value for bandwidth, but I can't find a projected value for private network. This is my code getting public projected data, but it returns defferent value compared to "Control.softlayer.com".

This is a summary of my questions. 1. How to get a projected data for Private Network. 2. API getting a projected value for Throughput and Usage. 3. How to set a date to get a projected value for a specific period.

private void getVMProjectedData(){
    Guest.Service vsiService = Guest.service(client, 22075687l);
    vsiService.withMask().id().projectedPublicBandwidthUsage();
    Guest guest = vsiService.getObject();

    double usage = guest.getProjectedPublicBandwidthUsage().doubleValue();

    System.out.println("VM public Projected Usage : " + usage);

}

private void getBMProjectedData(){
    Server.Service bmService = Server.service(client, 168805l);
    bmService.withMask().projectedPublicBandwidthUsage();
    Server hd = bmService.getObjectForServer();

    System.out.println("BM public Projected Usage : " + hd.getProjectedPublicBandwidthUsage().doubleValue());

}


回答1:


There’s no an API method that retrieves the Projected value, neither one that generates it based on a specific period of time.

The Projected value is calculated by taking the current usage, dividing it by the current elapsed time (as determined by the most recent data point, not the current time) since the start of the billing period, and multiplying it by the time of the complete billing period.

In order to retrieve the data used for this process/calculations, you could use the next mask:

https://$username:$apiKey@api.softlayer.com/rest/v3.1/SoftLayer_Hardware_Server/$HardwareServerId/getObject.json?objectMask=mask[id,bandwidthAllocation,averageDailyBandwidthUsage,averageDailyPrivateBandwidthUsage,averageDailyPublicBandwidthUsage,bandwidthAllotmentDetail,billingCycleBandwidthUsage[trackingObject],billingCycleBandwidthUsageCount,billingCyclePrivateBandwidthUsage,billingCyclePublicBandwidthUsage,currentBandwidthSummary,currentBillableBandwidthUsage,projectedOverBandwidthAllocationFlag,projectedPublicBandwidthUsage,outboundBandwidthUsage,outboundPrivateBandwidthUsage,outboundPublicBandwidthUsage,inboundBandwidthUsage]

I hope this information could help you.



来源:https://stackoverflow.com/questions/39286157/projected-data-for-bandwidth-in-softlayer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!