summaryrefslogtreecommitdiff
path: root/genesis_agg1.sh
diff options
context:
space:
mode:
authordoc <doc@filenotfound.org>2025-06-30 20:11:52 +0000
committerdoc <doc@filenotfound.org>2025-06-30 20:11:52 +0000
commit41e897f4945aaf8fbcdf0b12ac2f08c5e6ae0458 (patch)
treedb7c3520fd91abc3cf56b1a52095d23f3a80d059 /genesis_agg1.sh
commit of legacy codeHEADmaster
Diffstat (limited to 'genesis_agg1.sh')
-rwxr-xr-xgenesis_agg1.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/genesis_agg1.sh b/genesis_agg1.sh
new file mode 100755
index 0000000..4bb31aa
--- /dev/null
+++ b/genesis_agg1.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+# === Config ===
+declare -A NODES=(
+ [genesis-west]="root@172.232.172.119"
+ [genesis-east]="root@198.74.58.14"
+ [genesis-midwest]="root@45.56.126.90"
+)
+
+TELEGRAM_BOT_TOKEN="7277705363:AAGSw5Pmcbf7IsSyZKMqU6PJ4VsVwdKLRH0"
+TELEGRAM_CHAT_ID="1559582356"
+
+# === Functions ===
+
+send_telegram() {
+ local msg="$1"
+ curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
+ -d chat_id="${TELEGRAM_CHAT_ID}" \
+ -d text="$msg" \
+ -d parse_mode="Markdown"
+}
+
+# === Main ===
+
+alert_text="*GenesisRouteWatch Alert!*\n"
+issue_found=0
+
+for region in "${!NODES[@]}"; do
+ host="${NODES[$region]}"
+ echo "🌐 Probing $region ($host)..."
+ output=$(ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no $host "/root/genesis_routewatch.sh" 2>/dev/null)
+
+ echo "🛰️ $region Output:"
+ echo "$output"
+ echo
+
+ # Save raw report
+ full_report+="🛰️ *$region*:\n\`\`\`\n$output\n\`\`\`\n\n"
+
+ # Detect issues
+ if echo "$output" | grep -q "Status: CRITICAL"; then
+ alert_text+="$region* path degraded!\n"
+ issue_found=1
+ fi
+done
+
+# Send alert only if something's wrong
+if [[ $issue_found -eq 1 ]]; then
+ send_telegram "$alert_text"
+else
+ echo "✅ All paths healthy. No alert sent."
+fi