Child pages
  • Get VS Network Interface Usage Statistics
Skip to end of metadata
Go to start of metadata

To view the network interface usage statistics of a virtual server, use the following request:

GET /virtual_machines/:virtual_machine_id/network_interfaces/:network_interface_id/usage.xml
GET /virtual_machines/:virtual_machine_id/network_interfaces/:network_interface_id/usage.json

 

Define a shorter period by setting Start and End time in the API call:

GET /virtual_machines/:virtual_machine_id/network_interfaces/:network_interface_id/usage.xml?period[startdate]=YYYY-MM-DD+hh:mm:ss&period[enddate]=YYYY-MM-DD+hh:mm:ss

GET /virtual_machines/:virtual_machine_id/network_interfaces/:network_interface_id/usage.json?period[startdate]=YYYY-MM-DD+hh:mm:ss&period[enddate]=YYYY-MM-DD+hh:mm:ss

XML Output example

<?xml version="1.0" encoding="UTF-8"?>
<net_hourly_stats type="array">
  <net_hourly_stat>
    <created_at type="datetime">2016-01-13T14:00:21Z</created_at>
    <data_received type="integer">156</data_received>
    <data_sent type="integer">25</data_sent>
    <id type="integer">14510</id>
    <network_interface_id type="integer">952</network_interface_id>
    <stat_time type="datetime">2016-01-13T14:00:00Z</stat_time>
    <updated_at type="datetime">2016-01-13T14:00:21Z</updated_at>
    <user_id type="integer">7</user_id>
    <virtual_machine_id type="integer">690</virtual_machine_id>
  </net_hourly_stat>
  <net_hourly_stat>...</net_hourly_stat>
</net_hourly_stats>

Where:

created_at - the timestamp in DB when the record was created

data_received the amount of Kilobytes received by this VS

data_sent the amount of Kilobytes sent by this VS

id the ID of the statistics

network_interface_id the ID of the network interface

stat_time - the time when statistics were generated

updated_at the timestamp in DB when the record was updated

user_id - the ID of the VS owner

virtual_machine_id - the ID of the VS 

Use the following formula to convert network interface usage statistics data in the API output:

(Sum total of Kilobytes per hour)/3600*0,008 = Mbps 
where 3600 = 60 minutes multiplied by 60 seconds
0,008 = the coefficient to convert Kilobytes into megabits.
#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels