Get Virtualizor

Node Performance

he Node Performance API to get the data about your node's performance. This is the output of /proc/cpuinfo and /proc/stat commands which is executed on the server. The API response consists of the server information and statistics of its resource utilization which are listed as an array which has the resources as comma separated values. The sequence is as follows [server ID, timestamp, disk, inode, ram, cpu, actual_cpu, net_in, net_out].

HTTP Request

https://hostname:4085/index.php?act=server_stats

Parameters

NameMethodValueDescriptionRequired
actGETserver_statsReturns the server statsYes
showGETIntShow data for specific month and year, format YYYYMM eg: 201809No
seridPOSTIntThe ID of the serverNo

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'] = 201808;           //use show only when you need statistics of a specified month and year
                                        //specify it in this way: YYYYMM
    $output = $admin->server_stats($post);

    print_r(json_encode($output));

?>

Output

{
    "title": "Virtualizor",
    "server_stats": [
        ["0", "1471403402", "1", "98835", "253756", "10796", "92.75", "0.00", "128", "0"],
        ["0", "1471402921", "1", "99225", "253760", "10792", "100.10", "0.00", "128", "70"],
        ["0", "1471402442", "1", "99224", "253760", "10765", "10.91", "0.00", "284", "96"],
        ["0", "1471401962", "1", "99224", "253760", "10757", "27.13", "0.00", "64", "0"],
        ["0", "1471401482", "1", "99224", "253760", "10752", "91.17", "0.00", "64", "5069"],
        ["0", "1471401002", "1", "99225", "253760", "10763", "93.95", "0.00", "64", "0"],
        ["0", "1471400762", "1", "99224", "253760", "10765", "59.28", "0.00", "64", "0"],
        ["0", "1471400282", "1", "99224", "253760", "10726", "17.60", "0.00", "0", "0"],
        ["0", "1471399802", "1", "99224", "253760", "10774", "100.10", "0.00", "64", "0"],
        ["0", "1471399322", "1", "99224", "253756", "10599", "8.21", "0.00", "844", "858"],
        ["0", "1471398842", "1", "99223", "253748", "10674", "59.67", "0.00", "268", "236"],
        ["0", "1471398361", "1", "99223", "253739", "10592", "22.60", "0.00", "196", "282"],
        ["0", "1471397882", "1", "99223", "253739", "10600", "13.26", "0.00", "670", "526"]
    ],
    ,
    "month": {
        "current_month": "201608",
        "prev_month": "201607",
        "next_month": "201609"
    },
    "timenow": "1471403773",
    "time_taken": "0.130"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list