mirror of https://github.com/EdgeVPNio/tools.git
Overlay-wide ping test
parent
450a817b58
commit
af4299f677
|
@ -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
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue