Performance

Use the Performance API to get the CPU and RAM usage information of the server by passing the server ID. The API response consists of the percentage utilisation of both CPU and RAM of the server. This is the live data of the CPU and RAM utilisation of the server and will update on every API call.

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
actGETperformanceThe action specified to perform the operation and return data of the serverYes
changeseridGETIntThe server ID whose performance information 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 = 3;

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

    print_r(json_encode($output));

?>

Output

{
    "title": "Performance",
    "perfomance": {
        "cpu": "17.6",
        "ram": "67.23"
    },
    "timenow": "1471412997",
    "time_taken": "0.325"
}
Was this helpful to you?