Get CDN Storage Server Billing Statistics
You can view the billing statistics for a particular storage server using the following request:
GET /storage_servers/:storage_server_id/vm_stats.xml
GET /storage_servers/:storage_server_id/vm_stats.json
Define a shorter period by setting Start and End time in the API call:
GET /storage_servers/:storage_server_id/vm_stats.xml?period[startdate]=YYYY-MM-DD+hh:mm:ss&period[enddate]=YYYY-MM-DD+hh:mm:ss&period[use_local_time]=1
GET /storage_servers/:storage_server_id/vm_stats.json?period[startdate]=YYYY-MM-DD+hh:mm:ss&period[enddate]=YYYY-MM-DD+hh:mm:ss&period[use_local_time]=1
XML Output Example
<vm_stats> <created_at type="datetime">2013-05-02T06:00:27Z</created_at> <currency_code>USD</currency_code> <id type="integer">15490</id> <stat_time type="datetime">2013-05-02T06:00:00Z</stat_time> <updated_at type="datetime">2013-05-02T06:00:27Z</updated_at> <user_id type="integer">307</user_id> <virtual_machine_id type="integer">1214</virtual_machine_id> <vm_billing_stat_id type="integer">8089</vm_billing_stat_id> <billing_stats><disks type="array"> <disk> <id type="integer">2430</id> <costs type="array"> <cost> <value type="integer">100</value> <cost type="float">0.0</cost> <resource_name>disk_min_iops</resource_name> </cost> <cost> <value type="integer">5</value> <cost type="float">0.0</cost> <resource_name>disk_size</resource_name> </cost><cost><value type="integer">0</value> <cost type="float">0.0</cost> <resource_name>data_read</resource_name> </cost> <cost> <value type="integer">0</value> <cost type="float">0.0</cost> <resource_name>data_written</resource_name> </cost> <cost> <value type="integer">0</value> <cost type="float">0.0</cost> <resource_name>reads_completed</resource_name> </cost> <cost> <value type="integer">0</value> <cost type="float">0.0</cost> <resource_name>writes_completed</resource_name> </cost> </costs> <label nil="true"/> </disk><disk> <id type="integer">2431</id> <costs type="array"> <cost> <value type="integer">100</value> <cost type="float">0.0</cost> <resource_name>disk_min_iops</resource_name> </cost> <cost> <value type="integer">1</value> <cost type="float">0.0</cost> <resource_name>disk_size</resource_name> </cost> <cost> <value type="integer">0</value> <cost type="float">0.0</cost> <resource_name>data_read</resource_name> </cost> <cost> <value type="integer">0</value> <cost type="float">0.0</cost> <resource_name>data_written</resource_name> </cost> <cost> <value type="integer">0</value> <cost type="float">0.0</cost> <resource_name>reads_completed</resource_name> </cost> <cost> <value type="integer">0</value> <cost type="float">0.0</cost> <resource_name>writes_completed</resource_name> </cost> </costs> <label nil="true"/> </disk> </disks> <network_interfaces type="array"> <network_interface> <id type="integer">1301</id> <costs type="array"> <cost> <value type="integer">1</value> <cost type="float">0.0</cost> <resource_name>ip_addresses</resource_name> </cost> <cost> <value type="integer">1</value> <cost type="float">0.0</cost> <resource_name>rate</resource_name> </cost> <cost> <value type="integer">0</value> <cost type="float">0.0</cost> <resource_name>data_received</resource_name> </cost> <cost> <value type="integer">0</value> <cost type="float">0.0</cost> <resource_name>data_sent</resource_name> </cost> </costs> <label>eth0</label> </network_interface> </network_interfaces> <virtual_machines type="array"> <virtual_machine> <id type="integer">1214</id> <costs type="array"> <cost> <value type="integer">6</value> <cost type="float">0.0</cost> <resource_name>template</resource_name </cost> <cost> <value type="integer">0</value> <cost type="float">0.0</cost> <resource_name>cpu_usage</resource_name> </cost> </costs> <label>OH-site</label> </virtual_machine> </virtual_machines> </billing_stats> <total_cost type="float">0.0</total_cost> <vm_resources_cost type="float">0.0</vm_resources_cost> <usage_cost type="float">0.0</usage_cost> </vm_stats>
Where:
created_at – the timestamp in DB when this record was created
updated_at – the time stamp in DB when this record was updated
currency_code - currency in which this storage server is charged within the bucket
id – the ID of the storage server hourly statistics
stat_time – the particular hour for which these statistics were generated
user_id - the ID of storage server owner
virtual_machine_id - ID of a storage server
virtual_machine_billing_statistics_id -ID of a storage server billing statistics
billing_stats - an array of billing details for the resources used by this storage server:
- disks - an array of disks used by this storage server with their billing details:
- label - disk name used in UI
- id - disk ID used in database
- costs- an array of disk related resources with their total prices for the period specified in the stat-time parameter, where:
- resource_name - the resource in question. This can be disk_size, data_read, data_written, reads_completed and writes_completed
- value - the amount of resources used (GBs of disk size, Kbs of data read/written, the number of reads/writes)
- cost - the total due for the resource
- network_interfaces - an array of network interfaces used by this storage server with their billing statistics:
- label - network interface name used in OnApp
- id - network interface ID
- costs- an array of network interface related resources with their total prices for the period specified in the stat-time parameter, where:
- resource_name- the resource in question. This can be ip_addresses, rate, data_received and data_sent
- value - the amount of resources used by this network interface (the number of IPs, the port speed in Mb per second, the data sent and received in GB )
- cost - the total due for the resource
- virtual_machines - an array of storage server billing details:
- label - storage server name
- costs- An array of storage server resources with their total prices for the period specified in the stat-time parameter, where:
- resource_name - the resource in question. This can be cpu_shares, cpus, memory, cpu_usage and template
- value - the amount of resources allocated to this storage server. For the templates resource, this parameter means a template ID in database.
- cost - the total due for this resource
- id - storage server ID
- total_cost – the total amount of money owed for the storage server specified by id parameter for a particular hour specified by stat_time parameter (total_cost = vm_resources_cost + usage_cost)
- vm_resources_cost – the amount of money due for the storage server resources for the particular hour specified by stat_time parameter (memory, disks, templates)
- usage_cost – the total due for storage server usage for this particular hour specified by stat_time parameter (data sent/received, bandwidth, CPU usage)