إنتقل إلى المحتوى الرئيسي

🖥️ 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