从 SoftLayer 获取磁盘使用情况 API

Get disk usage from SoftLayer API

我正在使用 SoftLayer 创建一个脚本来监控我们的虚拟服务器 API。

我可以通过为每个虚拟服务器获取 blockDevice 和关联的 diskImage 来获取当前磁盘 space,如指定的 here,但我如何才能在每个块设备上获取 used/free space,这样我就可以计算 space 可用的百分比?

这是我目前获取数据的方式:

$server = SoapClient::getClient("SoftLayer_Virtual_Guest", $id, $username, $apikey);
$server->setObjectMask("mask[maxCpu,maxCpuUnits,maxMemory,statusId,status[keyName],bandwidthAllocation,billingCycleBandwidthUsage[amountOut,type],metricTrackingObjectId,billingItem[recurringMonths,nextInvoiceTotalRecurringAmount],datacenter[name,longName],blockDevices[statusId,status[keyName],diskImage[capacity,typeId,type[keyName],units]]]");
$server_data = $server->getObject();

问题是各种块设备只持有对磁盘映像的引用,而磁盘映像又具有 capacity 字段,但似乎 link 实际使用的 space.

抱歉,信息未存储在软层数据库中,您只能从图像模板中查看磁盘使用情况,但从配置的服务器中看不到此类信息。

此致