Page tree
Skip to end of metadata
Go to start of metadata

API Essentials

API Key Generation

Autoscaling

Backups

Credit

DNS

Firewall Rules

Flex Cloud VM Control

Getting Started with Superb Flex Cloud

IP Addresses

Logs

Network Interfaces

Recipes

SSH Keys

Templates

Test Route

Troubleshooting API Issues

Viewing Activity Logs

Virtual Server Operating Systems

Virtual Servers

VS Disks

GET /virtual_machines/:virtual_machine_id/cpu_usage

Gets CPU usage statistics of specified virtual server

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:

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

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

JSON Response

 [
    {
        "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

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

XML Response example

 <?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>
  • No labels