Get VS Network Interface Usage Statistics
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 number of Kilobytes (KB) received by this VS
data_sent - the number of Kilobytes (KB) 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