API Get CPU Usage

From Virtualizor Wiki
Jump to: navigation, search

Get CPU Usage of Host Node


Parameters Description
serverid If not specified, then CPU 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->cpu();
    
    print_r($output);

?>

Returns:

Array
(
    [manu] => intel
    [limit] => 3100
    [used] => 623.1
    [free] => 2476.9
    [percent] => 20.1
    [percent_free] => 79.9
)