Use the VPS Status API to get status of vps. It returns an array containing status of vps.
Status | Description |
---|---|
0 | VPS is off |
1 | VPS is on |
2 | VPS is suspended |
HTTP Request
https://hostname:4085/index.php?act=vs&vs_status=VPSIDs
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | vs | The action specified to retrieve data after vps status | Yes |
vs_status | GET | Array | The IDs of the vps. | Yes |
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);
$vids = array('7272','7257');
$output = $admin->status($vids);
print_r(json_encode($output));
?>
Output
{
"7257":{
"status":1, //status of VPS.
"used_cpu":"0.10",
"used_ram":0,
"used_disk":0.34765625,
"net_in":0,
"net_out":0,
"used_inode":"13559",
"io_read":0,
"io_write":0,
"inode":0,
"ram":"1280",
"disk":"50",
"used_bandwidth":"1.98",
"bandwidth":"3",
"virt":"kvm"
},
"7272":{
"status":1,
"used_cpu":"0.00",
"used_ram":0,
"used_disk":1.18359375,
"net_in":0,
"net_out":0,
"used_inode":"27348",
"io_read":0,
"io_write":0,
"inode":0,
"ram":"1280",
"disk":"2",
"used_bandwidth":"0.00",
"bandwidth":"1",
"virt":"kvm"
}
}