Last change
on this file since 18528 was 17530, checked in by Daniela Dorner, 11 years ago |
improved logging output to be sent via email
|
-
Property svn:executable
set to
*
|
File size:
1016 bytes
|
Line | |
---|
1 | #!/bin/bash
|
---|
2 |
|
---|
3 | numnetworks=6
|
---|
4 |
|
---|
5 | vals=(`/sbin/ifconfig -s | tr -s ' ' | cut -d' ' -f1,5,9 | grep -v RX `)
|
---|
6 | #echo ${vals[@]}
|
---|
7 | #echo ${#vals[@]}
|
---|
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
|
---|
16 |
|
---|
17 | for (( i=0 ; i < $numnetworks ; i++ ))
|
---|
18 | do
|
---|
19 | query="SELECT fRXErrors, fTXErrors FROM NetworkErrors WHERE fEth="$i" ORDER BY fTime DESC LIMIT 0,1;"
|
---|
20 | #echo $query
|
---|
21 | errors=( `/usr/bin/mysql -u systemstatus --host=fact01 systemstatus -s -e "$query"` )
|
---|
22 | #echo ${errors[@]}
|
---|
23 | if [ ${errors[0]} -lt ${vals[$i*3+1]} ]
|
---|
24 | then
|
---|
25 | echo "RX errors increased to "${errors[0]}" on eth"$i
|
---|
26 | fi
|
---|
27 | if [ ${errors[1]} -lt ${vals[$i*3+2]} ]
|
---|
28 | then
|
---|
29 | echo "TX errors increased to "${errors[0]}" on eth"$i
|
---|
30 | fi
|
---|
31 | query="INSERT NetworkErrors SET fEth="$i", fRXErrors="${vals[$i*3+1]}", fTXErrors="${vals[$i*3+2]}", fTime=Now()"
|
---|
32 | /usr/bin/mysql -u systemstatus --host=fact01 systemstatus -e "$query"
|
---|
33 | done
|
---|
34 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.