Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
60 lines
1.6 KiB
Bash
Executable File
60 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Network status and latency monitoring
|
|
# Usage: ./network-monitoring.sh
|
|
|
|
set -euo pipefail
|
|
|
|
# Load IP configuration
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
|
|
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
SOURCE_PROJECT="/home/intlc/projects/smom-dbis-138"
|
|
|
|
source "$SOURCE_PROJECT/.env" 2>/dev/null || true
|
|
|
|
RPC_URL="${RPC_URL_138_PUBLIC:-http://${RPC_PUBLIC_1:-192.168.11.221}:8545}"
|
|
|
|
# Measure RPC latency
|
|
measure_latency() {
|
|
local rpc_url="$1"
|
|
local start=$(date +%s%N)
|
|
cast block-number --rpc-url "$rpc_url" >/dev/null 2>&1
|
|
local end=$(date +%s%N)
|
|
local latency=$(( (end - start) / 1000000 )) # Convert to milliseconds
|
|
echo "$latency"
|
|
}
|
|
|
|
# Check network status
|
|
check_network_status() {
|
|
echo "=== Network Status ==="
|
|
echo ""
|
|
|
|
# Block number
|
|
BLOCK_NUMBER=$(cast block-number --rpc-url "$RPC_URL" 2>/dev/null || echo "N/A")
|
|
echo "Current Block: $BLOCK_NUMBER"
|
|
|
|
# Latency
|
|
LATENCY=$(measure_latency "$RPC_URL")
|
|
echo "RPC Latency: ${LATENCY}ms"
|
|
|
|
# Gas price
|
|
GAS_PRICE=$(cast gas-price --rpc-url "$RPC_URL" 2>/dev/null || echo "0")
|
|
GAS_GWEI=$(echo "scale=2; $GAS_PRICE / 1000000000" | bc 2>/dev/null || echo "0")
|
|
echo "Gas Price: $GAS_GWEI gwei"
|
|
|
|
# Network health
|
|
if [ "$LATENCY" -lt 1000 ]; then
|
|
echo "Network Status: ✅ Healthy"
|
|
elif [ "$LATENCY" -lt 5000 ]; then
|
|
echo "Network Status: ⚠️ Degraded"
|
|
else
|
|
echo "Network Status: ❌ Poor"
|
|
fi
|
|
}
|
|
|
|
check_network_status
|
|
|