Bot Status API
by @suspect80
Deploy a lightweight status API that exposes your OpenClaw bot's runtime health, service connectivity, cron jobs, skills, system metrics, and more. Use when setting up a monitoring dashboard, health endpoint, or status page for an OpenClaw agent. Supports any services via config (HTTP checks, CLI commands, file checks). Zero dependencies β Node.js only.
clawhub install bot-status-apiπ About This Skill
name: bot-status-api description: "Deploy a lightweight status API that exposes your OpenClaw bot's runtime health, service connectivity, cron jobs, skills, system metrics, and more. Use when setting up a monitoring dashboard, health endpoint, or status page for an OpenClaw agent. Supports any services via config (HTTP checks, CLI commands, file checks). Zero dependencies β Node.js only."
Bot Status API
A configurable HTTP service that exposes your OpenClaw bot's operational status as JSON. Designed for dashboard integration, monitoring, and transparency.
What It Provides
cron/jobs.json/procSetup
1. Copy the service files
Copy server.js, collectors/, and package.json to your desired location.
2. Create config.json
Copy config.example.json to config.json and customize:
{
"port": 3200,
"name": "MyBot",
"workspace": "/path/to/.openclaw/workspace",
"openclawHome": "/path/to/.openclaw",
"cache": { "ttlMs": 10000 },
"model": "claude-sonnet-4-20250514",
"skillDirs": ["/path/to/openclaw/skills"],
"services": [
{ "name": "myservice", "type": "http", "url": "http://...", "healthPath": "/health" }
]
}
Service Check Types
| Type | Description | Config |
|------|-------------|--------|
| http | Fetch URL, check HTTP 200 | url, healthPath, method, headers, body |
| command | Run shell command, check exit 0 | command, timeout |
| file-exists | Check path exists | path |
3. Run
node server.js
4. Persist (systemd user service)
# ~/.config/systemd/user/bot-status.service
[Unit]
Description=Bot Status API
After=network.target[Service]
Type=simple
WorkingDirectory=/path/to/bot-status
ExecStart=/usr/bin/node server.js
Restart=always
RestartSec=5
Environment=PORT=3200
Environment=HOME=/home/youruser
Environment=PATH=/usr/local/bin:/usr/bin:/bin
[Install]
WantedBy=default.target
systemctl --user daemon-reload
systemctl --user enable --now bot-status
loginctl enable-linger $USER # survive logout
5. Context/Vitals from OpenClaw
The bot should periodically write vitals to heartbeat-state.json in its workspace:
{
"vitals": {
"contextPercent": 62,
"contextUsed": 124000,
"contextMax": 200000,
"model": "claude-opus-4-5",
"updatedAt": 1770304500000
}
}
Add this to your HEARTBEAT.md so the bot updates it each heartbeat cycle.
Endpoints
| Endpoint | Description |
|----------|-------------|
| GET /status | Full status JSON (cached) |
| GET /health | Simple {"status":"ok"} |
Architecture
http, fs, child_process)exec, never execSyncconfig.json, no hardcoded valuesβοΈ Configuration
1. Copy the service files
Copy server.js, collectors/, and package.json to your desired location.
2. Create config.json
Copy config.example.json to config.json and customize:
{
"port": 3200,
"name": "MyBot",
"workspace": "/path/to/.openclaw/workspace",
"openclawHome": "/path/to/.openclaw",
"cache": { "ttlMs": 10000 },
"model": "claude-sonnet-4-20250514",
"skillDirs": ["/path/to/openclaw/skills"],
"services": [
{ "name": "myservice", "type": "http", "url": "http://...", "healthPath": "/health" }
]
}
Service Check Types
| Type | Description | Config |
|------|-------------|--------|
| http | Fetch URL, check HTTP 200 | url, healthPath, method, headers, body |
| command | Run shell command, check exit 0 | command, timeout |
| file-exists | Check path exists | path |
3. Run
node server.js
4. Persist (systemd user service)
# ~/.config/systemd/user/bot-status.service
[Unit]
Description=Bot Status API
After=network.target[Service]
Type=simple
WorkingDirectory=/path/to/bot-status
ExecStart=/usr/bin/node server.js
Restart=always
RestartSec=5
Environment=PORT=3200
Environment=HOME=/home/youruser
Environment=PATH=/usr/local/bin:/usr/bin:/bin
[Install]
WantedBy=default.target
systemctl --user daemon-reload
systemctl --user enable --now bot-status
loginctl enable-linger $USER # survive logout
5. Context/Vitals from OpenClaw
The bot should periodically write vitals to heartbeat-state.json in its workspace:
{
"vitals": {
"contextPercent": 62,
"contextUsed": 124000,
"contextMax": 200000,
"model": "claude-opus-4-5",
"updatedAt": 1770304500000
}
}
Add this to your HEARTBEAT.md so the bot updates it each heartbeat cycle.