API Docs

This functionality of the Ubiquity API has been disabled. Looking for information on this transition to LeaseWeb? Click here for answers to FAQs and here for information on the LeaseWeb customer portal. Click here for information about the Leaseweb API.

Get to know auto_scale_profile_add

Overview: Adds a new auto scale profile to a user's account.

auto_scale_profile_add expects the following parameters:

  • name – The name/label you want to use for the auto scale profile.
  • min – The minimum number of instances for the profile to maintain.
  • max – The maximum number of instances for the profile to maintain.
  • alarm_config *optional*– The alarm configuration for the profile to utilize.
    • alarm - The name of the alarm.
      • cpu_util - CPU Utilization
      • read_rate - Disk Reads per Second
      • write_rate - Disk Writes per Second
      • bw_rate_in_pub - Public Incoming Bandwidth (B/s)
      • bw_rate_out_pub - Public Outgoing Bandwidth (B/s)
      • bw_rate_in_priv - Private Incoming Bandwidth (B/s)
      • bw_rate_out_priv - Private Outgoing Bandwidth (B/s)
    • threshold - The limit used for comparisons.
    • operator - The logical operator used for comparisons.
      • > - Greater Than
      • < - Less Than
      • >= - Greater Than or Equal to
      • <= - Less Than or Equal to
    • period - The number of consecutive periods to occur before triggering alarm (1 - 100)
    • time_interval - The amount of time in seconds to examine VM stats. (10 mins, 30 mins, 1 hr, 6hr)
    • to_create - The number of vms to be created when alarm is triggered.
  • vm_config – The configuration the vms to be created with. Contains the same parameters as cloud.create.
  • pool_id *optional*– The id of a load balancer for the vms to be associated with.
  • auto_scale_schedule_id *optional*– The id of an auto scale schedule to associate with the profile.

NOTE: This function returns the id of the new auto scale profile.

Example:

$params = array(
	'name'=>'newprofilename',
	'min'=>2,
	'max' => 7,
	'alarm_config' =>
		array(
		  array(
			'alarm'=> 'cpu_util',
			'threshold'=> 1,
			'operator' => '>=',
			'period' => 6,
			'time_interval' => 18000,
			'to_create' => 3
		  ),
		),
	'vm_config' =>
		array(
			'hostname' => 'new_vm.ubiquityhosting.com',
			'zone_id' => 1,
			'image_id' => 1,
			'flavor_id' => 1,
			'key_id' => 1,
			'userdata' => 'This user data will not work - do not use!!!'
		),

	'pool_id' => 0,
	'auto_scale_schedule_id' => 0);

$api->call('cloud.auto_scale_profile_add', $params);
								

Output:

Array(
[result] => 10
)