Child pages
  • WHM API 1 Functions - getdiskusage
Skip to end of metadata
Go to start of metadata

 

Description

This function retrieves the server's drive partition information.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/getdiskusage?api.version=1
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/getdiskusage?api.version=1
 Command Line
whmapi1 getdiskusage


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
  "data": {
    "partition": [
      {
        "disk": "mapper/vg_sandbox-lv_root",
        "filesystem": "/dev/mapper/vg_sandbox-lv_root",
        "mount": "/",
        "used": 13817704,
        "percentage": 48,
        "total": 30487496,
        "available": 15121096
      },
      {
        "disk": "vda1",
        "filesystem": "/dev/vda1",
        "mount": "\/boot",
        "used": 92388,
        "percentage": 20,
        "total": 495844,
        "available": 377856
      }
    ]
  },
  "metadata": {
    "version": 1,
    "reason": "Successfully retrieved disk usage",
    "result": 1,
    "command": "getdiskusage"
  }
}
 Output (XML)
<result>
    <data>
        <partition>
            <disk>mapper/vg_sandbox-lv_root</disk>
            <filesystem>/dev/mapper/vg_sandbox-lv_root</filesystem>
            <mount>/</mount>
            <used>13817836</used>
            <percentage>48</percentage>
            <total>30487496</total>
            <available>15120964</available>
        </partition>
        <partition>
            <disk>vda1</disk>
            <filesystem>/dev/vda1</filesystem>
            <mount>/boot</mount>
            <used>92388</used>
            <percentage>20</percentage>
            <total>495844</total>
            <available>377856</available>
        </partition>
    </data>
    <metadata>
        <version>1</version>
        <reason>Successfully retrieved disk usage</reason>
        <result>1</result>
        <command>getdiskusage</command>
    </metadata>
</result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

   

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
partitionhashA hash of drive partition information.

This hash includes the diskfilesystemmountusedpercentagetotal, and available returns.

 

disk

string

The filesystem's label.

The function returns this value in the partition hash.

A valid string.
vda1

filesystem

string

The filesystem's location.

The function returns this value in the partition hash.

An absolute directory path./dev/vda1

mount

string

The filesystem's mount point.

The function returns this value in the partition hash.

A valid string./boot

used

integer

The filesystem's disk space used.

The function returns this value in the partition hash.

A positive integer, measured in kilobytes.92388

percentage

integer

The percent of the filesystem's total disk space used.

The function returns this value in the partition hash.

A positive integer.20

total

integer

The filesystem's total disk space allocated.

The function returns this value in the partition hash.

A positive integer, measured in kilobytes.
495844

available

integer

The filesystem's disk space unused.

The function returns this value in the partition hash.

A positive integer, measured in kilobytes.
377856