Use the List Servers API to list information about the servers. The list includes all the information of both master and slave server. To filter or limit the size of the list, you can specify one or more query parameters.
For more information, you can refer this Server Clustering guide.
HTTP Request
https://hostname:4085/index.php?act=servers
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | servers | This action will retreive the list of servers | Yes |
page | GET | Int | If not specified, then only first 50 records are returned | No |
reslen | GET | Int | Number of records to be returned, default is 50 | No |
servername | POST | text | Search using the servername | No |
serverip | POST | text | Search using the server ip | No |
ptype | POST | text | Search using the server virtualization type can be (openvz, xen, kvm, xcp, vzo, vzk, proxk, proxl, proxmo ) | 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);
$output = $admin->listservers();
print_r(json_encode($output));
?>
Output
{
"title": "Servers",
"servs": [
{
"serid": 0,
"sgid": "0",
"server_name": "localhost",
"virt": "kvm",
"ip": "127.0.0.1",
"internal_ip": "",
"vnc_ip": "192.168.1.240",
"settings": "a:35:{s:12:\"email_update\";i:1;s:17:\"novnc_server_name\";i:0;s:6:\"cpu_nm\";i:1;s:10:\"soft_email\";s:19:\"samplemail@virtualizor.com\";s:8:\"timezone\";s:1:\"0\";s:9:\"interface\";s:0:\"\";s:16:\"alert_load_limit\";i:0;s:16:\"alert_disk_limit\";i:0;s:7:\"ping_ip\";s:0:\"\";s:14:\"addvs_cpu_prio\";s:0:\"\";s:13:\"addvs_io_prio\";s:0:\"\";s:14:\"addvs_io_class\";s:0:\"\";s:14:\"node_bandwidth\";i:0;s:20:\"del_slave_ostemplate\";i:0;s:19:\"openvz_suspend_load\";d:0;s:20:\"keep_orphan_template\";i:0;s:14:\"haproxy_enable\";i:0;s:21:\"haproxy_reservedports\";s:0:\"\";s:26:\"haproxy_reservedports_http\";s:6:\"80,443\";s:20:\"haproxy_allowedports\";s:0:\"\";s:17:\"speed_cap_disable\";i:0;s:15:\"disable_virttop\";i:0;s:9:\"cron_time\";s:10:\"3 11 * * *\";s:14:\"emps_cron_time\";s:14:\"46 18 6,21 * *\";s:11:\"cookie_name\";s:14:\"SIMCookies7614\";s:8:\"vpslimit\";s:0:\"\";s:10:\"overcommit\";i:0;s:6:\"vnc_ip\";s:13:\"192.168.1.240\";s:15:\"change_ssh_port\";i:0;s:13:\"max_ssh_login\";i:0;s:6:\"vcores\";i:0;s:17:\"disable_nw_config\";i:0;s:15:\"haproxy_src_ips\";s:15:\"202.168.147.144\";s:15:\"server_latitude\";d:0;s:16:\"server_longitude\";d:0;}",
"unique_txt": "",
"lv": "",
"hvm": "0",
"licnumvs": "0",
"total_ram": "1989",
"overcommit": 0,
"ram": "1038",
"total_space": "18",
"space": "5",
"os": "CentOS release 6.10 (Final)",
"os_arch": "x86_64",
"uname": "Linux alibaba.com 2.6.32-754.2.1.el6.x86_64 #1 SMP Fri Jul 13 12:50:12 UTC 2018 x86_64 x86_64 x86_64 GNU\/Linux",
"version": "2.9.7",
"patch": "0",
"lic_expires": "30\/09\/2018 GMT",
"checked": "1535481062",
"locked": "0",
"vcores": "5",
"ips": "44",
"ipv6": "96",
"ipv6_subnet": "49",
"ips_int": "13",
"bandwidth": "0",
"update_resource": "0",
"location": "",
"status": "1",
"last_reverse_sync": "0",
"numvps": "5",
"alloc_ram": "2560",
"alloc_space": "10",
"alloc_cpu": "5000",
"alloc_cpu_percent": "0.00",
"alloc_bandwidth": "5",
"virts": [
"kvm"
]
}
],
"servers": [
{
"serid": 0,
"sgid": "0",
"server_name": "localhost",
"virt": "kvm",
"ip": "127.0.0.1",
"internal_ip": "",
"vnc_ip": "192.168.1.240",
"settings": "a:35:{s:12:\"email_update\";i:1;s:17:\"novnc_server_name\";i:0;s:6:\"cpu_nm\";i:1;s:10:\"soft_email\";s:19:\"samplemail@virtualizor.com\";s:8:\"timezone\";s:1:\"0\";s:9:\"interface\";s:0:\"\";s:16:\"alert_load_limit\";i:0;s:16:\"alert_disk_limit\";i:0;s:7:\"ping_ip\";s:0:\"\";s:14:\"addvs_cpu_prio\";s:0:\"\";s:13:\"addvs_io_prio\";s:0:\"\";s:14:\"addvs_io_class\";s:0:\"\";s:14:\"node_bandwidth\";i:0;s:20:\"del_slave_ostemplate\";i:0;s:19:\"openvz_suspend_load\";d:0;s:20:\"keep_orphan_template\";i:0;s:14:\"haproxy_enable\";i:0;s:21:\"haproxy_reservedports\";s:0:\"\";s:26:\"haproxy_reservedports_http\";s:6:\"80,443\";s:20:\"haproxy_allowedports\";s:0:\"\";s:17:\"speed_cap_disable\";i:0;s:15:\"disable_virttop\";i:0;s:9:\"cron_time\";s:10:\"3 11 * * *\";s:14:\"emps_cron_time\";s:14:\"46 18 6,21 * *\";s:11:\"cookie_name\";s:14:\"SIMCookies7614\";s:8:\"vpslimit\";s:0:\"\";s:10:\"overcommit\";i:0;s:6:\"vnc_ip\";s:13:\"192.168.1.240\";s:15:\"change_ssh_port\";i:0;s:13:\"max_ssh_login\";i:0;s:6:\"vcores\";i:0;s:17:\"disable_nw_config\";i:0;s:15:\"haproxy_src_ips\";s:15:\"202.168.147.144\";s:15:\"server_latitude\";d:0;s:16:\"server_longitude\";d:0;}",
"unique_txt": "",
"lv": "",
"hvm": "0",
"licnumvs": "0",
"total_ram": "1989",
"overcommit": 0,
"ram": "1038",
"total_space": "18",
"space": "5",
"os": "CentOS release 6.10 (Final)",
"os_arch": "x86_64",
"uname": "Linux alibaba.com 2.6.32-754.2.1.el6.x86_64 #1 SMP Fri Jul 13 12:50:12 UTC 2018 x86_64 x86_64 x86_64 GNU\/Linux",
"version": "2.9.7",
"patch": "0",
"lic_expires": "30\/09\/2018 GMT",
"checked": "1535481062",
"locked": "0",
"vcores": "5",
"ips": "44",
"ipv6": "96",
"ipv6_subnet": "49",
"ips_int": "13",
"bandwidth": "0",
"update_resource": "0",
"location": "",
"status": "1",
"last_reverse_sync": "0",
"numvps": "5",
"alloc_ram": "2560",
"alloc_space": "10",
"alloc_cpu": "5000",
"alloc_cpu_percent": "0.00",
"alloc_bandwidth": "5",
"virts": [
"kvm"
]
}
],
"timenow": 1535482373,
"time_taken": "0.230"
}