add prometheus alerts for deployment/statefulset/daemonset replica mismatches [ci skip]
- Add DeploymentReplicasMismatch alert - Add StatefulSetReplicasMismatch alert - Add DaemonSetMissingPods alert - Add .claude/ directory with remote executor and knowledge base
This commit is contained in:
parent
70952c2448
commit
d751a5924c
3 changed files with 238 additions and 7 deletions
58
.claude/remote-executor.sh
Executable file
58
.claude/remote-executor.sh
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
#!/bin/bash
|
||||
# Remote Command Executor
|
||||
# Run this in a terminal with SSH access to the remote machine
|
||||
#
|
||||
# Usage: ./remote-executor.sh [user@host] [remote_workdir]
|
||||
# Example: ./remote-executor.sh wizard@10.0.10.10 /home/wizard/code/infra
|
||||
|
||||
REMOTE_HOST="${1:-wizard@10.0.10.10}"
|
||||
REMOTE_WORKDIR="${2:-/home/wizard/code/infra}"
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
CMD_FILE="$SCRIPT_DIR/cmd_input.txt"
|
||||
OUTPUT_FILE="$SCRIPT_DIR/cmd_output.txt"
|
||||
STATUS_FILE="$SCRIPT_DIR/cmd_status.txt"
|
||||
|
||||
# Initialize files
|
||||
echo "ready" > "$STATUS_FILE"
|
||||
> "$CMD_FILE"
|
||||
> "$OUTPUT_FILE"
|
||||
|
||||
echo "╔════════════════════════════════════════════════════════════╗"
|
||||
echo "║ Remote Command Executor Started ║"
|
||||
echo "╠════════════════════════════════════════════════════════════╣"
|
||||
echo "║ Remote: $REMOTE_HOST"
|
||||
echo "║ Workdir: $REMOTE_WORKDIR"
|
||||
echo "║ Watching: $CMD_FILE"
|
||||
echo "╚════════════════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
echo "Waiting for commands..."
|
||||
|
||||
# Watch for new commands
|
||||
while true; do
|
||||
# Check if there's a command to execute
|
||||
if [ -s "$CMD_FILE" ]; then
|
||||
CMD=$(cat "$CMD_FILE")
|
||||
|
||||
# Clear the command file immediately
|
||||
> "$CMD_FILE"
|
||||
|
||||
# Update status
|
||||
echo "running" > "$STATUS_FILE"
|
||||
echo "[$(date '+%H:%M:%S')] Executing: $CMD"
|
||||
|
||||
# Execute on remote and capture output
|
||||
ssh "$REMOTE_HOST" "cd $REMOTE_WORKDIR && $CMD" > "$OUTPUT_FILE" 2>&1
|
||||
EXIT_CODE=$?
|
||||
|
||||
# Append exit code to output
|
||||
echo "" >> "$OUTPUT_FILE"
|
||||
echo "---EXIT_CODE:$EXIT_CODE---" >> "$OUTPUT_FILE"
|
||||
|
||||
# Update status
|
||||
echo "done:$EXIT_CODE" > "$STATUS_FILE"
|
||||
echo "[$(date '+%H:%M:%S')] Done (exit: $EXIT_CODE)"
|
||||
fi
|
||||
|
||||
sleep 0.2
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue