View Source

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

You can find the PHP file {{Disk_usage_for_all_volumes.php}} at the following locations:
* for Windows: {{<installdir>\apisamples}}
* for Linux: {{<installdir>/apisamples}}

For more information about using the Server Backup Manager API, see [Access example API functions].

This PHP script finds all volumes available to the logged-in user, and then displays the following information for each volume:
* Volume ID
* Name
* Description
* Path
* Quota Type
* Soft Quota
* Hard Quota
* On Disk Size (in bytes)
* Size Of Deltas (in bytes)
* Total Delta Size (in bytes)

If the limits are exceeded, SBM displays the following messages:
* "Soft Quota has exceeded the limit"
* "Hard Quota has exceeded the limit"


h4. Sequence of automated actions

This script allows you to:

# Find all volumes.
# Display information for each volume
{newversion}

h4. How to fulfill appropriate actions in the Server Backup 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.

h5. Defining server configuration variables
{code}
########====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====########
{code}
Log in to the Backup Manager user interface using your username and password.

!Enterprise_login form_English.png!

h5. Displaying volumes information
{code}
########====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====########
{code}

1. In the Main menu, click *Volumes*.


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

*Columns*:

* *Name* \- Name used to identify the Volume in the system. For example, to assign a Volume to the Disk Safe, you need to select a Volume name from the drop-down menu.
* *Description* \- Additional information describing the Volume. The Description is displayed in the Volumes list.
* *Volume Path* \- Absolute path to the directory where the Volume is located. Example: {{c:\main_volume}}, {{/volume1}}.
* *Quota Type* \- Quotas are set to limit the disk usage of the Volume. It can be "On Disk Size" or "Size of Deltas in Disk Safe." See a detailed description in Creating Volumes.
* *Soft Quota* \- Value in bytes, KB, MB, GB, or TB representing the&nbsp;threshold&nbsp;at which users are informed that they are close to reaching their effective data usage limit.
* *Hard Quota* \- Value in bytes, KB, MB, GB, or TB representing the maximum amount of resources allowed to be occupied by data.
* *On Disk Size* \- Value in bytes showing the amount of disk space occupied by the Volume.
* *Deltas* \- Value in bytes representing the amount of data that has changed since the last backup run.

!Volumes list_2 volumes_English.png!


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