API Get Disk Usage

From Virtualizor Wiki
Jump to: navigation, search

List disk usage of Host server


Parameters Description
serverid If not specified, then Disk Usage of Master Server is returned

Example Code:

<?php

    require_once('admin.php');

    $key =  'uketenhrhpunty5lhgwkcuxxxxxxxxxx';

    $pass = 'yrsofc3tg3tre7bjpfppspxxxxxxxxxx';

    $ip = 'xxx.xxx.xxx.xxx';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $output = $admin->disk();
    
    print_r($output);

?>

Returns:

Array
(
    [/] => Array
        (
            [limit] => 507966.43
            [used] => 363285.05
            [free] => 144681.38
            [limit_gb] => 496.06
            [used_gb] => 354.77
            [free_gb] => 141.29
            [percent] => 71.52
            [percent_free] => 28.48
        )

    [/boot] => Array
        (
            [limit] => 507.95
            [used] => 122.49
            [free] => 385.46
            [limit_gb] => 0.5
            [used_gb] => 0.12
            [free_gb] => 0.38
            [percent] => 24.11
            [percent_free] => 75.89
        )

)