Usage Trends Statistics

To view usage trends statistics, use the following request:

GET /billing/dashboard_statistics.xml
GET /billing/dashboard_statistics.json 

XML Request example

curl -X GET "http://onapp.test/billing/dashboard_statistics.xml?stats_for=[cpus]&period[startdate]=2015-05-01&period[enddate]=2016-06-06" -u login:password -H 'Content-Type: application/xml' -g

Where:

stats_for - leave this parameter empty to get all statistics data. To get a specific data, indicate any of these values: cpus, memory, disk_size, virtual_servers, smart_servers, baremetal_servers.

period - indicate start date and end date for the period, for which you want to get the statistics.

JSON Request example:

curl -i -X GET -u login:password --url http://onapp.test/billing/dashboard_statistics.json -d '{"stats_for":["cpus"], "period":{"startdate":"2016-06-22", "enddate":"2016-06-24"}}' -H 'Content-Type: application/json' -H 'Accept: application/json' 
{"cpus":[[1466568000000,29],[1466654400000,28],[1466740800000,26]]}

Where:

  • [1466568000000,29] - time (in milli seconds), value array.

If period <= 24 hours the API response contains hourly statistics, else (> 24 hours) - returns daily statistics.


XML Output example

<?xml version="1.0" encoding="UTF-8"?>
<stats>
  <cpus type="array">
    <cpu type="array">
      <fixnum type="integer">1464667200000</fixnum>
      <fixnum type="integer">24</fixnum>
    </cpu>
    <cpu type="array">
      <fixnum type="integer">1464753600000</fixnum>
      <fixnum type="integer">23</fixnum>
    </cpu>
    <cpu type="array"> ...</cpu>
  </cpus>
</stats>