Zum Hauptinhalt springen

๐Ÿ–ฅ๏ธ Server Agent API

Submit Server Metricsโ€‹

Report server system metrics from an agent script.

Endpointโ€‹

POST /agent/report

Headersโ€‹

Content-Type: application/json
Accept: application/json

Request Bodyโ€‹

{
"agent_key": "your-agent-key-here",
"cpu_usage": 23.5,
"cpu_iowait": 1.2,
"memory_usage": 67.4,
"memory_total_mb": 8192,
"swap_usage": 5.0,
"disk_usage": [
{
"mount": "/",
"usage": 45,
"size": "50G",
"used": "22G",
"avail": "28G"
}
],
"network_rx_bytes": 1234567890,
"network_tx_bytes": 987654321,
"load_1m": 0.5,
"load_5m": 0.3,
"load_15m": 0.2,
"os": "Ubuntu 24.04 LTS",
"hostname": "web-server-1",
"kernel": "6.5.0-44-generic"
}

Fieldsโ€‹

FieldTypeRequiredDescription
agent_keystringโœ…Unique agent authentication key
cpu_usagefloatโœ…CPU usage percentage (0-100)
cpu_iowaitfloatโŒCPU I/O wait percentage
memory_usagefloatโœ…Memory usage percentage (0-100)
memory_total_mbintegerโœ…Total RAM in megabytes
swap_usagefloatโŒSwap usage percentage
disk_usagearrayโœ…Array of disk mount points
disk_usage[].mountstringโœ…Mount point path
disk_usage[].usagefloatโœ…Usage percentage
disk_usage[].sizestringโŒTotal size (human-readable)
disk_usage[].usedstringโŒUsed space
disk_usage[].availstringโŒAvailable space
network_rx_bytesintegerโŒNetwork bytes received
network_tx_bytesintegerโŒNetwork bytes transmitted
load_1mfloatโŒ1-minute load average
load_5mfloatโŒ5-minute load average
load_15mfloatโŒ15-minute load average
osstringโŒOperating system name
hostnamestringโŒServer hostname
kernelstringโŒKernel version

Responseโ€‹

{
"status": "ok"
}

Error Responsesโ€‹

Status CodeMeaning
422Invalid agent key or missing required fields
404Agent key not found

๐Ÿ”‘ Finding Your Agent Keyโ€‹

  1. Create a Server Agent monitor in the dashboard
  2. The agent key is generated automatically
  3. View it in the monitor's detail page