Quick test of a pool of webservers

Hm, this website is down... But wait, it has a bunch of servers!

Yesterday mutt hanged when opening PGP-signed emails because the default keyserver was partially down. Partially? GPG was taking always the same [down] server although there is a pool of a dozen of servers for the given address.

I used the following oneliner to test if the webserver of each address of the domain (which using DNS Round-Robin) is up or not:


( route -6 | grep "^::/0" | awk '{print $NF}' | grep -v 'lo' ) 2>&1 >/dev/null  && HOSTOPTS="" || HOSTOPTS="-t A" ; for i in $( (host $HOSTOPTS $1 || (echo "$1 not found" 1>&2 && exit 1)) | grep -E "has (IPv6 )?address" | awk -F' ' '{print $NF}') ; do CURLOPTS=(); echo "$i" | grep ":" 2>&1 >/dev/null && CURLOPTS+=( -g "http://[$i]" ) || CURLOPTS+=( http://$i ) ; curl -H"Host: $1" -s -m3 ${CURLOPTS[@]} 2>&1 >/dev/null && echo $i is up || echo $i is down ; done

Note: this script will automatically skip IPv6 addresses if no external route is found for it


$ isup keys.gnupg.net is up is up is up is up is up is down is up is up is up is up
2001:610:1:40cc::9164:b9e5 is up
2001:4978:234::b is up
2001:41d0:1:c2e2:4e72:b9ff:fe4f:422 is up
2607:5300:60:2885::1 is down
2001:470:1f0a:5d7::2 is up
2001:1418:1d7:1::1 is up
2001:470:7:6ad::2 is up
2001:6f8:1c3c:babe::62:1 is up
2001:470:b2a7:1:225:90ff:fe93:e9fc is up
2600:3c02::2:7004 is up