Files
Nexus/scripts/agent_remote_diagnose.sh
T
Nexus Agent fc837bfd43 feat(ops): add batch Agent remote diagnose script
SSH from central creds to inspect systemctl, redacted config, 401/heartbeat logs, and /health on sub-servers.
2026-06-09 09:19:40 +08:00

23 lines
783 B
Bash

#!/usr/bin/env bash
# Batch Agent diagnostics on sub-servers (SSH from central DB creds).
#
# Usage:
# bash scripts/agent_remote_diagnose.sh --id 95
# bash scripts/agent_remote_diagnose.sh --name 颜又文
# bash scripts/agent_remote_diagnose.sh --offline-only --limit 20
# bash scripts/agent_remote_diagnose.sh --offline-only -o /tmp/agent-offline.md
#
# Run on machine with .env (local dev or ssh nexus + cd /opt/nexus).
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
SECRETS="${ROOT}/deploy/nexus-1panel.secrets.sh"
if [[ -f "$SECRETS" ]]; then
# shellcheck disable=SC1090
source "$SECRETS"
fi
PYTHON="${ROOT}/.venv/bin/python"
if [[ ! -x "$PYTHON" ]]; then
PYTHON=python3
fi
exec "$PYTHON" "${ROOT}/scripts/agent_remote_diagnose.py" "$@"