沙箱
沙箱指标
读取一个沙箱的 CPU、内存与磁盘用量。
先调用「创建沙箱」,用返回的 sandboxID 替换 sbx_123。
GET
/sandbox/v1/sandboxes/{sandboxID}/metrics● 支持请求参数
sandboxIDstring必填path: 沙箱 ID。
startinteger可选query: Unix timestamp for the start of the interval, in seconds, for which the metrics
endinteger可选query: Unix timestamp in seconds at which the metrics window ends. Omit it to read up to the latest sample.
返回
200
错误按 E2B 格式返回,参见 错误码
响应
HTTP 200
Successfully returned the sandbox metrics
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| [].timestamp | string | Timestamp of the metric entry |
| [].timestampUnix | integer | Timestamp of the metric entry in Unix time (seconds since epoch) |
| [].cpuCount | integer | Number of CPU cores |
| [].cpuUsedPct | number | CPU usage percentage |
| [].memUsed | integer | Memory used in bytes |
| [].memTotal | integer | Total memory in bytes |
| [].memCache | integer | Cached memory (page cache) in bytes |
| [].diskUsed | integer | Disk used in bytes |
| [].diskTotal | integer | Total disk space in bytes |