Created
May 10, 2026 22:04
-
-
Save koliadych/635997a07dc793375ec8fed9940a3e31 to your computer and use it in GitHub Desktop.
fintechner ws diag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -euo pipefail | |
| export AWS_PAGER="" | |
| REGION=ap-northeast-1 | |
| INSTANCE_ID=i-089ad4a6b76132ba2 | |
| CMD_ID=$(aws --region "$REGION" ssm send-command \ | |
| --instance-ids "$INSTANCE_ID" \ | |
| --document-name AWS-RunShellScript \ | |
| --parameters '{"commands":[ | |
| "echo === connector last 25 log lines ===", | |
| "sudo journalctl -u fintechner-connector -n 25 --no-pager", | |
| "echo", | |
| "echo === recent WS upgrades through caddy ===", | |
| "sudo tail -1000 /var/log/caddy/access.log 2>/dev/null | grep -E \"\\\"uri\\\":\\\"/ws\" | tail -3 || echo no-ws-events-in-log", | |
| "echo", | |
| "echo === active WS client count ===", | |
| "sudo journalctl -u fintechner-connector --since \"5 min ago\" --no-pager | grep -c \"dashboard client connected\" || true", | |
| "echo connections-disconnected:", | |
| "sudo journalctl -u fintechner-connector --since \"5 min ago\" --no-pager | grep -c \"dashboard client disconnected\" || true", | |
| "echo", | |
| "echo === hub broadcast cadence (last 5 positions broadcasts) ===", | |
| "sudo journalctl -u fintechner-connector --since \"2 min ago\" --no-pager | grep -E \"broadcast|positions\" | tail -5 || true" | |
| ]}' \ | |
| --query Command.CommandId --output text) | |
| for i in $(seq 1 20); do | |
| sleep 3 | |
| STATUS=$(aws --region "$REGION" ssm get-command-invocation --command-id "$CMD_ID" --instance-id "$INSTANCE_ID" --query Status --output text 2>/dev/null || echo Pending) | |
| case "$STATUS" in Success|Failed|Cancelled|TimedOut) echo " $STATUS"; break ;; *) echo " $STATUS";; esac | |
| done | |
| echo | |
| aws --region "$REGION" ssm get-command-invocation --command-id "$CMD_ID" --instance-id "$INSTANCE_ID" --query StandardOutputContent --output text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment