Get Virtualizor

Bandwidth

Use the bandwidth API to get the bandwidth utilization of your server. The data is returned in the form of array where "pie_data" consist of "server_bandwidth" which shows monthly usage of each day from 1st day of the month to the 31st i.e. last day of the month. This is again shown in terms of "in" and "out" where "in" means data received and "out" means data sent from the vps. All the data values returned by the API are in megabytes.

HTTP Request

https://hostname:4085/index.php?act=bandwidth&show=SHOW

Parameters

NameMethodValueDescriptionRequired
actGETbandwidthReturns the bandwidth usage of the serverYes
showGETIntThis will return bandwidth usage of a particular specified month. Date should be of the format : YYYYMMYes

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);

    $post = array();
    $post['show'] = '201611';

    $output = $admin->bandwidth($post);

    print_r(json_encode($output));

?>

Output

{
    "title": "Bandwidth Usage",
    "bandwidth": {
        "limit": "102400",
        "used": "46647.12",
        "usage": {
            "1": "205.78",
            "2": "2160.2",
            "3": "344.43",
            "4": "1551.3",
            "5": "27425.75",
            "6": "170.06",
            "7": "156.97",
            "8": "159.84",
            "9": "1706.07",
            "10": "2831.54",
            "11": "6739.58",
            "12": "192.67",
            "13": "490.24",
            "14": "802.98",
            "15": "175.64",
            "16": "1347.83",
            "17": "186.24",
            "18": "0",
            "19": "0",
            "20": "0",
            "21": "0",
            "22": "0",
            "23": "0",
            "24": "0",
            "25": "0",
            "26": "0",
            "27": "0",
            "28": "0",
            "29": "0",
            "30": "0",
            "31": "0"
        },
        "in": {
            "usage": {
                "1": "79.1",
                "2": "378.38",
                "3": "177.65",
                "4": "1402.47",
                "5": "5478.07",
                "6": "52.95",
                "7": "57.57",
                "8": "54.71",
                "9": "1484.26",
                "10": "2592.38",
                "11": "4042.35",
                "12": "58.24",
                "13": "114.3",
                "14": "265.9",
                "15": "56.04",
                "16": "390.7",
                "17": "46.76",
                "18": "0",
                "19": "0",
                "20": "0",
                "21": "0",
                "22": "0",
                "23": "0",
                "24": "0",
                "25": "0",
                "26": "0",
                "27": "0",
                "28": "0",
                "29": "0",
                "30": "0",
                "31": "0"
            },
            "used": "16731.83",
            "limit": "16732.83",
            "free": "1",
            "limit_gb": "16.340654296875",
            "used_gb": "16.34",
            "free_gb": "0.0009765625",
            "percent": "99.994023724618",
            "percent_free": "0.0059762753819967"
        },
        "out": {
            "usage": {
                "1": "126.68",
                "2": "1781.82",
                "3": 166.78",
                "4": "148.83",
                "5": "21947.69",
                "6": "117.11",
                "7": "99.4",
                "8": "105.12",
                "9": "221.81",
                "10": "239.16",
                "11": "2697.23",
                "12": "134.43",
                "13": "375.94",
                "14": "537.08",
                "15": "119.61",
                "16": "957.13",
                "17": "139.47",
                "18": "0",
                "19": "0",
                "20": "0",
                "21": "0",
                "22": "0",
                "23": "0",
                "24": "0",
                "25": "0",
                "26": "0",
                "27": "0",
                "28": "0",
                "29": "0",
                "30": "0",
                "31": "0"
            },
            "used": "29915.29",
            "limit": "29916.29",
            "free": "1",
            "limit_gb": "29.215126953125",
            "used_gb": "29.21",
            "free_gb": "0.0009765625",
            "percent": "99.99665733953",
            "percent_free": "0.0033426604702669"
        },
        "free": "55752.88",
        "limit_gb": "100",
        "used_gb": "45.55",
        "free_gb": "54.45",
        "percent": "45.55",
        "percent_free": "54.45"
    },
    "month": {
        "yr": "2016",
        "month": "11",
        "mth_txt": "Nov",
        "days": "30",
        "prev": "201610",
        "next": "201612"
    },
    "band": "null",
    "timenow": "1471411017",
    "time_taken": "0.104"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list