Changeset 18691


Ignore:
Timestamp:
12/18/16 23:42:16 (8 years ago)
Author:
Daniela Dorner
Message:
adapted to account for additional eths
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataCheck/Monitoring/CheckNetworkStatus.sh

    r17530 r18691  
    22
    33numnetworks=6
     4numnetworks=8
    45
    56vals=(`/sbin/ifconfig -s | tr -s ' ' | cut -d' ' -f1,5,9 | grep -v RX `)
     
    1112if [ ${#vals[@]} -ne $numvals ]
    1213then
    13    echo "ERROR Not all "$numnetworks" networks available."
     14   echo "ERROR Not "$numnetworks" networks available, but "`echo " ${#vals[@]} / 3 - 1 " | bc `"."
    1415   exit
    1516fi
     
    1718for (( i=0 ; i < $numnetworks ; i++ ))
    1819do
    19    query="SELECT fRXErrors, fTXErrors FROM NetworkErrors WHERE fEth="$i" ORDER BY fTime DESC LIMIT 0,1;"
     20   num=`echo ${vals[$i*3]} | grep -o [0-9]`
     21   query="SELECT fRXErrors, fTXErrors FROM NetworkErrors WHERE fEth="$num" ORDER BY fTime DESC LIMIT 0,1;"
    2022   #echo $query
    2123   errors=( `/usr/bin/mysql -u systemstatus --host=fact01 systemstatus -s -e "$query"` )
     
    2325   if [ ${errors[0]} -lt ${vals[$i*3+1]} ]
    2426   then
    25       echo "RX errors increased to "${errors[0]}" on eth"$i
     27      echo "RX errors increased to "${errors[0]}" on eth"$num
    2628   fi
    2729   if [ ${errors[1]} -lt ${vals[$i*3+2]} ]
    2830   then
    29       echo "TX errors increased to "${errors[0]}" on eth"$i
     31      echo "TX errors increased to "${errors[0]}" on eth"$num
    3032   fi
    31    query="INSERT NetworkErrors SET fEth="$i", fRXErrors="${vals[$i*3+1]}", fTXErrors="${vals[$i*3+2]}", fTime=Now()"
     33   query="INSERT NetworkErrors SET fEth="$num", fRXErrors="${vals[$i*3+1]}", fTXErrors="${vals[$i*3+2]}", fTime=Now()"
    3234   /usr/bin/mysql -u systemstatus --host=fact01 systemstatus -e "$query"
    3335done
Note: See TracChangeset for help on using the changeset viewer.