CPU

The CPU API allows you to fetch details of CPU of the Server, by passing the server ID. The details consists of the name of the cpu, processing limit of the cpu, utilization of the cpu and the available processing speed for the Server.

HTTP Request

https://hostname:4085/index.php?act=manageserver&changeserid=SERVERID

Parameters

NameMethodValueDescriptionRequired
actGETmanageserverReturns the CPU stats of the serverYes
changeseridGETIntThe ID of the server whose CPU info is needed, default value is zeroNo

Sample Code

<?php

    require_once('/usr/local/virtualizor/sdk/admin.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

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

    $serverid = 0;

    $output = $admin->cpu($serverid);

    print_r(json_encode($output));

?>

Output

{
    "manu": "intel",
    "cpumodel": " Intel(R) Pentium(R) CPU G620 @ 2.60GHz",
    "limit": 2600,
    "used": 115.64,
    "free": 2484.36,
    "percent": 4.45,
    "percent_free": 95.55
}
Was this helpful to you?