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 Block8 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 Block7 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 Block2 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 Block6 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 Block6 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 Block8 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
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 Block4 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 Block7 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 Block11 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 Block3 lines
openclaw health
openclaw health --json
openclaw health --verbose
openclaw channels list
openclaw channels status
openclaw channels status --probe
openclaw channels logs
重点观察
enabled / configured / running 状态
bot 名称与 token 来源是否正确
Models / Provider 巡检
确认默认模型、fallback、provider 鉴权来源。
Command Block4 lines
openclaw models status
openclaw models status --probe
openclaw config get agents.defaults.models
env | egrep \"OPENROUTER|NVIDIA|GEMINI|ANTHROPIC|OPENAI\"
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 Block7 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 Block7 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 Block5 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 Block5 lines
openclaw logs --follow
openclaw models status
openclaw models status --probe
openclaw config get agents.defaults.models
env | egrep \"OPENROUTER|NVIDIA|GEMINI|ANTHROPIC|OPENAI\"