Use the Network Suspend API to suspend the network of the VPS present on your server by passing the VPS ID to API. After suspension of the network, the VPS will become unreachable and will not be able to transfer any data. The API response will contain "done" as "1" after the network has been successfully suspended.
HTTP Request
https://hostname:4085/index.php?act=vs&suspend_net=VPSID
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | vs | The action will retrieve list of vps after vps is network suspended | Yes |
suspend_net | GET | Int | The ID of the vps that needs to be network suspended | 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);
$vid = 3627;
$output = $admin->suspend_net($vid);
print_r(json_encode($output));
?>
Output
{
"title": "Virtual Servers",
"done": 1,
"done_msg": "Network Suspended",
"vs": null,
"ostemplates": null,
"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:14:\"103.205.175.18\";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": "1312",
"total_space": "18",
"space": "11",
"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": "1535124663",
"locked": "0",
"vcores": "3",
"ips": "254",
"ipv6": "50",
"ipv6_subnet": "0",
"ips_int": "49",
"bandwidth": "0",
"update_resource": "0",
"location": "",
"status": "1",
"last_reverse_sync": "0",
"numvps": "2",
"alloc_ram": "2048",
"alloc_space": "5",
"alloc_cpu": "2000",
"alloc_cpu_percent": "0.00",
"alloc_bandwidth": "1",
"virts": [
"kvm"
]
}
],
"status": null,
"network_status": null,
"owners": null,
"plans": null,
"backup_plans": null,
"timenow": 1535127990,
"time_taken": "0.695"
}