Update Pings Vlans

This commit is contained in:
Jonatan Mur 2021-09-18 17:56:47 -05:00
parent af587d288c
commit 131af145be

View file

@ -1,34 +1,32 @@
#!/bin/bash #!/bin/bash
source scan-netdev source scan-netdev
VLANS='110 218 222 226 306 321 480'
MY_DATE=`date +%Y-%m-%d_%H-%M-%S` MY_DATE=`date +%Y-%m-%d_%H-%M-%S`
stat-bonding out > $OUTPUT_DIR/bonding.out stat-bonding out > $OUTPUT_DIR/bonding.out
echo -n "START: " > $OUTPUT_DIR/ping.out echo -n "START: " > $OUTPUT_DIR/ping.out
date >> $OUTPUT_DIR/ping.out date >> $OUTPUT_DIR/ping.out
for VLAN in {401..408} ; do for VLAN in $VLANS ; do
if [[ -f /etc/netdev/vlan.$VLAN.csv ]] ; then if [[ -f /etc/netdev/vlan.$VLAN.csv ]] ; then
VLAN_CONF=`cat /etc/netdev/vlan.$VLAN.csv \ VLAN_CONF=`sed 's/#.*$//' /etc/netdev/vlan.$VLAN.csv \
| sed 's/#.*$//' \ | grep $SERVER_SERIAL `
| grep $SERVER_SERIAL ` fi
fi if [[ -z $VLAN_CONF ]] ; then
if [[ -z $VLAN_CONF ]] ; then continue
continue fi
fi IP_LIST=`sed 's/#.*$//' /etc/netdev/vlan.$VLAN.csv \
IP_LIST=`cat /etc/netdev/vlan.$VLAN.csv \ | cut -d ',' -f 3 \
| sed 's/#.*$//' \ | grep '^[0-9]' | sort`
| cut -d ',' -f 3 \ for IP in $IP_LIST; do
| grep '^[0-9]' | sort` echo -n "$IP - " \
for IP in $IP_LIST; do | tee -a $OUTPUT_DIR/ping.out
echo -n "$IP - " \ ping -c100 -W1 -f $IP \
| tee -a $OUTPUT_DIR/ping.out | grep 'received' \
ping -c100 -W1 -f $IP \ | tee -a $OUTPUT_DIR/ping.out
| grep 'received' \ done
| tee -a $OUTPUT_DIR/ping.out
done
done done
echo -n "END: " >> $OUTPUT_DIR/ping.out echo -n "END: " >> $OUTPUT_DIR/ping.out
date >> $OUTPUT_DIR/ping.out date >> $OUTPUT_DIR/ping.out
cp -vf $OUTPUT_DIR/ping.out $OUTPUT_DIR/ping-$MY_DATE.out cp -vf $OUTPUT_DIR/ping.out $OUTPUT_DIR/ping-$MY_DATE.out
cp -vf $OUTPUT_DIR/bonding.out $OUTPUT_DIR/bonding-$MY_DATE.out cp -vf $OUTPUT_DIR/bonding.out $OUTPUT_DIR/bonding-$MY_DATE.out