2 # Copyright (C) 2008-2010 Equinox Software, Inc.
\r
4 # This program is free software; you can redistribute it and/or
\r
5 # modify it under the terms of the GNU General Public License
\r
6 # as published by the Free Software Foundation; either version 2
\r
7 # of the License, or (at your option) any later version.
\r
9 # This program is distributed in the hope that it will be useful,
\r
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 # GNU General Public License for more details.
\r
15 # Author : Michael Tate, Sys Admin, ESI
\r
16 # Purpose : Look for excessive NOT CONNECTEDS in the osrfsys logs in the current hour
\r
17 USAGE="check_notconnected <logpath (default to /var/log/evergreen/prod/, assumes central logging)>"
\r
18 if [[ $1 == *help* ]]; then
\r
19 echo "Usage: $USAGE"
\r
23 ## GET/SET Variables ##
\r
28 if [ -n "$1" ]; then
\r
31 LOGPATH="/var/log/evergreen/prod"
\r
34 NCCOUNT=`grep -c "IS NOT CONNECTED TO THE NETWORK" $LOGPATH/$(date +%Y/%m/%d)/osrfsys.$(date +%H).log`
\r
35 if [ $NCCOUNT -ge $CRITLIMIT ]; then
\r
36 TOPSERVER=$(grep "IS NOT CONNECTED TO THE NETWORK" $LOGFILE | cut -d" " -f3 | sort | uniq -c | sort -nr | head -1)
\r
37 SVRMSG=" (Top server this hour: $TOPSERVER)"
\r
40 elif [ $NCCOUNT -ge $WARNLIMIT ]; then
\r
41 TOPSERVER=$(grep "IS NOT CONNECTED TO THE NETWORK" $LOGFILE | cut -d" " -f3 | sort | uniq -c | sort -nr | head -1)
\r
42 SVRMSG=" (Top server this hour: $TOPSERVER)"
\r
45 elif [[ $NCCOUNT -lt $WARNLIMIT ]; then
\r
50 EXITSTATUS="WARN: An error has occurred $PREVTOT $PERIOD"
\r
54 echo "$EXITSTATUS: $NCCOUNT NOT CONNECTEDs returned this hour$SVRMSG"
\r