Created
October 27, 2022 01:44
-
-
Save YukariChiba/ff9707e1a7eca0f9ff4c0b358714b497 to your computer and use it in GitHub Desktop.
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 | |
| NODES=( | |
| "APR1.HK" | |
| "LON1.UK" | |
| "LAX1.US" | |
| "LAS1.US" | |
| "VUL1.SG" | |
| "NYC1.US" | |
| "TYO1.JP" | |
| "LL1.NL" | |
| "FRA1.DE" | |
| "SOL1.KR" | |
| "FMT2.US" | |
| ) | |
| declare -A res | |
| for node in ${NODES[@]}; do | |
| echo "Testing $node" | |
| nodeping=`ping -c 4 $node.dn42.strexp.net | tail -1 | awk -F '/' '{print $5}' 2>/dev/null` | |
| if [ -z "$nodeping" ]; then | |
| echo "$node unreachable" | |
| else | |
| echo "$node $nodeping" | |
| res[`echo $node | sed "s:\.:_:"`]=$nodeping | |
| fi | |
| done | |
| printf "\n\nResult:\n" | |
| printf "Node\t\tLatency\n" | |
| for k in "${!res[@]}" | |
| do | |
| printf "%s\t\t%s\n" $k ${res["$k"]}ms | |
| done | sort -rn -k2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment