Skip to content

Metrics and usage

Each running miniVM is sampled every 10 seconds: CPU, memory and disk. Samples are kept for 7 days.

Terminal window
ons metrics <minivm-id>

<minivm-id> is the id ons create printed (ons ls lists yours).

  • --since <seconds> sets how much history to show (default 300).
  • --watch keeps printing new samples until you press Ctrl-C. With --json, it prints one JSON object per line.

Set E2B_DOMAIN=onshore.sh and E2B_API_KEY before you run the SDK examples. See Migrate from E2B.

Field Meaning
cpuCount vCPUs of the miniVM.
cpuUsedPct CPU use, in percent of its vCPUs.
memUsed Memory the guest uses: MemTotal - MemAvailable.
memTotal The miniVM’s memory.
diskUsed, diskTotal Used and total size of the root disk.
timestamp When the sample was taken.
Terminal window
curl -s -H "X-API-Key: $ONS_API_KEY" "https://api.onshore.sh/sandboxes/<minivm-id>/metrics?start=<unix-start>&end=<unix-end>"
  • <unix-start> and <unix-end> are Unix times in seconds. Leave both out for all 7 days.
  • It returns at most the newest 1000 samples, oldest first.
  • GET /sandboxes/metrics?sandbox_ids=<id-1>,<id-2> returns the newest sample of each listed running miniVM (up to 100 ids).

You only see the metrics of miniVMs your key created; any other id answers 404.

In the console, open Usage. It shows the last 30 days, per day: vCPU-hours, memory GiB-hours and the number of miniVMs. Fleet shows your running and paused miniVMs, their size and how long they ran.

What you pay for this usage is on Billing: your balance, the credit ledger and invoices. See Billing and Pricing.