High Avaliability

Use the Hight Availability API to get the status of the HA cluster and Ha resource status. For more information, you can refer this Server Clustering guide.

HTTP Request

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

Parameters

NameMethodValueDescriptionRequired
actGEThaThis action will retreive the status of HA ClusterYes
get_ha_statsGETIntIf you have multiple HA cluster, you will need to provide the server group ID for this option.Yes

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

    $output = $admin->ha();

    print_r(json_encode($output));
?>

Output

{
	"title":"High Availability",
	"ha_cluster":{
		"16":{
			"cluster_name":"HA_Group_1",
			"node_status":{
				"ha2":1,
				"ha3":1,
				"ha4":1		
			},
			"ha_resources":{
				"resource_v1001_4csljb16ilhzegay":{
					"status":"Started",
					"node":"ha4",
					"vps_name":"v1001"
				}
			}
		}
	},
	"timenow":1554815727,
	"time_taken":"1.267"
}
Was this helpful to you?