Get Virtualizor

Manage Load Balancer

API Description

Use the Manage Load Balancer API to get all the manage load balancer data respect toh the specific node.

Parameters

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

    $lb_uuid = 'ZhqpaJnLO0Wbsyv4';
    $post = array();

    $output = $admin->manage_load_balancer($lb_uuid, $post);

    print_r(json_encode($output));
?>

Output

 {
    "title":"Manage Load Balancer",
    "load_balancer":{
        "lbid":"10","vps_uuid":"ZhqpaJnLO0Wbsyv4",
        "uid":"6","sgid":"0","settings":
        {
            "80_80":{
                "source_protocol":"http",
                "source_port":80,
                "dest_protocol":"http",
                "dest_port":80,
                "lb_method":"roundrobin"
            }
        },
        "vpsid":"1025",
        "serid":"0",
        "hostname":"loadbalancer_jay",
        "email":"jayesh@virtualizor.com",
        "num_vps":"5",
        "ip":"192.168.1.86",
        "sg_name":"Default"
    },
    "vpses":{
        "943":
        {
            "vpsid":"943",
            "uuid":"8YW5ds1GHrWtZFpU",
            "hostname":"master_node_jay_DND",
            "serid":"0","ip":"192.168.1.186",
            "locked":""
        },
        "923":
        {
            "vpsid":"923",
            "uuid":"7vUMGx17dkfcFQuV",
            "hostname":"ceph-node-4-dnd",
            "serid":"0",
            "ip":"192.168.1.203",
            "locked":""
        },
        "922":
        {
            "vpsid":"922",
            "uuid":"pUL571YE8KYmIYnE",
            "hostname":"ceph-node-3-dnd",
            "serid":"0",
            "ip":"192.168.1.202",
            "locked":""
        },
        "921":{
            "vpsid":"921",
            "uuid":"UVdAXLctArkg2vRu",
            "hostname":"ceph-node-2-dnd",
            "serid":"0",
            "ip":"192.168.1.201",
            "locked":""
        }
    },
    "lb_status":false,
    "lb_ssl_certs":[],
    "lb_stats":"% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current Dload  Upload   Total   Spent    Left  Speed 0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0 curl: (7) Failed to connect to 192.168.1.86 port 80: Connection refused",
    "lb_logs":[
        "Jul 24 13:39:50 loadbalancerjay systemd[1]: Starting HAProxy Load Balancer...",
        "Jul 24 13:39:50 loadbalancerjay haproxy[997]: [NOTICE]   (997) : New worker #1 (999) forked",
        "Jul 24 13:39:50 loadbalancerjay systemd[1]: Started HAProxy Load Balancer.",
        "Jul 24 13:39:50 loadbalancerjay haproxy[999]: [WARNING]  (999) : 
        Server static\/static is DOWN, reason: Layer4 connection problem, 
        info: \"Connection refused\", check duration: 0ms. 0 active and 0 backup servers left. 
        0 sessions active, 0 requeued, 0 remaining in queue.",
        "Jul 24 13:39:50 loadbalancerjay haproxy[999]: [NOTICE]   (999) : 
         path to executable is \/usr\/sbin\/haproxy",
        "Jul 24 13:39:50 loadbalancerjay haproxy[999]: [ALERT]    (999) : 
         backend 'static' has no server available!",
        "Jul 24 13:39:51 loadbalancerjay haproxy[999]: [WARNING]  (999) : 
         Server app\/app1 is DOWN, reason: Layer4 connection problem, 
         info: \"Connection refused\", check duration: 0ms. 3 active and 0 backup servers left. 
         0 sessions active, 0 requeued, 0 remaining in queue.",
        "Jul 24 13:39:51 loadbalancerjay haproxy[999]: [WARNING]  (999) : 
         Server app\/app2 is DOWN, reason: Layer4 connection problem, info: \"Connection refused\", 
         check duration: 0ms. 2 active and 0 backup servers left. 0 sessions active, 0 requeued, 
         0 remaining in queue.",
        "Jul 24 13:39:52 loadbalancerjay haproxy[999]: [ALERT]    (999) : 
         backend 'app' has no server available!",
        "Jul 24 13:40:07 loadbalancerjay systemd[1]: Stopping HAProxy Load Balancer...",
        "Jul 24 13:40:07 loadbalancerjay haproxy[997]: [WARNING]  (997) : Exiting Master process...",
        "Jul 24 13:40:07 loadbalancerjay haproxy[997]: [NOTICE]   (997) : 
         path to executable is \/usr\/sbin\/haproxy",
        "Jul 24 13:40:07 loadbalancerjay haproxy[997]: [ALERT]    (997) : 
         Current worker #1 (999) exited with code 143 (Terminated)",
        "Jul 24 15:46:59 loadbalancerjay systemd[1]: haproxy.service: Failed with result 'exit-code'.",
        "Jul 24 15:46:59 loadbalancerjay systemd[1]: Failed to start HAProxy Load Balancer.",
        "Jul 24 15:47:14 loadbalancerjay systemd[1]: Starting HAProxy Load Balancer...",
        "Jul 24 15:47:14 loadbalancerjay systemd[1]: haproxy.service: 
         Control process exited, code=exited,status=2\/INVALIDARGUMENT",
        "Jul 24 15:47:14 loadbalancerjay systemd[1]: haproxy.service: Failed with result 'exit-code'.",
        "Jul 24 15:47:14 loadbalancerjay systemd[1]: Failed to start HAProxy Load Balancer.",
        "Jul 24 15:47:35 loadbalancerjay systemd[1]: Starting HAProxy Load Balancer...",
        "Jul 24 15:47:35 loadbalancerjay systemd[1]: haproxy.service: Control process exited, 
         code=exited, status=2\/INVALIDARGUMENT",
        "Jul 24 15:47:35 loadbalancerjay systemd[1]: haproxy.service: Failed with result 'exit-code'.",
        "Jul 24 15:47:35 loadbalancerjay systemd[1]: Failed to start HAProxy Load Balancer."
    ],
    "timenow":1753360396,
    "time_taken":"0.349"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list