🦞 Ubuntu 24.04 · OpenClaw · 运维巡检中心
10
巡检分区
26
命令模块
210
命令行数
100%
响应式适配

使用建议

先执行基础巡检,再按异常场景进入 OpenClaw 专项或故障模板。

🧭 基础身份 / 时间 / 系统版本

先确认当前主机、系统版本、时区、登录身份与运行时长。

VPS 基础 巡检

基础环境确认

适合刚登录服务器时第一时间执行。
Command Block 8 lines
hostnamectl
uname -a
lsb_release -a 2>/dev/null || cat /etc/os-release
whoami
id
date
timedatectl
uptime
重点观察
  • 主机名是否正确
  • Ubuntu 版本是否符合预期
  • 时区与系统时间是否正确
  • uptime 是否异常短

📊 CPU / 内存 / 负载 / 进程

快速判断机器是否吃紧,是否存在高占用进程。

资源 性能 进程

资源总览

观察 load average、内存可用量、CPU 和内存占用 Top 进程。
Command Block 8 lines
uptime
free -h
vmstat 1 5
top -b -n 1 | head -n 30
ps -eo pid,ppid,user,%cpu,%mem,stat,start,time,cmd --sort=-%mem | head -n 20
ps -eo pid,ppid,user,%cpu,%mem,stat,start,time,cmd --sort=-%cpu | head -n 20
cat /proc/loadavg
nproc
重点观察
  • load 是否持续偏高
  • available memory 是否过低
  • 是否有异常高占用进程
  • OpenClaw / Chrome 是否异常膨胀

💾 磁盘 / Inode / 挂载 / 大文件

很多服务异常都和磁盘打满、inode 耗尽、缓存膨胀有关。

磁盘 缓存 排查

磁盘与挂载总览

确认根分区空间、inode 使用率,以及 OpenClaw 目录体积。
Command Block 7 lines
df -hT
df -ih
lsblk
mount | column -t | sed -n \"1,80p\"
du -sh /root/.openclaw 2>/dev/null
du -sh /tmp/openclaw 2>/dev/null
du -sh /var/log 2>/dev/null
重点观察
  • 根分区使用率是否逼近 80%/90%
  • inode 是否异常高
  • .openclaw 与日志目录是否膨胀

定位大文件 / 大目录

深挖空间占用时使用。
Command Block 2 lines
find / -xdev -type f -size +200M 2>/dev/null | head -n 100
du -xhd1 / | sort -h
重点观察
  • 大文件是否可清理
  • 缓存、日志、浏览器 Profile 是否过大

🌐 网络 / 路由 / 端口监听

适合确认 SSH、Web、OpenClaw gateway 和 browser control 端口。

网络 端口 监听

网络总览

查看 IP、路由和所有监听端口。
Command Block 6 lines
ip a
ip r
ss -lntp
ss -lntup
ss -antp | head -n 100
ss -lntp | egrep \":22|:80|:443|:18789|:18791|:18800\"
重点观察
  • 22/80/443 是否监听
  • 18789/18791/18800 是否正常
  • 是否存在异常连接

🛡️ 防火墙 / 登录 / 安全事件

适合日常安全巡查与异常登录回溯。

安全 UFW 登录

防火墙与封禁

Ubuntu 场景优先看 UFW,存在 fail2ban 时一起检查。
Command Block 6 lines
ufw status verbose
iptables -S
iptables -L -n -v
nft list ruleset 2>/dev/null | sed -n \"1,200p\"
fail2ban-client status
fail2ban-client status sshd
重点观察
  • 默认策略是否正确
  • 22/80/443 是否已放行
  • 是否有异常封禁或重复规则

登录与失败记录

回看最近谁登录过、从哪里来、失败次数如何。
Command Block 8 lines
last -a | head -n 30
lastb -a | head -n 30
who
w
journalctl --list-boots
last reboot | head -n 20
journalctl -u ssh --since \"24 hours ago\" --no-pager
journalctl -u sshd --since \"24 hours ago\" --no-pager
重点观察
  • 最近登录 IP 是否正常
  • 是否存在暴力破解痕迹
  • 是否发生过异常重启

内核错误 / OOM / 崩溃迹象

适合解释“为什么服务突然不稳”。
Command Block 5 lines
dmesg -T | tail -n 100
dmesg -T | egrep -i \"oom|killed process|segfault|error|fail\" | tail -n 100
journalctl -p err -b --no-pager
journalctl -k -b --no-pager | tail -n 100
dmesg -T | egrep -i \"out of memory|oom-killer|killed process\" | tail -n 50
重点观察
  • 是否发生 OOM
  • 是否有内核级错误
  • 是否存在进程被系统杀死

⚙️ 系统服务 / 更新补丁

确认核心服务状态、失败服务和安全更新。

systemd 更新 服务

系统服务状态

