curl --request GET \
--url https://sandbox.e2b.app/metrics \
--header 'E2b-Sandbox-Id: <e2b-sandbox-id>' \
--header 'E2b-Sandbox-Port: <e2b-sandbox-port>' \
--header 'X-Access-Token: <api-key>'import requests
url = "https://sandbox.e2b.app/metrics"
headers = {
"E2b-Sandbox-Id": "<e2b-sandbox-id>",
"E2b-Sandbox-Port": "<e2b-sandbox-port>",
"X-Access-Token": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'E2b-Sandbox-Id': '<e2b-sandbox-id>',
'E2b-Sandbox-Port': '<e2b-sandbox-port>',
'X-Access-Token': '<api-key>'
}
};
fetch('https://sandbox.e2b.app/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.e2b.app/metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"E2b-Sandbox-Id: <e2b-sandbox-id>",
"E2b-Sandbox-Port: <e2b-sandbox-port>",
"X-Access-Token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.e2b.app/metrics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("E2b-Sandbox-Id", "<e2b-sandbox-id>")
req.Header.Add("E2b-Sandbox-Port", "<e2b-sandbox-port>")
req.Header.Add("X-Access-Token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.e2b.app/metrics")
.header("E2b-Sandbox-Id", "<e2b-sandbox-id>")
.header("E2b-Sandbox-Port", "<e2b-sandbox-port>")
.header("X-Access-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.e2b.app/metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["E2b-Sandbox-Id"] = '<e2b-sandbox-id>'
request["E2b-Sandbox-Port"] = '<e2b-sandbox-port>'
request["X-Access-Token"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"ts": 123,
"cpu_count": 123,
"cpu_possible": 123,
"cpu_target": 123,
"cpu_target_attempts": 123,
"cpu_write_pending_ms": 123,
"cpu_used_pct": 123,
"mem_total": 123,
"mem_used": 123,
"mem_cache": 123,
"disk_used": 123,
"disk_total": 123,
"oom_kills": [
{
"seq": 123,
"process": "<string>"
}
],
"mem_used_mib": 123,
"mem_total_mib": 123
}missing header
{
"code": 401,
"message": "unauthorized access, please provide a valid access token or method signing if supported"
}Unexpected error when routing request: invalid sandbox port
{
"sandboxId": "sandbox-id",
"message": "The sandbox was not found",
"code": 502
}Service stats
curl --request GET \
--url https://sandbox.e2b.app/metrics \
--header 'E2b-Sandbox-Id: <e2b-sandbox-id>' \
--header 'E2b-Sandbox-Port: <e2b-sandbox-port>' \
--header 'X-Access-Token: <api-key>'import requests
url = "https://sandbox.e2b.app/metrics"
headers = {
"E2b-Sandbox-Id": "<e2b-sandbox-id>",
"E2b-Sandbox-Port": "<e2b-sandbox-port>",
"X-Access-Token": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'E2b-Sandbox-Id': '<e2b-sandbox-id>',
'E2b-Sandbox-Port': '<e2b-sandbox-port>',
'X-Access-Token': '<api-key>'
}
};
fetch('https://sandbox.e2b.app/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.e2b.app/metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"E2b-Sandbox-Id: <e2b-sandbox-id>",
"E2b-Sandbox-Port: <e2b-sandbox-port>",
"X-Access-Token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.e2b.app/metrics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("E2b-Sandbox-Id", "<e2b-sandbox-id>")
req.Header.Add("E2b-Sandbox-Port", "<e2b-sandbox-port>")
req.Header.Add("X-Access-Token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.e2b.app/metrics")
.header("E2b-Sandbox-Id", "<e2b-sandbox-id>")
.header("E2b-Sandbox-Port", "<e2b-sandbox-port>")
.header("X-Access-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.e2b.app/metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["E2b-Sandbox-Id"] = '<e2b-sandbox-id>'
request["E2b-Sandbox-Port"] = '<e2b-sandbox-port>'
request["X-Access-Token"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"ts": 123,
"cpu_count": 123,
"cpu_possible": 123,
"cpu_target": 123,
"cpu_target_attempts": 123,
"cpu_write_pending_ms": 123,
"cpu_used_pct": 123,
"mem_total": 123,
"mem_used": 123,
"mem_cache": 123,
"disk_used": 123,
"disk_total": 123,
"oom_kills": [
{
"seq": 123,
"process": "<string>"
}
],
"mem_used_mib": 123,
"mem_total_mib": 123
}missing header
{
"code": 401,
"message": "unauthorized access, please provide a valid access token or method signing if supported"
}Unexpected error when routing request: invalid sandbox port
{
"sandboxId": "sandbox-id",
"message": "The sandbox was not found",
"code": 502
}Authorizations
Sandbox access token (envdAccessToken) for authenticating requests to a running sandbox. Returned by: POST /sandboxes (on create), POST /sandboxes/{sandboxID}/connect (on connect), POST /sandboxes/{sandboxID}/resume (on resume), and GET /sandboxes/{sandboxID} (for running or paused sandboxes).
Headers
Identifier of the target sandbox. Routes the request to that sandbox's envd over the shared sandbox host.
Port envd listens on inside the sandbox (default 49983).
Response
The resource usage metrics of the service
Resource usage metrics
Unix timestamp in UTC for current sandbox time
Number of CPU cores online
Number of CPUs the guest can bring online
Online count last requested, 0 when none was
Attempts at reaching cpu_target since it was set
How long a CPU online or offline write has been running in the guest kernel, 0 when none is. A value that keeps growing means CPU hotplug is stuck.
CPU usage percentage
Total virtual memory in bytes
Used virtual memory in bytes
Cached memory (page cache) in bytes
Used disk space in bytes
Total disk space in bytes
The latest 32 out-of-memory kills since the guest booted, oldest first. Reading does not consume them. Empty when there are none. Omitted when not known (while envd is still reading the kernel log, when it can't be read or envd stopped reading it, and outside Firecracker).
Show child attributes
Show child attributes
Used virtual memory in MiB
Total virtual memory in MiB
Was this page helpful?