Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Children Display
alltrue
styleh3
pageSuperb Cloud API

GET /virtual_machines/:virtual_machine_id/cpu_usage

Gets CPU usage statistics of specified virtual server

Info
Define a shorter period by setting Start and End time in the API call:
GET /virtual_machines/:virtual_machine_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

Sections:

Table of Contents
maxLevel4
minLevel2
includeResponse.*|JSON.*|XML.*|Explanation.*

Response Parameters

cpu_time -

created_at - the timestamp in DB when this record was created

id -  the statistics ID

stat_time - the particular hour for which these statistics were generated

updated_at - the time stamp in DB when this record was updated

user_id - the ID of the VS owner

virtual_machine_id - ID of the VS

JSON Request example

Code Block
languagebash
themeRDark
 curl -i GET -u user:userpass --url <api_url>/virtual_machines/:virtual_machine_id/cpu_usage.json

JSON Response

Code Block
themeRDark
 [
    {
        "cpu_hourly_stat": {
            "cpu_time": 5,
            "created_at": "2015-08-26T21:00:12Z",
            "id": 639251,
            "stat_time": "2015-08-26T21:00:00Z",
            "updated_at": "2015-08-26T21:00:12Z",
            "user_id": 337,
            "virtual_machine_id": 509
        }
    }
]

XML Request example

Code Block
languagebash
themeRDark
 curl -i GET -u user:userpass --url <api_url>/virtual_machines/:virtual_machine_id/cpu_usage.json

XML Response example

Code Block
languagexml
themeRDark
 <?xml version="1.0" encoding="UTF-8"?>
<cpu_hourly_stats type="array">
  <cpu_hourly_stat>
    <cpu_time type="integer">18</cpu_time>
    <created_at type="datetime">2015-01-06T10:00:18Z</created_at>
    <id type="integer">935848</id>
    <stat_time type="datetime">2015-01-06T10:00:00Z</stat_time>
    <updated_at type="datetime">2015-01-06T10:00:18Z</updated_at>
    <user_id type="integer">1</user_id>
    <virtual_machine_id type="integer">1701</virtual_machine_id>
  </cpu_hourly_stat>
  <cpu_hourly_stat>...</cpu_hourly_stat>
</cpu_hourly_stats>