- Timestamp:
- 01/21/14 01:35:59 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/Monitoring/CheckNetworkStatus.sh
r13043 r17530 4 4 5 5 vals=(`/sbin/ifconfig -s | tr -s ' ' | cut -d' ' -f1,5,9 | grep -v RX `) 6 #echo ${vals[@]} 7 #echo ${#vals[@]} 6 8 9 numvals=`echo " $numnetworks * 3 + 3" | bc -l` 10 #echo $numvals 11 if [ ${#vals[@]} -ne $numvals ] 12 then 13 echo "ERROR Not all "$numnetworks" networks available." 14 exit 15 fi 7 16 8 17 for (( i=0 ; i < $numnetworks ; i++ )) 9 18 do 10 19 query="SELECT fRXErrors, fTXErrors FROM NetworkErrors WHERE fEth="$i" ORDER BY fTime DESC LIMIT 0,1;" 11 errors=( `/usr/bin/mysql -u systemstatus --host=fact01 SystemStatus -s -e "$query"`) 20 #echo $query 21 errors=( `/usr/bin/mysql -u systemstatus --host=fact01 systemstatus -s -e "$query"` ) 22 #echo ${errors[@]} 12 23 if [ ${errors[0]} -lt ${vals[$i*3+1]} ] 13 24 then 14 echo "RX errors increased to "${errors[0]} 25 echo "RX errors increased to "${errors[0]}" on eth"$i 15 26 fi 16 27 if [ ${errors[1]} -lt ${vals[$i*3+2]} ] 17 28 then 18 echo "TX errors increased to "${errors[0]} 29 echo "TX errors increased to "${errors[0]}" on eth"$i 19 30 fi 20 31 query="INSERT NetworkErrors SET fEth="$i", fRXErrors="${vals[$i*3+1]}", fTXErrors="${vals[$i*3+2]}", fTime=Now()" 21 /usr/bin/mysql -u systemstatus --host=fact01 SystemStatus -e "$query"32 /usr/bin/mysql -u systemstatus --host=fact01 systemstatus -e "$query" 22 33 done 23 34
Note:
See TracChangeset
for help on using the changeset viewer.