Changeset 18691
- Timestamp:
- 12/18/16 23:42:16 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/Monitoring/CheckNetworkStatus.sh
r17530 r18691 2 2 3 3 numnetworks=6 4 numnetworks=8 4 5 5 6 vals=(`/sbin/ifconfig -s | tr -s ' ' | cut -d' ' -f1,5,9 | grep -v RX `) … … 11 12 if [ ${#vals[@]} -ne $numvals ] 12 13 then 13 echo "ERROR Not all "$numnetworks" networks available."14 echo "ERROR Not "$numnetworks" networks available, but "`echo " ${#vals[@]} / 3 - 1 " | bc `"." 14 15 exit 15 16 fi … … 17 18 for (( i=0 ; i < $numnetworks ; i++ )) 18 19 do 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;" 20 22 #echo $query 21 23 errors=( `/usr/bin/mysql -u systemstatus --host=fact01 systemstatus -s -e "$query"` ) … … 23 25 if [ ${errors[0]} -lt ${vals[$i*3+1]} ] 24 26 then 25 echo "RX errors increased to "${errors[0]}" on eth"$ i27 echo "RX errors increased to "${errors[0]}" on eth"$num 26 28 fi 27 29 if [ ${errors[1]} -lt ${vals[$i*3+2]} ] 28 30 then 29 echo "TX errors increased to "${errors[0]}" on eth"$ i31 echo "TX errors increased to "${errors[0]}" on eth"$num 30 32 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()" 32 34 /usr/bin/mysql -u systemstatus --host=fact01 systemstatus -e "$query" 33 35 done
Note:
See TracChangeset
for help on using the changeset viewer.