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
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | manageserver | Returns the CPU stats of the server | Yes |
changeserid | GET | Int | The ID of the server whose CPU info is needed, default value is zero | No |
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
}