API - Displaying Disk Usage for All Volumes

The following example demonstrates how to display disk usage for all Volumes.

A PHP file called Disk_usage_for_all_volumes.php can be found in <installdir>/apisamples. Read more in Accessing Example API Functions.

The PHP script finds all Volumes available to the User and prints the following result messages for each Volume on the screen:

If the limits have been exceeded, you will receive the following messages:

Sequence of Automated Actions

The following steps can be accomplished by using this script:

  1. Find all Volumes.
  2. Display information for each Volume

How to Fulfill Appropriate Actions in CDP User Interface

Below, you can find the steps to take in the program user interface in order to perform the same actions as the script. We also provide you with screen-shots illustrating the scripts for every step.


Defining server configuration variables | Displaying Volumes Information

Defining server configuration variables

########====CDP Server Configuration Start====######## #set CDP server host name $HOST="127.0.0.1"; #set CDP server to access API $PORT="9443"; #set CDP user $USER="admin"; #set CDP user password $PASS="admin"; ########====CDP Server Configuration End====########

Log in to the CDP Server user interface using your username and password.

Displaying Volumes Information

########====Get Volumes Start====######## try{ $volumeClient = new soapclient("https://$HOST:$PORT/Volume?wsdl", array('login'=>"$USER", 'password'=>"$PASS", 'cache_wsdl' => WSDL_CACHE_NONE, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'trace'=>1) ); $allVolumeForUser=$volumeClient->getVolumes(); foreach($allVolumeForUser->return as $tmp){ echo "ID : $tmp->id \n"; echo "NAME : $tmp->name \n"; echo "DESCRIPTION : $tmp->description \n"; echo "PATH : $tmp->path \n"; echo "QUOTA TYPE : $tmp->quotaType \n"; echo "SOFT QUOTA LMIT : $tmp->softQuota \n"; echo "HARD QUOTA LMIT : $tmp->hardQuota \n"; echo "OnDiskSize : $tmp->onDiskSize bytes \n"; echo "SizeOFDeltas : $tmp->sizeOfDeltas bytes \n"; echo "TotalDeltaSize : $tmp->totalDeltaSize bytes \n"; if ($tmp->quotaType == "ON_DISK_SIZE"){ if ($tmp->softQuota < $tmp->onDiskSize){ echo "Soft Quota has exceeded the limit \n"; } if ($tmp->hardQuota < $tmp->onDiskSize){ echo "Hard Quota has exceeded the limit \n"; } } else if ($tmp->quotaType == "SIZE_OF_DELTAS_IN_DISK_SAFE"){ if ($tmp->softQuota < $tmp->sizeOfDeltas){ echo "Soft Quota has exceeded the limit \n"; } if ($tmp->hardQuota < $tmp->sizeOfDeltas){ echo "Hard Quota has exceeded the limit \n"; } } echo "\n"; } exit(0); } catch (SoapFault $exception) { echo $exception; exit(1); } ########====Get Volumes End====########

1. Click on "Volumes" in the Main Menu to access the Volumes page.

2. The Volumes list provides information about Volumes in grid format.

Columns:

The "Details" pane provides detailed information about the Volume selected in the list.