feat: add Pi monitoring stack with deployment scripts and architecture documentation

This commit is contained in:
S
2026-03-02 21:12:24 -05:00
parent ca4f4924b6
commit 780748083f
16 changed files with 1106 additions and 0 deletions

53
setup/pi-monitoring/status.sh Executable file
View File

@@ -0,0 +1,53 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# shellcheck source=./lib.sh
source "$SCRIPT_DIR/lib.sh"
ENV_FILE="$SCRIPT_DIR/stack.env"
usage() {
cat <<USAGE
Usage: $(basename "$0") [--env-file=PATH]
Show compose service status and local endpoint checks.
USAGE
}
for arg in "$@"; do
case "$arg" in
--env-file=*) ENV_FILE="${arg#*=}" ;;
--help|-h) usage; exit 0 ;;
*) log_error "Unknown argument: $arg"; usage; exit 1 ;;
esac
done
require_cmd docker curl
load_stack_env "$ENV_FILE"
compose_file_path="$(compose_file)"
log_info "Compose services"
docker compose \
--project-name "$COMPOSE_PROJECT_NAME" \
--env-file "$ENV_FILE" \
-f "$compose_file_path" \
ps
check_http() {
local name="$1"
local url="$2"
local code
code="$(curl -k -sS -o /dev/null -w '%{http_code}' "$url" || true)"
if [[ "$code" =~ ^[234] ]]; then
log_success "$name reachable ($code): $url"
else
log_warn "$name not reachable ($code): $url"
fi
}
pi_ip="$(hostname -I | awk '{print $1}')"
check_http "Portainer" "https://${pi_ip}:${PORTAINER_HTTPS_PORT}"
check_http "Grafana" "http://${pi_ip}:${GRAFANA_PORT}/login"
check_http "Prometheus" "http://${pi_ip}:${PROMETHEUS_PORT}/-/ready"
check_http "Uptime Kuma" "http://${pi_ip}:${UPTIME_KUMA_PORT}"