-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify-hostlogs.sh
More file actions
executable file
·57 lines (49 loc) · 2.06 KB
/
verify-hostlogs.sh
File metadata and controls
executable file
·57 lines (49 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# ─────────────────────────────────────────────
# verify-hostlogs.sh · ContainerYard host-logs verifier
# Author: 0xWulf
# Email: 0xwulf@proton.me
# Desc.: Verify ContainerYard host-logs API + UI regressions
# Create Date: 2025-10-26 05:46:11
# Modified Date: 2025-10-26 05:46:11
# ─────────────────────────────────────────────
set -euo pipefail
# ── Config ───────────────────────────────────
BASE="https://container.piapps.dev"
CK="/tmp/pideck.cookies"
TAIL_DEFAULT=50
# Prefer to pass password via env: ADMIN_PASSWORD
PASS="${ADMIN_PASSWORD:-}"
if [[ -z "$PASS" ]]; then
echo "[ERROR] Set ADMIN_PASSWORD env var before running." >&2
exit 1
fi
# ── Helpers ──────────────────────────────────
_info() { printf "[%s] %s\n" "$(date -u +'%FT%TZ')" "$*"; }
_sep() { printf -- "---------------------------------------------\n"; }
_login() {
_info "Login to $BASE"
/usr/bin/rm -f "$CK"
/usr/bin/curl -sS -c "$CK" -H 'Content-Type: application/json' -H "Origin: $BASE" -X POST "$BASE/api/auth/login" --data "{\"password\":\"$PASS\"}" | /usr/bin/jq . >/dev/null
_info "Auth me:"
/usr/bin/curl -sS -b "$CK" "$BASE/api/auth/me" | /usr/bin/jq .
}
_hit() {
local name="$1"; shift
local qs="$*"
_sep
_info "GET /api/hostlogs/${name}?${qs}"
/usr/bin/curl -sS -b "$CK" "$BASE/api/hostlogs/${name}?${qs}" | /usr/bin/head -n 30
}
main() {
_login
_hit "nginx_error" "tail=${TAIL_DEFAULT}&grep=error"
_hit "nginx_access" "tail=${TAIL_DEFAULT}"
_hit "pm2_out" "tail=${TAIL_DEFAULT}"
_hit "pm2_err" "tail=${TAIL_DEFAULT}"
_hit "grafana" "tail=${TAIL_DEFAULT}"
_hit "prometheus" "since=3600×tamps=1&tail=${TAIL_DEFAULT}"
_sep
_info "Done. If grafana/prometheus files are missing, ensure docker fallbacks are wired."
}
main "$@"