#!/bin/bash
#luohongjiang
#qq:123769752
#netchk v 1.3
. InfoData
_ping_no=${1-1}
_ping_size=${1-1}
echo "Net status check..."
for i in $IP
{
ping -c $_ping_no -s $_ping_size $i >ping.log
cat ping.log|grep "time="|tail -n 1
cat ping.log|grep "$_ping_no received"
if (( $? >0 ));then
cat ping.log|grep "received"
echo -e $ys_red "****************$i Have question" $ys_o
else
echo -e $ys_green "****************$i is ok" $ys_o
fi
}
rm ping.log
echo "Net Interface check"
for i in $IP
{
_in_no=$(ssh root@$i cat /proc/net/dev|awk '{print $1}'|grep ":[0-9]"|awk -F '[:]' '{print $1}')
for ck in $_in_no
{
ssh root@$i "ifconfig $ck"|grep "$i" >/dev/null
if (( $? == 0 ));then
ssh root@$i "ethtool $ck"|grep -E "Speed|Duplex"
ok_ck=$ck
fi
}
echo "***********************************$i [$ok_ck]"
}