stat-ping
This commit is contained in:
parent
b042eaf006
commit
1047593c79
1 changed files with 50 additions and 0 deletions
50
scripts/stat-ping
Executable file
50
scripts/stat-ping
Executable file
|
@ -0,0 +1,50 @@
|
|||
#!/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
|
||||
|
||||
while [[ 1 ]] ; do
|
||||
for VLAN in {10..4000} ; do
|
||||
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
|
||||
echo "vLAN $RED$VLAN$OFF failed: $FAILED "
|
||||
if [[ -n $OK_LST ]] ; then
|
||||
echo "vLAN $GRN$VLAN$OFF Ok: $OK_LST"
|
||||
fi
|
||||
else
|
||||
echo "vLAN $GRN$VLAN$OFF: Ok all"
|
||||
fi
|
||||
done
|
||||
done
|
Loading…
Reference in a new issue