Monitor

Use Monitor API to get information about the resources of your VPS on your server.

HTTP Request

https://hostname:4083/index.php?act=monitor&svs=vpsid

Parameters

NameTypeValueDescriptionRequired
actGETmonitorThe action specified to retrieve dataYes
svsPOSTIntThe vps whose monitoring data needs to be fetchedYes
showPOSTmonthIf Set, it will return VPS Statistics month wise. For eg :- 201909 (y-m)Set if you want vps_stat month wise

Sample Code

PHP

<?php
    require_once('/usr/local/virtualizor/sdk/enduser.php');

    $key =  '';
    $pass = '';
    $ip = '';
    $admin = new Virtualizor_Enduser_API($ip, $key, $pass);
    $vid = '3577'; //vps of which you want data
    $post['show'] = 201909; //month of format yyyymm
    $output = $admin->monitor($vid, $post);

    print_r(json_encode($output));
?>

Curl

curl -k -X GET -L "https://hostname:4083/index.php?act=monitor&svs=3577&show=201909&api=json&apikey=your_api_key&apipass=your_api_pass&do=1"

Output

{
    "cpu": {
        "cpu": {
            "manu": "intel",
            "limit": 2500.09,
            "used": 17.5,
            "free": 2482.59,
            "percent": 0.7,
            "percent_free": 99.3
        }
    },
    "disk": {
        "disk": {
            "limit": 30720,
            "used": 636.59,
            "limit_gb": 30,
            "used_gb": 0.62,
            "free": 30083.41,
            "free_gb": 29.38,
            "percent": 2.07,
            "percent_free": 97.93
        },
        "inodes": {
            "limit": 49056,
            "used": 21298,
            "free": 27758,
            "percent": 43.42,
            "percent_free": 56.58
        }
    },
    "ram": {
        "used": 0,
        "limit": 2048,
        "guaranteed": 2048,
        "swap": 2048,
        "free": 2048,
        "percent": 0,
        "percent_free": 100
    }
}
Was this helpful to you?