Skip to main content
OpenSandbox provides comprehensive monitoring capabilities for tracking sandbox health, resource usage, and system metrics across both server and container environments.

Health Checks

Server Health Endpoint

The OpenSandbox server exposes a health check endpoint for monitoring service availability:
Expected Response:
This endpoint is used by:
  • Load balancers for health checks
  • Monitoring systems for uptime tracking
  • Kubernetes liveness/readiness probes
  • Orchestration platforms

Execd Health Check

Each sandbox container runs an execd daemon that exposes its own health endpoint on port 44772:
Response: HTTP 200 OK if the execd daemon is running properly.

System Metrics

Metrics Endpoint

The execd API provides real-time system resource metrics for individual sandboxes:
Response:

Metrics Fields

Real-time Metrics Streaming

For continuous monitoring, use the Server-Sent Events (SSE) endpoint:
This streams metrics updates every second:

Sandbox Status Monitoring

Get Sandbox Details

Retrieve the current status of a sandbox:
Response:

Sandbox Lifecycle States

Kubernetes Monitoring

BatchSandbox Status

For Kubernetes deployments, monitor BatchSandbox resources:
Example Output:
Status Fields:
  • DESIRED: Number of sandboxes requested
  • TOTAL: Total sandboxes created
  • ALLOCATED: Sandboxes successfully allocated
  • READY: Sandboxes ready for use
  • EXPIRE: Expiration time

Pool Status

Monitor resource pool availability:

Task Status

For BatchSandbox with tasks:
Output:

Logging Configuration

Server Log Levels

Configure logging in ~/.sandbox.toml:

Kubernetes Controller Logging

Console Output (Default)

File Logging with Rotation

Parameters:

Production Configuration

Viewing Logs

Integration with Monitoring Systems

Prometheus Metrics

You can expose sandbox metrics to Prometheus by:
  1. Polling the /metrics endpoint periodically
  2. Converting JSON metrics to Prometheus format
  3. Using a metrics exporter sidecar

Kubernetes Events

Monitor Kubernetes events for sandbox lifecycle changes:

Custom Monitoring

Example Python script for monitoring:

Best Practices

Configure health checks for both the server and individual sandboxes to enable:
  • Automatic restart of failed containers
  • Load balancer traffic routing
  • Alert generation on service degradation
Always enable log rotation in production to:
  • Prevent disk space exhaustion
  • Maintain historical logs for debugging
  • Compress old logs to save space
  • Comply with retention policies
Enable JSON logging format for:
  • Easy parsing by log aggregation tools
  • Better searchability
  • Integration with monitoring platforms
  • Automated alerting