API Docs

Get to know usage_history

Overview: Lists the billing breakdown of past virtual machine usage based on a period defined by the customer (start, end).

usage_history expects the following parameters.

  • [vm_id] – The identifier of the VM.
  • [start] | optional, default - one month prior to current timestamp | starting search timestamp.
  • [end] | optional, default - current timestamp | end search timestamp.

Example:

$params = array(
	    'vm_id' => 1
	    );
$api->call('cloud.usage_history', $params);

Output:

Array
(
    [status] => 1,
    [data] => Array
	(
		[0] => Array
			(
				[id] => 1
				[user_id] => 1
				[cloud_track_client_vm_id] => 1
				[vm_id] => abcde-fghijklmn-opqrstuvwxyz-1
				[ram] => 512
				[ram_credits] => 2
				[ram_cost] => 2
				[disk] => 15
				[disk_credits] => 3
				[disk_cost] => 3
				[bu] => 0
				[bu_credits] => 0
				[bu_cost] => 0
				[tmp] => 0
				[tmp_credits] => 0
				[tmp_cost] => 0
				[cpu] => 12
				[cpu_credits] => 5
				[cpu_cost] => 5
				[bw] => 36774022
				[bw_raw] => 36774022
				[bw_accum] => 36774022
				[bw_credits] => 4
				[bw_cost] => 0
				[total_cost] => 25
				[timestamp] => 1407172693
			)

	)
)