vps-service-status

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

VPS Service Status

VPS服务状态

Quick health checks over SSH for a VPS that hosts Docker services.
针对部署Docker服务的VPS,通过SSH进行快速健康检查。

Safety invariant

安全约束

Direct
ssh
commands in this skill must be read-only.
Any command that changes state (sudo, systemctl, docker compose up/down/restart, prune, etc.) goes through the clipboard so the user pastes it manually. This keeps the skill safe to run without per-command confirmation. Do not relax this rule when extending the skill.
**本技能中的直接
ssh
命令必须是只读的。**任何会改变系统状态的命令(sudo、systemctl、docker compose up/down/restart、prune等)都会通过剪贴板提供,由用户手动粘贴执行。这样无需逐命令确认即可安全运行本技能。扩展技能时请勿放宽此规则。

Configuration

配置说明

This skill assumes:
  • An SSH alias is configured in
    ~/.ssh/config
    for the VPS (so
    ssh <alias>
    connects without further flags). Below,
    <vps-host>
    is a placeholder for that alias — replace with whatever you use (e.g.
    hetzner
    ,
    prod
    ,
    myvps
    ).
  • Services are managed with
    docker compose
    and live under a known root such as
    /var/services/<service>/
    or
    /srv/<service>/
    . Adjust paths to match your VPS.
  • The clipboard helper is
    pbcopy
    (macOS). On Linux substitute
    xclip -selection clipboard
    or
    wl-copy
    .
If the user has not told you their SSH alias or service root, ask once before running.
本技能基于以下前提:
  • 已在
    ~/.ssh/config
    中为VPS配置SSH别名(执行
    ssh <alias>
    即可直接连接,无需额外参数)。下文的
    <vps-host>
    是该别名的占位符,请替换为你实际使用的别名(如
    hetzner
    prod
    myvps
    )。
  • 服务通过
    docker compose
    管理,且位于已知根目录下,例如
    /var/services/<service>/
    /srv/<service>/
    。请根据你的VPS调整路径。
  • 剪贴板工具为
    pbcopy
    (适用于macOS)。在Linux系统上请替换为
    xclip -selection clipboard
    wl-copy
如果用户未告知其SSH别名或服务根目录,请在运行前询问一次。

System Overview (direct, read-only)

系统概览(直接执行,只读)

bash
ssh <vps-host> "echo '=== Containers ===' && docker ps --format 'table {{.Names}}\t{{.Status}}' && echo && echo '=== Disk ===' && df -h / && echo && echo '=== Memory ===' && free -h"
bash
ssh <vps-host> "echo '=== Containers ===' && docker ps --format 'table {{.Names}}\t{{.Status}}' && echo && echo '=== Disk ===' && df -h / && echo && echo '=== Memory ===' && free -h"

Containers (direct, read-only)

容器检查(直接执行,只读)

bash
ssh <vps-host> "docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'"
ssh <vps-host> "cd /var/services/<service> && docker compose logs --tail 30"
bash
ssh <vps-host> "docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'"
ssh <vps-host> "cd /var/services/<service> && docker compose logs --tail 30"

System Services (clipboard — needs sudo)

系统服务检查(剪贴板提供,需sudo权限)

sudo
over a non-interactive SSH command will fail (no TTY for the password prompt), so these are copied to the clipboard for the user to paste after SSH'ing in manually:
bash
echo 'sudo systemctl status <unit> --no-pager' | pbcopy
echo 'sudo systemctl status caddy --no-pager' | pbcopy
echo 'sudo systemctl status webhook --no-pager' | pbcopy
在非交互式SSH命令中执行
sudo
会失败(没有TTY用于密码提示),因此这些命令会被复制到剪贴板,供用户手动SSH登录后粘贴执行:
bash
echo 'sudo systemctl status <unit> --no-pager' | pbcopy
echo 'sudo systemctl status caddy --no-pager' | pbcopy
echo 'sudo systemctl status webhook --no-pager' | pbcopy

Recent Deployments (clipboard — needs sudo)

近期部署检查(剪贴板提供,需sudo权限)

bash
echo 'sudo journalctl -u <unit> --since "1 hour ago" | grep -E "(Starting|finished|ERROR)"' | pbcopy
bash
echo 'sudo journalctl -u <unit> --since "1 hour ago" | grep -E "(Starting|finished|ERROR)"' | pbcopy

Detailed Checks

详细检查

  • Resource monitoring (disk, memory, CPU, network): references/resources.md
  • Per-service health endpoint patterns: references/service-checks.md
  • 资源监控(磁盘、内存、CPU、网络):references/resources.md
  • 各服务健康检查端点模式:references/service-checks.md