0
votes

I am creating a script for monitoring our virtual servers using the SoftLayer API.

I am able to get the current disk space by getting the blockDevice and associated diskImage for each virtual server, as specified here, but how can I get the used/free space on each block device, so I can compute the percent of space available?

Here is how I'm currently fetching the data:

$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();

The problem is that the various block devices only hold a reference to the disk images, which in turn have a capacity field, but nothing that seems to link to the actual used space.

1

1 Answers

1
votes

sorry that information is not stored in softlayer database, you only can see the disk usage from image templates, but from provisioned servers there is not such information.

Regards