diff options
author | Wido den Hollander <wido@42on.com> | 2016-02-16 11:37:43 +0100 |
---|---|---|
committer | Wido den Hollander <wido@42on.com> | 2016-03-09 16:48:41 +0100 |
commit | 2025d631cced5d5c971ae36636308e69da4fb0ed (patch) | |
tree | 506c3dfa2bb1b14c30f5623473b278985acae560 /mirroring | |
parent | mirror: Add examle rsync daemon configuration (diff) | |
download | ceph-2025d631cced5d5c971ae36636308e69da4fb0ed.tar.xz ceph-2025d631cced5d5c971ae36636308e69da4fb0ed.zip |
Add script to test connectivity and availability of Ceph mirrors
Signed-off-by: Wido den Hollander <wido@42on.com>
Diffstat (limited to 'mirroring')
-rwxr-xr-x | mirroring/test-mirrors.sh | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/mirroring/test-mirrors.sh b/mirroring/test-mirrors.sh new file mode 100755 index 00000000000..4b6392bf45e --- /dev/null +++ b/mirroring/test-mirrors.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# +# Simple script which performs a HTTP and rsync check on +# all Ceph mirrors over IPv4 and IPv6 to see if they are online +# +# Requires IPv4, IPv6, rsync and curl +# +# Example usage: +# - ./test-mirrors.sh eu.ceph.com,de.ceph.com,hk.ceph.com +# - cat MIRRORS |cut -d ':' -f 1|xargs -n 1 ./test-mirrors.sh +# + +function print_usage { + echo "Usage: $0 mirror1,mirror2,mirror3,mirror4,etc" +} + +function test_http { + HOST=$1 + + echo -n "$HOST HTTP IPv4: " + curl -s -I -4 -o /dev/null http://$HOST + if [ "$?" -ne 0 ]; then + echo "FAIL" + else + echo "OK" + fi + + echo -n "$HOST HTTP IPv6: " + curl -s -I -6 -o /dev/null http://$HOST + if [ "$?" -ne 0 ]; then + echo "FAIL" + else + echo "OK" + fi +} + +function test_rsync { + HOST=$1 + + echo -n "$HOST RSYNC IPv4: " + rsync -4 -avrqn ${HOST}::ceph /tmp 2>/dev/null + if [ "$?" -ne 0 ]; then + echo "FAIL" + else + echo "OK" + fi + + echo -n "$HOST RSYNC IPv6: " + rsync -6 -avrqn ${HOST}::ceph /tmp 2>/dev/null + if [ "$?" -ne 0 ]; then + echo "FAIL" + else + echo "OK" + fi +} + +MIRRORS=$1 + +if [ -z "$MIRRORS" ]; then + print_usage + exit 1 +fi + +IFS=', ' read -r -a array <<< "$MIRRORS" + +for MIRROR in "${array[@]}"; do + test_http $MIRROR + test_rsync $MIRROR +done |