From af4299f6777bd2296ab882c9e718fd03a9bb30e7 Mon Sep 17 00:00:00 2001 From: Ken Date: Wed, 4 Aug 2021 17:48:17 -0400 Subject: [PATCH] Overlay-wide ping test --- scripts/overlay-test.sh | 48 +++++++++++++++++++++++++++++++++++++++++ scripts/ping-hosts | 5 +++++ 2 files changed, 53 insertions(+) create mode 100755 scripts/overlay-test.sh create mode 100644 scripts/ping-hosts diff --git a/scripts/overlay-test.sh b/scripts/overlay-test.sh new file mode 100755 index 0000000..a45d8d3 --- /dev/null +++ b/scripts/overlay-test.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +pingresult=/var/log/evio/ping-result.log +pingstat=/var/log/evio/ping-stat.log +pingfails=/var/log/evio/ping-failures.log +timestamp=$(date +"%D %T %Z %z") + +function icmp_test +{ + ping -c1 $2 > /dev/null + #iperf -c $1 -e -yC -n3G | tee -a /var/log/evio/$1-iperf-results.log + echo -e "\n############## $HOSTNAME-->>$1 - $timestamp ##############\n" 2>&1 | tee -a $pingresult + ping -c25 -n $2 | xargs -n1 -i bash -c 'echo `date +"%Y-%m-%d %H:%M:%S"`" {}"' 2>&1 | tee -a $pingresult + echo -e "\n############## $HOSTNAME-->>$1 - $timestamp ##############\n" 2>&1 | tee -a $pingstat + tail -n 2 $pingresult 2>&1 | tee -a $pingstat +} + +function ping_hosts +{ + while read ips + do + icmp_test $ips + if [ "$?" -ne "0" ]; then + echo "$(date +"%D %T %Z %z"): ICMP Failure to host $ips" | tee -a $pingfails + fi + done < $1 +} + +function run_all_tests +{ + ping_hosts $1 +} + +case $1 in + run_all) + run_all_tests $2 + ;; + ph) + ping_hosts $2 + ;; + icmp) + icmp_test $2 $3 + ;; + *) + echo "no match on input -> $1" + ;; +esac + diff --git a/scripts/ping-hosts b/scripts/ping-hosts new file mode 100644 index 0000000..667821c --- /dev/null +++ b/scripts/ping-hosts @@ -0,0 +1,5 @@ +nd-40 10.1.1.40 +nd-41 10.1.1.41 +nd-42 10.1.1.42 +nd-60 10.1.1.43 +nd-60 10.1.1.44