Use the Show Tasks API to show the tasks information about all the activity that has been performed on the server by Virtualizor. You can monitor operations like creation of VPS, rebuilding of the VPS, backing up of VPS, restoration of VPS, installation of recipes, installation of control panel etc. for complete list of operations that you can monitor, please refer below table. The API response contains the list of the information of the task, which are listed according to their "actid".
HTTP Request
https://hostname:4085/index.php?act=tasks
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | tasks | The action specified to perform operation and retrieve data | Yes |
Action
Values | Description |
---|---|
addvs | Creating VPS |
addvs_restore | Creating VPS for Restore |
rebuildvs | Rebuilding VPS |
vpsbackups | Backing up VPS |
restorevps | Restoring VPS |
migrate2 | Migrating VPS |
multimigrateprog | Multiple Migrate |
clone2 | Cloning VPS |
multicloneprog | Multiple Clone |
deletevs | Deleting VPS |
createtemplate | Creating Template |
fstab_handle | FS Tab Handle |
editxcpvs | Edit XCP VPS |
resizevps | Resizing VPS |
multivirt | Enabling Multivirt |
getos | Downloading OS |
change_dnsnameserver | Changing DNS Nameserver |
changepassword | Changing VPS Password |
install_cp | Install Control panel |
hostname | Changing VPS Hostname |
install_recipe | Install Recipe |
bandwidth_unsuspend | Unsuspend Bandwidth |
suspend_callback | Suspend Callback |
unsuspend_callback | Unsuspend Callback |
editvps_callback | Edit VPS Callback |
terminate_callback | Terminate VPS Callback |
get_crt | Lets Encrypt Install Certificate |
renew_crt | Lets Encrypt Renew Certificate |
cron_crt | Lets Encrypt Renew Certificate Cron Task |
haproxy_cron | HAProxy Rebuild |
vpsbackups_plan | VPS Backups |
restorevps_plan | VPS Restore |
addsshkeys | Adding SSH Keys |
installxentools | Installing Xenserver Tools |
dbbackups | Database Backup |
install_script | Installing Apps |
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->tasks();
print_r(json_encode($output));
?>
Output
{
"title": "Tasks List",
"tasks": {
"484": {
"actid": "484",
"slaveactid": "0",
"uid": "0",
"vpsid": "0",
"serid": 0,
"action": "getos",
"data": "a:1:{s:2:\"os\";a:1:{i:0;a:5:{s:4:\"osid\";i:100008;s:10:\"inprogress\";i:0;s:4:\"done\";i:1;s:6:\"failed\";i:0;s:7:\"err_msg\";s:19:\"Download successful\";}}}",
"time": "1536081131",
"status_txt": "Task Completed",
"status": "1",
"progress": "100",
"started": "September 4, 2018, 5:12 pm",
"updated": "September 4, 2018, 5:13 pm",
"ended": "September 4, 2018, 5:13 pm",
"proc_id": "0",
"ip": "192.168.1.188",
"internal": "0",
"email": "root",
"os": [
{
"osid": 100008,
"inprogress": 0,
"done": 1,
"failed": 0,
"err_msg": "Download successful"
}
],
"server_name": "localhost",
"action_txt": "Downloading OS"
},
"483": {
"actid": "483",
"slaveactid": "0",
"uid": "0",
"vpsid": "0",
"serid": 0,
"action": "getos",
"data": "a:1:{s:2:\"os\";a:1:{i:0;a:5:{s:4:\"osid\";i:100008;s:10:\"inprogress\";i:0;s:4:\"done\";i:1;s:6:\"failed\";i:0;s:7:\"err_msg\";s:19:\"Download successful\";}}}",
"time": "1536079172",
"status_txt": "Task Completed",
"status": "1",
"progress": "100",
"started": "September 4, 2018, 4:39 pm",
"updated": "September 4, 2018, 4:40 pm",
"ended": "September 4, 2018, 4:40 pm",
"proc_id": "0",
"ip": "192.168.1.188",
"internal": "0",
"email": "root",
"os": [
{
"osid": 100008,
"inprogress": 0,
"done": 1,
"failed": 0,
"err_msg": "Download successful"
}
],
"server_name": "localhost",
"action_txt": "Downloading OS"
}
},
"logs_data": null,
"l_common_logs": "The logs shown are the last operation performed for this task by virtualizor",
"timenow": 1536144695,
"time_taken": "0.361"
}