API Admin index

From Virtualizor Wiki
Jump to: navigation, search

Get Server Details

Example Code

<?php

    require_once('admin.php');

    $key =  'uketenhrhpunty5lhgwkcuxxxxxxxxxx';

    $pass = 'yrsofc3tg3tre7bjpfppspxxxxxxxxxx';

    $ip = 'xxx.xxx.xxx.xxx';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $output = $admin->adminindex();;
    print_r($output);
?>

Returns:

Array
(
    [title] => Admin Panel
    [stats] => Array
        (
            [servers] => 1
            [num_openvz] => 0
            [num_kvm] => 14
            [num_xen] => 0
            [num_xenhvm] => 0
            [num_users] => 17
            [num_resellers] => 0
            [num_admins] => 9
            [total_ram] => 15861
            [ram_free] => 0
            [ram] => 7465
            [total_space] => 4095
            [space_used] => 597
            [space] => 3498
            [total_ips] => 65
            [free_ips] => 51
            [ips] => 14
            [total_ipv4] => 15
            [free_ipv4] => 1
            [ipv4] => 14
            [total_ipv6] => 50
            [free_ipv6] => 50
            [ipv6] => 0
            [ram_used] => 8396
        )

    [servers] => Array
        (
            [0] => Array
                (
                    [serid] => 0
                    [sgid] => 0
                    [server_name] => localhost
                    [virt] => kvm
                    [ip] => 127.0.0.1
                    [lv] => vg
                    [hvm] => 0
                    [licnumvs] => 0
                    [total_ram] => 15861
                    [overcommit] => 0
                    [ram] => 7465
                    [total_space] => 4095
                    [space] => 3498
                    [checked] => 1403006778
                    [numvps] => 14
                    [alloc_ram] => 25600
                    [alloc_space] => 373
                    [alloc_cpu] => 9048
                    [alloc_cpu_percent] => 700.00
                    [alloc_bandwidth] => 1
                )

        )

    [timenow] => 1403006897
    [time_taken] => 0.017
)