Skip to content
Get started

Get instance resource utilization stats

client.instances.stats(stringid, RequestOptionsoptions?): InstanceStats { allocated_memory_bytes, allocated_vcpus, cpu_seconds, 7 more }
get/instances/{id}/stats

Returns real-time resource utilization statistics for a running VM instance. Metrics are collected from /proc//stat and /proc//statm for CPU and memory, and from TAP interface statistics for network I/O.

ParametersExpand Collapse
id: string
ReturnsExpand Collapse
InstanceStats { allocated_memory_bytes, allocated_vcpus, cpu_seconds, 7 more }

Real-time resource utilization statistics for a VM instance

allocated_memory_bytes: number

Total memory allocated to the VM (Size + HotplugSize) in bytes

formatint64
allocated_vcpus: number

Number of vCPUs allocated to the VM

cpu_seconds: number

Total CPU time consumed by the VM hypervisor process in seconds

formatdouble
instance_id: string

Instance identifier

instance_name: string

Instance name

memory_rss_bytes: number

Resident Set Size - actual physical memory used by the VM in bytes

formatint64
memory_vms_bytes: number

Virtual Memory Size - total virtual memory allocated in bytes

formatint64
network_rx_bytes: number

Total network bytes received by the VM (from TAP interface)

formatint64
network_tx_bytes: number

Total network bytes transmitted by the VM (from TAP interface)

formatint64
memory_utilization_ratio?: number | null

Memory utilization ratio (RSS / allocated memory). Only present when allocated_memory_bytes > 0.

formatdouble
Get instance resource utilization stats
import Hypeman from '@onkernel/hypeman';

const client = new Hypeman({
  apiKey: 'My API Key',
});

const instanceStats = await client.instances.stats('id');

console.log(instanceStats.instance_id);
{
  "allocated_memory_bytes": 4294967296,
  "allocated_vcpus": 2,
  "cpu_seconds": 29.94,
  "instance_id": "qilviffnqzck2jrim1x6s2b1",
  "instance_name": "my-web-server",
  "memory_rss_bytes": 443338752,
  "memory_vms_bytes": 4330745856,
  "network_rx_bytes": 12345678,
  "network_tx_bytes": 87654321,
  "memory_utilization_ratio": 0.103
}
Returns Examples
{
  "allocated_memory_bytes": 4294967296,
  "allocated_vcpus": 2,
  "cpu_seconds": 29.94,
  "instance_id": "qilviffnqzck2jrim1x6s2b1",
  "instance_name": "my-web-server",
  "memory_rss_bytes": 443338752,
  "memory_vms_bytes": 4330745856,
  "network_rx_bytes": 12345678,
  "network_tx_bytes": 87654321,
  "memory_utilization_ratio": 0.103
}