Last change
on this file since 19860 was 18691, checked in by Daniela Dorner, 8 years ago |
adapted to account for additional eths
|
-
Property svn:executable
set to
*
|
File size:
1.1 KB
|
Line | |
---|
1 | #!/bin/bash
|
---|
2 |
|
---|
3 | numnetworks=6
|
---|
4 | numnetworks=8
|
---|
5 |
|
---|
6 | vals=(`/sbin/ifconfig -s | tr -s ' ' | cut -d' ' -f1,5,9 | grep -v RX `)
|
---|
7 | #echo ${vals[@]}
|
---|
8 | #echo ${#vals[@]}
|
---|
9 |
|
---|
10 | numvals=`echo " $numnetworks * 3 + 3" | bc -l`
|
---|
11 | #echo $numvals
|
---|
12 | if [ ${#vals[@]} -ne $numvals ]
|
---|
13 | then
|
---|
14 | echo "ERROR Not "$numnetworks" networks available, but "`echo " ${#vals[@]} / 3 - 1 " | bc `"."
|
---|
15 | exit
|
---|
16 | fi
|
---|
17 |
|
---|
18 | for (( i=0 ; i < $numnetworks ; i++ ))
|
---|
19 | do
|
---|
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;"
|
---|
22 | #echo $query
|
---|
23 | errors=( `/usr/bin/mysql -u systemstatus --host=fact01 systemstatus -s -e "$query"` )
|
---|
24 | #echo ${errors[@]}
|
---|
25 | if [ ${errors[0]} -lt ${vals[$i*3+1]} ]
|
---|
26 | then
|
---|
27 | echo "RX errors increased to "${errors[0]}" on eth"$num
|
---|
28 | fi
|
---|
29 | if [ ${errors[1]} -lt ${vals[$i*3+2]} ]
|
---|
30 | then
|
---|
31 | echo "TX errors increased to "${errors[0]}" on eth"$num
|
---|
32 | fi
|
---|
33 | query="INSERT NetworkErrors SET fEth="$num", fRXErrors="${vals[$i*3+1]}", fTXErrors="${vals[$i*3+2]}", fTime=Now()"
|
---|
34 | /usr/bin/mysql -u systemstatus --host=fact01 systemstatus -e "$query"
|
---|
35 | done
|
---|
36 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.