标签 Komari探针 下的文章

用了一年多Komari,越来越感觉臃肿,很多用不到的功能越加越多

另外最担心的还是安全问题,最近更换成了 https://github.com/monitor-probe/monitor

一款极简,克制的探针,轻量,安全都很好

Komari一键删除脚本如下,终端直接执行即可

bash <<'EOF'
set -Eeuo pipefail
trap 'echo "卸载未完成,请查看上方错误信息。" >&2' ERR

if [[ "$EUID" -ne 0 ]]; then
  echo "请使用 root 执行此脚本。"
  exit 1
fi

echo "[1/3] 停止客户端并取消自启动..."
systemctl daemon-reload
if systemctl cat komari-agent.service >/dev/null 2>&1; then
  systemctl disable --now komari-agent.service
  systemctl reset-failed komari-agent.service 2>/dev/null || true
fi

command -v pgrep >/dev/null
if pgrep -f '^/opt/komari/agent([[:space:]]|$)' >/dev/null; then
  echo "仍有客户端进程运行,卸载已停止。"
  exit 1
fi

echo "[2/3] 删除客户端和服务配置..."
rm -f /etc/systemd/system/komari-agent.service
rm -rf /etc/systemd/system/komari-agent.service.d
rm -f /opt/komari/agent

# 删除空目录,避免误删后来放入的其他文件
if [[ -d /opt/komari ]]; then
  rmdir /opt/komari
fi

systemctl daemon-reload

echo "[3/3] 检查卸载结果..."
if systemctl cat komari-agent.service >/dev/null 2>&1 ||
   pgrep -f '^/opt/komari/agent([[:space:]]|$)' >/dev/null; then
  echo "检查未通过:仍有服务或客户端进程残留。"
  exit 1
fi

echo "✅ Komari 客户端已卸载完成,无需重启。"
echo "最后请在 Komari 管理后台删除对应节点。"
EOF