hw-test/scripts/stat-ping110

61 lines
1.3 KiB
Text
Raw Normal View History

2021-11-03 14:49:36 -05:00
#!/bin/bash
source scan-netdev
source test-variables
MY_DATE=`date +%Y-%m-%d_%H-%M-%S`
if [[ -n $1 ]] ; then
MTU=`echo $1 | sed 's/[^0-9]//g'`
if [[ "$MTU" != "" ]] ; then
MTU_P=" -s $MTU"
LABEL=".$MTU"
fi
fi
date >> $OUTPUT_DIR/ping.error.log
echo "stat-ping: start" >> $OUTPUT_DIR/ping.error.log
2021-11-03 15:55:13 -05:00
SERIAL=1
2021-11-03 14:49:36 -05:00
while [[ 1 ]] ; do
2021-11-03 15:55:13 -05:00
stat-bonding out | grep bond
2021-11-03 14:49:36 -05:00
VLAN=110 ;
if [[ -f /etc/netdev/vlan.$VLAN.csv ]] ; then
VLAN_CONF=`sed 's/#.*$//' /etc/netdev/vlan.$VLAN.csv \
| grep $SERVER_SERIAL `
else
continue
fi
if [[ -z $VLAN_CONF ]] ; then
continue
fi
IP_LIST=`sed 's/#.*$//' /etc/netdev/vlan.$VLAN.csv \
| cut -d ',' -f 3 \
| grep '^[0-9]' | sort`
FAILED=
OK_LST=
for IP in $IP_LIST; do
RCVD=`ping -c100 -W1 $MTU_P -f $IP \
| grep 'received'`
if grep 'errors' <<< $RCVD > /dev/null
then
FAILED="$FAILED $IP"
else
OK_LST="$OK_LST $IP"
fi
done
if [[ -n $FAILED ]] ; then
2021-11-03 15:55:13 -05:00
echo "$SERIAL vLAN $RED$VLAN$OFF failed: $FAILED "
2021-11-03 15:17:03 -05:00
date >> $OUTPUT_DIR/ping.error.log
2021-11-03 15:55:13 -05:00
echo "$SERIAL vLAN $VLAN failed: $FAILED " \
2021-11-03 15:17:03 -05:00
>> $OUTPUT_DIR/ping.error.log
2021-11-03 14:49:36 -05:00
if [[ -n $OK_LST ]] ; then
2021-11-03 15:55:13 -05:00
echo "$SERIAL vLAN $GRN$VLAN$OFF Ok: $OK_LST"
2021-11-03 14:49:36 -05:00
fi
else
2021-11-03 15:55:13 -05:00
echo "$SERIAL vLAN $GRN$VLAN$OFF: Ok all"
2021-11-03 14:49:36 -05:00
fi
2021-11-03 15:55:13 -05:00
#echo
2021-11-03 14:50:42 -05:00
sleep 1
2021-11-03 15:55:13 -05:00
SERIAL=$(( SERIAL + 1 ))
2021-11-03 14:49:36 -05:00
done