summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordoc <doc@filenotfound.org>2025-06-29 07:18:42 +0000
committerdoc <doc@filenotfound.org>2025-06-29 07:18:42 +0000
commitdf4458066cbdb86529b5b81c4c5a386fe9dace7a (patch)
treee4edb4a2d210a5fb50f6f272965f2a7147b23d19
initial commitHEADmaster
-rwxr-xr-xgenesis_routewatch.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/genesis_routewatch.sh b/genesis_routewatch.sh
new file mode 100755
index 0000000..de6dc2a
--- /dev/null
+++ b/genesis_routewatch.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+# genesis_routewatch.sh - Bash-based route probe script
+
+TARGET_HOST="baboon.sshjunkie.com"
+MAX_HOPS=30
+ALERT_THRESHOLD=5
+
+TRACEROUTE_OUTPUT=$(traceroute -n -m $MAX_HOPS "$TARGET_HOST" 2>/dev/null)
+
+# Fallback if traceroute fails
+if [ -z "$TRACEROUTE_OUTPUT" ]; then
+ echo "GenesisRouteWatch: $(hostname)"
+ echo "Target: $TARGET_HOST"
+ echo "Status: CRITICAL - Traceroute failed"
+ exit 1
+fi
+
+# Parse traceroute output
+MISSING_HOPS=0
+TOTAL_HOPS=0
+REPORT="GenesisRouteWatch: $(hostname)\nTarget: $TARGET_HOST\n"
+
+while IFS= read -r line; do
+ if [[ $line =~ ^[0-9]+ ]]; then
+ ((TOTAL_HOPS++))
+ if echo "$line" | grep -q "\* \* \*"; then
+ REPORT+="- MISSING HOP: 0ms\n"
+ ((MISSING_HOPS++))
+ fi
+ fi
+ [[ $TOTAL_HOPS -ge $MAX_HOPS ]] && break
+done <<< "$TRACEROUTE_OUTPUT"
+
+REPORT+="\nPath Length: $TOTAL_HOPS"
+
+if [ $MISSING_HOPS -gt 0 ]; then
+ REPORT+=" | Status: CRITICAL\n"
+ for ((i=0; i<$MISSING_HOPS; i++)); do
+ REPORT+="\xF0\x9F\x9A\xA8 Missing hop in path\n"
+ done
+else
+ REPORT+=" | Status: OK"
+fi
+
+# Print the final result
+echo -e "$REPORT"
+