看哪些服务异常、哪些服务运行中。
Command Block 8 lines
systemctl --failed
systemctl list-units --type=service --state=running | sed -n \"1,120p\"
systemctl status ssh --no-pager -l
systemctl status ufw --no-pager -l
systemctl status fail2ban --no-pager -l
systemctl status nginx --no-pager -l
systemctl status apache2 --no-pager -l
systemctl status php*-fpm --no-pager -l
重点观察
  • 是否有 failed 单元
  • SSH/UFW/fail2ban 是否正常
  • Web 服务是否在线

更新与安全补丁

巡检 Ubuntu 可升级包与安全状态。
Command Block 4 lines
apt update
apt list --upgradable
unattended-upgrades --dry-run -d 2>/dev/null | tail -n 100
ubuntu-security-status 2>/dev/null || pro security-status 2>/dev/null
重点观察
  • 是否存在安全更新
  • 自动更新机制是否正常
  • ESM 提示是否需要关注

🦞 OpenClaw 核心巡检

先看总览,再看 gateway / health / doctor。适合日常最常用检查。

OpenClaw 状态 核心

核心状态检查

你当前环境最有价值的一组命令。
Command Block 7 lines
openclaw status
openclaw status --all
openclaw gateway status
openclaw gateway status --require-rpc
openclaw doctor
openclaw channels status --probe
openclaw logs --follow
重点观察
  • gateway 是否 running
  • RPC probe 是否 ok
  • doctor 是否给出修复提示
  • 通道是否真实可达

Gateway 专项

看 gateway 深度状态、JSON 输出和 systemd 进程。
Command Block 11 lines
openclaw gateway status
openclaw gateway status --deep
openclaw gateway status --json
openclaw gateway probe
openclaw gateway probe --json
systemctl --user status openclaw-gateway --no-pager -l
systemctl --user cat openclaw-gateway
journalctl --user -u openclaw-gateway -n 200 --no-pager
journalctl --user -u openclaw-gateway -f
ss -lntp | egrep \":18789|:18791|:18800\"
pgrep -a -f \"openclaw|chrome|chromium\"
重点观察
  • 18789/18791/18800 是否监听
  • systemd 用户服务是否 active
  • Chrome 子进程是否正常

Health 健康检查

用于介于“没问题”和“要追日志”之间的快速检查。
Command Block 3 lines
openclaw health
openclaw health --json
openclaw health --verbose
重点观察
  • 是否存在 degraded 状态
  • verbose 模式下是否有 live probe 异常

🚀 通道 / 模型 / 浏览器 / Security / Secrets / Cron

围绕 OpenClaw 真正执行能力的专题检查。

Channel Model Browser Cron

Channel 通道巡检

重点看 Telegram 等通道是否 enabled / configured / running。
Command Block 4 lines
openclaw channels list
openclaw channels status
openclaw channels status --probe
openclaw channels logs
重点观察
  • enabled / configured / running 状态
  • bot 名称与 token 来源是否正确

Models / Provider 巡检

确认默认模型、fallback、provider 鉴权来源。
Command Block 4 lines
openclaw models status
openclaw models status --probe
openclaw config get agents.defaults.models
env | egrep \"OPENROUTER|NVIDIA|GEMINI|ANTHROPIC|OPENAI\"
重点观察
  • Default 模型是否正确
  • --probe 是否出现 rate limit 或 auth fail
  • provider token 来源是否一致

Browser 巡检

用于浏览器控制和页面测试。
Command Block 6 lines
openclaw browser status
openclaw browser start --browser-profile openclaw
openclaw browser stop --browser-profile openclaw
openclaw browser tabs --browser-profile openclaw
openclaw browser open https://live.zoyzo.cn/ --browser-profile openclaw
openclaw browser snapshot --browser-profile openclaw
重点观察
  • running 是否为 true
  • detectedPath 是否正确
  • cdpPort 是否存在
  • profile 是否为 openclaw

Security / Secrets / Cron

配置改动后必查的一组。
Command Block 10 lines
openclaw security audit
openclaw security audit --deep
openclaw security audit --json
openclaw secrets audit
openclaw secrets reload
openclaw cron status
openclaw cron list
openclaw cron --help
ls -lah ~/.openclaw/cron/
cat ~/.openclaw/cron/jobs.json 2>/dev/null
重点观察
  • trusted proxies / browser control 暴露面
  • token 刷新后是否已加载
  • cron 是否启用且 nextRunAt 正常

日志与配置文件位置

定位配置变更与运行日志时使用。
Command Block 8 lines
ls -lah ~/.openclaw
ls -lah ~/.openclaw/agents/main/agent
ls -lah ~/.config/systemd/user
ls -lah /tmp/openclaw
cat ~/.openclaw/openclaw.json
cat ~/.config/systemd/user/openclaw-gateway.service
tail -n 200 /tmp/openclaw/openclaw-$(date +%F).log
ls -l ~/.openclaw/openclaw.json*
重点观察
  • 配置文件是否被覆盖
  • 当天日志是否正常滚动
  • service 文件是否符合预期

