Script Location
CODEBLOCK0
Two Running Modes
Mode 1: Cron Scheduled Sync (Default)
OpenClaw's built-in cron executes the script periodically:
CODEBLOCK1
Trigger phrases: say "sync status", "restart sync" or "同步状态", "重启同步状态" — OpenClaw will trigger execution on schedule.
Mode 2: Daemon Mode
Use --fork to start a real background daemon:
| Command | Description |
|---|
| INLINECODE1 | Start daemon |
| INLINECODE2 |
Start with custom interval (minutes) |
|
python3 scripts/status_uploader.py stop | Stop service |
|
python3 scripts/status_uploader.py status | Check service status |
|
python3 scripts/status_uploader.py set-interval <minutes> | Set sync interval |
|
python3 scripts/status_uploader.py test | Single test upload |
Examples:
CODEBLOCK2
Trigger Conditions
Triggers when any of the following conditions are met:
- 1. First-time initialization: say "enable status monitor", "setup status-monitor" or "启用状态监控", "开启监控同步", "配置 status-monitor"
- Manual trigger: say "sync status", "sync status-monitor", "upload status" or "同步状态", "同步 status-monitor", "上传状态" → single execution
- Scheduled sync: OpenClaw cron triggers → single execution
- Check status: say "check status monitor", "monitor status", "check upload service" or "查看状态监控", "状态监控状态", "检查上传服务"
- Stop service: say "stop status monitor", "stop upload service" or "停止状态监控", "停止上传服务"
- Change interval: say "sync every 10 minutes", "change to 15 minutes" or "每10分钟同步一次", "改成15分钟"
- Daemon mode: say "start status monitor", "start daemon", "run in background" or "启动状态监控", "启动守护进程", "后台运行" → execute INLINECODE7
Additional triggers: say "start status-monitor service", "restart status-monitor service" or "启动status-monitor服务", "重启status-monitor服务".
Initialization Flow (Must Execute on First Use)
Step 1: Check Token Configuration
When the skill runs, first check for the token in these locations:
- 1. Environment variable INLINECODE8
- File INLINECODE9
Step 2: Handling Missing Token
If no token is found, guide the user to register/login:
- 1. Prompt the user:
CODEBLOCK3
- 2. Wait for user to reply with token
- 3. Save the token:
- Create directory
~/.openclaw/credentials/
- Save to
~/.openclaw/credentials/openclaw-status-monitor.json:
CODEBLOCK4
- 4. Validate the token
Step 3: After Successful Token Validation
CODEBLOCK5
Core Functions: Managing the Upload Script
1. Check if Script Exists
CODEBLOCK6
2. Start Service (Recommended)
CODEBLOCK7
3. Set Sync Interval
CODEBLOCK8
4. Stop Service
CODEBLOCK9
5. Check Service Status
CODEBLOCK10
6. View Error Logs
CODEBLOCK11
CODEBLOCK12
Log rotation: log files auto-rotate when exceeding 10MB, format: INLINECODE12
7. Manually Trigger One Upload
CODEBLOCK13
Upload Logic (Simplified)
The script only reads all agent IDs from openclaw.json and uploads them — it does not perform any offline detection.
Offline detection is handled by the monitoring platform (openclaw-agent-monitor):
- - The platform automatically updates
lastActiveTimestamp based on upload time - If no upload is received for 5+ minutes, the platform automatically marks the agent as offline
Storage Configuration
Token Storage Location
INLINECODE15 :
CODEBLOCK14
Log Locations
- - Service log: INLINECODE16
- Error log: INLINECODE17
- PID file: INLINECODE18
- Token config: INLINECODE19
Error Handling
1. Missing Token
During initialization:
CODEBLOCK15
2. Script Not Found
CODEBLOCK16
3. Service Start Failed
Check the error log:
CODEBLOCK17
Common errors:
- - Token not configured
- Network connection failed
- Port already in use
4. Invalid Token
CODEBLOCK18
Example Conversations
First-time Enable
User: 启用状态监控 / enable status monitor
Agent:
Checking monitoring configuration...
❌ No Agent Token detected
Please complete these steps first:
- 1. Visit https://openclaw-agent-monitor.vercel.app
- Click Sign In (supports Google/GitHub, etc.)
- After logging in, generate an Agent Token on the Settings page
- Send me the token
User: 我的 Token 是 e2d3262f-b626-4850-af11-5f2cb1c0dcad / My token is e2d3262f-b626-4850-af11-5f2cb1c0dcad
Agent:
Validating token...
✅ Token validated successfully!
Starting upload service...
- - Running initial sync test...
- ✅ Service started successfully!
✅
Status monitor enabled!
- - Monitor platform: https://openclaw-agent-monitor.vercel.app
- Upload interval: 5 minutes
- Service status: running
Management commands:
- - Say "sync status" / "同步状态" to manually trigger an upload
- Say "check status monitor" / "查看状态监控" to check service status
- Say "stop status monitor" / "停止状态监控" to stop the service
Check Service Status
User: 查看状态监控 / check status monitor
Agent:
Checking upload service status...
✅ Service is running
PID: 12345
Sync interval: 5 minutes
Log file: ~/.openclaw/logs/status_uploader.log
Recent logs:
CODEBLOCK19
Error log: none
Stop Service
User: 停止状态监控 / stop status monitor
Agent:
Stopping upload service...
✅ Service stopped
To restart, say "start status monitor" / "启动状态监控".
Manual Sync
User: 同步状态 / sync status
Agent:
Executing manual upload...
Online agents: ['main', 'coding']
Upload result: ✅ Success
Restart Service
User: 重启状态监控 / restart status monitor
Agent:
Restarting upload service...
✅ Service restarted, PID: 67890
Check Errors
User: 查看状态监控错误日志 / check status monitor error log
Agent:
Checking error logs...
Recent errors:
CODEBLOCK20
Suggestion: Check if the token is correct, or check your network connection.
脚本位置
~/.openclaw/skills/openclaw-status-monitor/scripts/status_uploader.py
两种运行模式
模式 1:Cron 定时同步(默认)
OpenClaw 内置的 cron 会定期执行脚本:
bash
python3 ~/.openclaw/skills/openclaw-status-monitor/scripts/status_uploader.py
触发短语:说 sync status、restart sync 或 同步状态、重启同步状态 — OpenClaw 将按计划触发执行。
模式 2:守护进程模式
使用 --fork 启动一个真正的后台守护进程:
| 命令 | 描述 |
|---|
| python3 scripts/statusuploader.py start --fork | 启动守护进程 |
| python3 scripts/statusuploader.py start --fork --interval 10 |
使用自定义间隔(分钟)启动 |
| python3 scripts/status_uploader.py stop | 停止服务 |
| python3 scripts/status_uploader.py status | 检查服务状态 |
| python3 scripts/status_uploader.py set-interval
| 设置同步间隔 |
| python3 scripts/status_uploader.py test | 单次测试上传 |
示例:
bash
启动守护进程
python3 ~/.openclaw/skills/openclaw-status-monitor/scripts/status_uploader.py start --fork
以 10 分钟间隔启动
python3 ~/.openclaw/skills/openclaw-status-monitor/scripts/status_uploader.py start --fork --interval 10
触发条件
满足以下任一条件时触发:
- 1. 首次初始化:说 enable status monitor、setup status-monitor 或 启用状态监控、开启监控同步、配置 status-monitor
- 手动触发:说 sync status、sync status-monitor、upload status 或 同步状态、同步 status-monitor、上传状态 → 单次执行
- 定时同步:OpenClaw cron 触发 → 单次执行
- 检查状态:说 check status monitor、monitor status、check upload service 或 查看状态监控、状态监控状态、检查上传服务
- 停止服务:说 stop status monitor、stop upload service 或 停止状态监控、停止上传服务
- 更改间隔:说 sync every 10 minutes、change to 15 minutes 或 每10分钟同步一次、改成15分钟
- 守护进程模式:说 start status monitor、start daemon、run in background 或 启动状态监控、启动守护进程、后台运行 → 执行 start --fork
额外触发:说 start status-monitor service、restart status-monitor service 或 启动status-monitor服务、重启status-monitor服务。
初始化流程(首次使用必须执行)
步骤 1:检查 Token 配置
当技能运行时,首先检查以下位置的 token:
- 1. 环境变量 MONITORPLATFORMTOKEN
- 文件 ~/.openclaw/credentials/openclaw-status-monitor.json
步骤 2:处理缺失 Token
如果未找到 token,引导用户注册/登录:
- 1. 提示用户:
未找到监控 token。让我帮您设置...
请选择登录方式:
1. 已有用户:访问 https://openclaw-agent-monitor.vercel.app 并点击登录
2. 新用户:访问 https://openclaw-agent-monitor.vercel.app 并点击注册
登录后:
- 前往设置页面
- 生成并复制您的 Agent Token
- 将生成的 token 发送给我
- 2. 等待用户回复 token
- 3. 保存 token:
- 创建目录 ~/.openclaw/credentials/
- 保存到 ~/.openclaw/credentials/openclaw-status-monitor.json:
json
{
agentToken: 用户提供的token,
createdAt: 2026-03-29T10:00:00.000Z,
monitorUrl: https://openclaw-agent-monitor.vercel.app
}
- 4. 验证 token
步骤 3:Token 验证成功后
✅ Token 配置成功!
正在启动上传服务...
监控平台:https://openclaw-agent-monitor.vercel.app
上传间隔:5 分钟
启动命令:
python3 scripts/status_uploader.py start --fork
管理命令:
- - 说 sync status 手动触发上传
- 说 check status monitor 检查服务状态
- 说 stop status monitor 停止服务
- 说 restart status monitor 重启服务
核心功能:管理上传脚本
1. 检查脚本是否存在
bash
if [ -f ~/.openclaw/skills/openclaw-status-monitor/scripts/status_uploader.py ]; then
echo 脚本存在
else
echo 未找到脚本
fi
2. 启动服务(推荐)
bash
使用 --fork 启动守护进程(推荐)
python3 ~/.openclaw/skills/openclaw-status-monitor/scripts/status_uploader.py start --fork --interval 10
3. 设置同步间隔
bash
方法 1:启动时指定
python3 ~/.openclaw/skills/openclaw-status-monitor/scripts/status_uploader.py start --fork --interval 15
方法 2:使用 set-interval 命令
python3 ~/.openclaw/skills/openclaw-status-monitor/scripts/status_uploader.py set-interval 15
4. 停止服务
bash
python3 ~/.openclaw/skills/openclaw-status-monitor/scripts/status_uploader.py stop
5. 检查服务状态
bash
python3 ~/.openclaw/skills/openclaw-status-monitor/scripts/status_uploader.py status
6. 查看错误日志
~/.openclaw/logs/statusuploadererror.log
~/.openclaw/logs/status_uploader.log
bash
查看最近的错误
tail -50 ~/.openclaw/logs/statusuploadererror.log
查看服务日志
tail -50 ~/.openclaw/logs/status_uploader.log
日志轮转:日志文件超过 10MB 时自动轮转,格式:statusuploader.20260329183500.log
7. 手动触发一次上传
bash
python3 ~/.openclaw/skills/openclaw-status-monitor/scripts/status_uploader.py test
上传逻辑(简化版)
脚本仅从 openclaw.json 读取所有 agent ID 并上传 — 不执行任何离线检测。
离线检测由监控平台(openclaw-agent-monitor)处理:
- - 平台根据上传时间自动更新 lastActiveTimestamp
- 如果超过 5 分钟未收到上传,平台自动将 agent 标记为离线
存储配置
Token 存储位置
~/.openclaw/credentials/openclaw-status-monitor.json:
json
{
agentToken: e2d3262f-b626-4850-af11-5f2cb1c0dcad,
createdAt: 2026-01-26T10:00:00.000Z,
monitorUrl: https://openclaw-agent-monitor.vercel.app,
syncIntervalMinutes: 5
}
日志位置
- - 服务日志:~/.openclaw/logs/statusuploader.log
- 错误日志:~/.openclaw/logs/statusuploadererror.log
- PID 文件:~/.openclaw/logs/statusuploader.pid
- Token 配置:~/.openclaw/credentials/openclaw-status-monitor.json
错误处理
1. 缺失 Token
初始化期间:
❌ 未检测到监控 token
请先完成以下步骤:
- 1. 访问 https://openclaw-agent-monitor.vercel.app
- 点击登录/注册以登录或注册
- 登录后,在设置页面生成 Agent Token
- 将 token 发送给我
示例:我的 Token 是 abc123-def456...
2. 未找到脚本
❌ 未找到上传脚本
请重新安装该技能