source: trunk/DataCheck/CheckNetworkStatus.sh@ 12662

Last change on this file since 12662 was 11848, checked in by Daniela Dorner, 13 years ago
added (two scripts checking the status of the network card and the time of the machines; crontab files for all 4 machines)
  • Property svn:executable set to *
File size: 751 bytes
Line 
1#!/bin/bash
2
3numnetworks=6
4
5vals=(`/sbin/ifconfig -s | tr -s ' ' | cut -d' ' -f1,5,9 | grep -v RX `)
6
7
8for (( i=0 ; i < $numnetworks ; i++ ))
9do
10 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"`)
12 if [ ${errors[0]} -lt ${vals[$i*3+1]} ]
13 then
14 echo "RX errors increased to "${errors[0]}
15 fi
16 if [ ${errors[1]} -lt ${vals[$i*3+2]} ]
17 then
18 echo "TX errors increased to "${errors[0]}
19 fi
20 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"
22done
23
Note: See TracBrowser for help on using the repository browser.