🧪 常见故障定位模板

按场景给出最快速的排查动作。

故障 排障 模板

OpenClaw 起不来

先看 status,再看 systemd 和最近日志。
Command Block 7 lines
openclaw gateway status
openclaw status
openclaw logs --follow
openclaw doctor
openclaw gateway status --deep
systemctl --user status openclaw-gateway --no-pager -l
journalctl --user -u openclaw-gateway -n 200 --no-pager
重点观察
  • gateway 是否启动失败
  • 日志是否报 token / browser / bind 相关错误

Control UI 不通

重点看 bind、dashboard URL、监听与本地 curl。
Command Block 7 lines
openclaw gateway status
openclaw status
openclaw logs --follow
openclaw doctor
openclaw gateway status --json
ss -lntp | grep 18789
curl -I http://127.0.0.1:18789/ 2>/dev/null | head
重点观察
  • 18789 是否监听
  • dashboard 是否仅 loopback
  • token/auth 是否匹配

浏览器挂了 / 无法打开页面

优先确认 browser status、Chrome 进程、CDP 端口。
Command Block 5 lines
openclaw browser status
openclaw browser start --browser-profile openclaw
journalctl --user -u openclaw-gateway -n 200 --no-pager | egrep -i \"browser|chrome|chromium|cdp\"
pgrep -a -f \"chrome|chromium\"
ss -lntp | grep 18800
重点观察
  • Chrome 是否启动
  • 18800 是否存在
  • stderr 是否有 noSandbox / path 错误

模型调用异常 / 限流 / token 失效

从 logs、models、默认模型和环境变量四处交叉核对。
Command Block 5 lines
openclaw logs --follow
openclaw models status
openclaw models status --probe
openclaw config get agents.defaults.models
env | egrep \"OPENROUTER|NVIDIA|GEMINI|ANTHROPIC|OPENAI\"
重点观察
  • 是否 rate limit
  • 是否 auth fail
  • 默认模型配置是否漂移

Telegram 通道异常

以 channels status --probe 为准,再看 journal。
Command Block 3 lines
openclaw channels status --probe
openclaw channels logs
journalctl --user -u openclaw-gateway -n 200 --no-pager | grep -i telegram
重点观察
  • enabled/configured/running 状态
  • Telegram 轮询或发送日志是否异常

⚡ 快速函数 / 每日巡检

适合直接写进 ~/.bashrc,日后执行更高效。

快捷 函数 高频

vpscheck 快速函数

汇总 VPS 基础信息、端口、防火墙、登录与内核错误。
Command Block 30 lines
vpscheck () {
  echo "===== BASIC ====="
  date
  hostnamectl | sed -n "1,12p"
  echo
  echo "===== UPTIME / LOAD ====="
  uptime
  free -h
  echo
  echo "===== DISK ====="
  df -hT
  echo
  echo "===== PORTS ====="
  ss -lntp | egrep "(:22|:80|:443|:18789|:18791|:18800)|State"
  echo
  echo "===== FIREWALL ====="
  ufw status verbose
  echo
  echo "===== FAILED SERVICES ====="
  systemctl --failed
  echo
  echo "===== RECENT LOGINS ====="
  last -a | head -n 10
  echo
  echo "===== SSH FAILURES ====="
  lastb -a | head -n 10
  echo
  echo "===== KERNEL ERRORS ====="
  dmesg -T | egrep -i "oom|killed process|segfault|error|fail" | tail -n 20
}
重点观察
  • 保存到 ~/.bashrc 后可直接执行 vpscheck

occheck 快速函数

汇总 OpenClaw 核心状态、健康检查、浏览器与安全项。
Command Block 32 lines
occheck () {
  echo "===== OPENCLAW STATUS ====="
  openclaw status
  echo
  echo "===== GATEWAY STATUS ====="
  openclaw gateway status --require-rpc
  echo
  echo "===== HEALTH ====="
  openclaw health 2>/dev/null || true
  echo
  echo "===== CHANNELS ====="
  openclaw channels status --probe
  echo
  echo "===== MODELS ====="
  openclaw models status
  echo
  echo "===== BROWSER ====="
  openclaw browser status
  echo
  echo "===== SECURITY ====="
  openclaw security audit
  echo
  echo "===== CRON ====="
  openclaw cron status 2>/dev/null || true
  openclaw cron list 2>/dev/null || true
  echo
  echo "===== SERVICE ====="
  systemctl --user status openclaw-gateway --no-pager -l | sed -n "1,40p"
  echo
  echo "===== RECENT LOGS ====="
  journalctl --user -u openclaw-gateway -n 50 --no-pager
}
重点观察
  • 保存到 ~/.bashrc 后可直接执行 occheck

建议的每日巡检顺序

高频使用建议。
Command Block 6 lines
source ~/.bashrc
vpscheck
occheck
openclaw security audit --deep
openclaw browser status
openclaw channels status --probe
重点观察
  • 形成标准化巡检动作,减少遗漏