|
前天搬瓦工的VPS被攻击,导致被封,解封要等到2016年1月1日。
提交工单希望拿回数据,库福说可以通过快照取回,请问有人用过搬瓦工快照么?
下边是搬瓦工后台菜单,请英文高手看看如何恢复?
[quote]REST API
Show API Key Reset API Key
Your VEID: 111141
Your API KEY: please use button above to show
Whether you want to automatically create nightly snapshots, query status of your VPS, or develop a complete replacement for the KiwiVM panel, this page is for you.
All parameters can be passed either via GET or POST methods.
PHP examples
// Sample 1. Get information about server
$request = "https://api.kiwivm.it7.net/v1/getServiceInfo?veid=111141&api_key=YOUR_API_KEY_HERE";
$serviceInfo = json_decode (file_get_contents ($request));
print_r ($serviceInfo);
/* ------------------------------- [ output ] -------------------------------
stdClass Object
(
[hostname] => my.server.com
[node_ip] => 10.20.30.40
[node_alias] => IT7_Node32
[node_location] => US, Florida
[plan] => micro128
[plan_monthly_data] => 322122547200
[plan_disk] => 4294967296
[plan_ram] => 155189248
[plan_swap] => 37748736
[os] => centos-6-x86_64
customer@example.com
[data_counter] => 569810827
[data_next_reset] => 1430193600
[ip_addresses] => Array
(
[0] => 11.22.33.44
[1] => 11.22.33.45
)
[rdns_api_available] => 1
[ptr] => stdClass Object
(
[11.22.33.44] => ns1.my.server.com
[11.22.33.45] => ns2.my.server.com
)
[error] => 0
)
*/
// Sample 2. Create a snapshot
$request = "https://api.kiwivm.it7.net/v1/snapshot/create?description=Automatic_Snapshot&veid=111141&api_key=YOUR_API_KEY_HERE";
$serviceInfo = json_decode (file_get_contents ($request));
print_r ($serviceInfo);
/* ------------------------------- [ output ] -------------------------------
stdClass Object
(
[error] => 0
[notificationEmail] => customer@example.com
)
*/
// Sample 3. Restart VPS
$request = "https://api.kiwivm.it7.net/v1/restart?veid=111141&api_key=YOUR_API_KEY_HERE";
$serviceInfo = json_decode (file_get_contents ($request));
print_r ($serviceInfo);
/* ------------------------------- [ output ] -------------------------------
stdClass Object
(
[error] => 0
)
*/
// Sample 4. Set PTR record
$request = "https://api.kiwivm.it7.net/v1/setPTR?ip=11.22.33.44&ptr=ns1.my.server.com&veid=111141&api_key=YOUR_API_KEY_HERE";
$serviceInfo = json_decode (file_get_contents ($request));
print_r ($serviceInfo);
/* ------------------------------- [ output ] -------------------------------
stdClass Object
(
[error] => 0
)
*/
// Sample 5. Restart VPS using wget
wget -qO- "https://api.kiwivm.it7.net/v1/restart?veid=111141&api_key=YOUR_API_KEY_HERE"
/* ------------------------------- [ output ] -------------------------------
{"error":0}
*/
// Sample 6. Restart VPS using curl
//You may want to use curl instead as it allows passing all variables in a POST request
$requestData = array ("veid" => 111141, "api_key" => "YOUR_API_KEY_HERE");
$request = "restart";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.kiwivm.it7.net/v1/$request");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // curl running on Windows has issues with SSL -
// see https://kb.ucla.edu/articles/how-do-i-use-curl-in-php-on-windows
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$jsonData = curl_exec($ch);
if (curl_error($ch)) die("Connection Error: ".curl_errno($ch)." - ".curl_error($ch));
curl_close($ch);
print_r (json_decode ($jsonData));
/* ------------------------------- [ output ] -------------------------------
stdClass Object
(
[error] => 0
)
*/
Available calls
Each API call requires that you supply a valid combination of VEID (VPS ID) and API key as shown in the example.
Each API call always returns error variable. If error is non-zero, check "message" variable for more details about the error.
Call Parameters Description and return values
start none Starts the VPS
stop none Stops the VPS
restart none Reboots the VPS
kill none Allows to forcibly stop a VPS that is stuck and cannot be stopped by normal means. Please use this feature with great care as any unsaved data will be lost.
getServiceInfo none Returns
hostname: Hostname of the VPS
node_ip: IP address of the physical node
node_alias: Internal nickname of the physical node
node_location: Physical location (country, state)
location_ipv6_ready: Whether IPv6 is supported at the current location
plan: Name of plan
plan_monthly_data: Allowed monthly data transfer (bytes)
plan_disk: Disk quota (bytes)
plan_ram: RAM (bytes)
plan_swap: SWAP (bytes)
os: Operating system
email: Primary e-mail address of the account
data_counter: Data transfer used in the current billing month
data_next_reset: Date and time of transfer counter reset (UNIX timestamp)
ip_addresses: IPv4 and IPv6 addresses assigned to VPS (Array)
plan_max_ipv6s: Maximum number of IPv6 addresses allowed by plan
rdns_api_available: Whether or not rDNS records can be set via API
ptr: rDNS records (Array of two-dimensional arrays: ip=>value)
suspended: Whether VPS is suspended
getLiveServiceInfo none This function returns all data provided by getServiceInfo. In addition, it provides detailed status of the VPS.
Please note that this call may take up to 15 seconds to complete.
Returns
vz_status: array consisting of OpenVZ beancounters, system load average, number of processes etc
vz_quota: disk quota info
is_cpu_throttled: 0 = CPU is not throttled, 1 = CPU is throttled due to high usage. Throttling resets automatically every 2 hours.
ssh_port: SSH port of the VPS
getAvailableOS none Returns
installed: Currently installed Operating System
templates: Array of available OS
reinstallOS os Reinstall the Operating System. OS must be specified via "os" variable. Use getAvailableOS call to get list of available systems.
resetRootPassword none Generates and sets a new root password.
Returns
password: New root password
getUsageGraphs none Obsolete, use getRawUsageStats instead
getRawUsageStats none Returns a two-dimensional array with the detailed usage statistics shown under Detailed Statistics in KiwiVM.
setHostname newHostname Sets new hostname.
setPTR ip, ptr Sets new PTR (rDNS) record for IP.
basicShell/cd currentDir, newDir Simulate change of directory inside of the VPS. Can be used to build a shell like Basic shell.
Returns
pwd: Result of the "pwd" command after the change.
basicShell/exec command Execute a shell command on the VPS (synchronously).
Returns
error: Exit status code of the executed command
message: Console output of the executed command
shellScript/exec script Execute a shell script on the VPS (asynchronously).
Returns
log: Name of the output log file.
snapshot/create description (optional) Create snapshot
Returns
notificationEmail: E-mail address on file where notification will be sent once task is completed.
snapshot/list none Get list of snapshots.
Returns
snapshots: Array of snapshots (fileName, os, description, size, md5, sticky, purgesIn, downloadLink).
snapshot/delete snapshot Delete snapshot by fileName (can be retrieved with snapshot/list call).
snapshot/restore snapshot Restores snapshot by fileName (can be retrieved with snapshot/list call). This will overwrite all data on the VPS.
snapshot/toggleSticky snapshot, sticky Set or remove sticky attribute ("sticky" snapshots are never purged). Name of snapshot can be retrieved with snapshot/list call – look for fileName variable.
Set sticky = 1 to set sticky attribute
Set sticky = 0 to remove sticky attribute
ipv6/add ip Assigns a new IPv6 address. For initial IPv6 assignment an empty IP is required (call without parameters), and a new IP from the available pool is assigned automatically. All subsequent requested IPv6 addresses must be within the /64 subnet of the first IPv6 address.
Returns
ip: Newly assigned IPv6 address
ipv6/delete ip Releases specified IPv6 address.
migrate/getLocations none Return all possible migration locations.
Returns
currentLocation: ID of current location
locations: IDs of locations available for migration into
descriptions: Friendly descriptions of available locations
migrate/start location Start VPS migration to new location. Takes new location ID as input. Note that this will result in all IPv4 addresses to be replaced with new ones, and all IPv6 addresses will be released.
|
|