[Nagiosplug-checkins] CVS: nagiosplug/plugins-scripts check_log.sh,1.1.1.1,1.2
Karl DeBisschop
kdebisschop at users.sourceforge.net
Fri Sep 13 19:14:03 CEST 2002
Update of /cvsroot/nagiosplug/nagiosplug/plugins-scripts
In directory usw-pr-cvs1:/tmp/cvs-serv18053/plugins-scripts
Modified Files:
check_log.sh
Log Message:
patch from Matthew Peters <mattp at esec.com.au>, plus turned up a few bugs on my own
Index: check_log.sh
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins-scripts/check_log.sh,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** check_log.sh 28 Feb 2002 06:43:00 -0000 1.1.1.1
--- check_log.sh 14 Sep 2002 02:13:48 -0000 1.2
***************
*** 75,91 ****
print_usage() {
! echo "Usage: $PROGNAME -F logfile -O oldlog -q query"
! echo "Usage: $PROGNAME --help"
! echo "Usage: $PROGNAME --version"
}
print_help() {
! print_revision $PROGNAME $REVISION
! echo ""
! print_usage
! echo ""
! echo "Log file pattern detector plugin for Nagios"
! echo ""
! support
}
--- 75,91 ----
print_usage() {
! echo "Usage: $PROGNAME -F logfile -O oldlog -q query"
! echo "Usage: $PROGNAME --help"
! echo "Usage: $PROGNAME --version"
}
print_help() {
! print_revision $PROGNAME $REVISION
! echo ""
! print_usage
! echo ""
! echo "Log file pattern detector plugin for Nagios"
! echo ""
! support
}
***************
*** 94,99 ****
if [ $# -lt 1 ]; then
! print_usage
! exit $STATE_UNKNOWN
fi
--- 94,99 ----
if [ $# -lt 1 ]; then
! print_usage
! exit $STATE_UNKNOWN
fi
***************
*** 105,164 ****
exitstatus=$STATE_WARNING #default
while test -n "$1"; do
! case "$1" in
! --help)
! print_help
! exit $STATE_OK
! ;;
! -h)
! print_help
! exit $STATE_OK
! ;;
! --version)
! print_revision $PROGNAME $VERSION
! exit $STATE_OK
! ;;
! -V)
! print_revision $PROGNAME $VERSION
! exit $STATE_OK
! ;;
! --filename)
! logfile=$2
! shift
! ;;
! -F)
! logfile=$2
! shift
! ;;
! --oldlog)
! oldlog=$2
! shift
! ;;
! -O)
! oldlog=$2
! shift
! ;;
! --query)
! query=$2
! shift
! ;;
! -q)
! query=$2
! shift
! ;;
! -x)
! exitstatus=$2
! shift
! ;;
! --exitstatus)
! exitstatus=$2
! shift
! ;;
! *)
! echo "Unknown argument: $1"
! print_usage
! exit $STATE_UNKNOWN
! ;;
! esac
! shift
done
--- 105,164 ----
exitstatus=$STATE_WARNING #default
while test -n "$1"; do
! case "$1" in
! --help)
! print_help
! exit $STATE_OK
! ;;
! -h)
! print_help
! exit $STATE_OK
! ;;
! --version)
! print_revision $PROGNAME $VERSION
! exit $STATE_OK
! ;;
! -V)
! print_revision $PROGNAME $VERSION
! exit $STATE_OK
! ;;
! --filename)
! logfile=$2
! shift
! ;;
! -F)
! logfile=$2
! shift
! ;;
! --oldlog)
! oldlog=$2
! shift
! ;;
! -O)
! oldlog=$2
! shift
! ;;
! --query)
! query=$2
! shift
! ;;
! -q)
! query=$2
! shift
! ;;
! -x)
! exitstatus=$2
! shift
! ;;
! --exitstatus)
! exitstatus=$2
! shift
! ;;
! *)
! echo "Unknown argument: $1"
! print_usage
! exit $STATE_UNKNOWN
! ;;
! esac
! shift
done
***************
*** 166,171 ****
if [ ! -e $logfile ]; then
! $ECHO "Log check error: Log file $logfile does not exist!\n"
! exit 2
fi
--- 166,171 ----
if [ ! -e $logfile ]; then
! $ECHO "Log check error: Log file $logfile does not exist!\n"
! exit $STATE_UNKNOWN
fi
***************
*** 175,181 ****
if [ ! -e $oldlog ]; then
! $CAT $logfile > $oldlog
! $ECHO "Log check data initialized...\n"
! exit 0
fi
--- 175,181 ----
if [ ! -e $oldlog ]; then
! $CAT $logfile > $oldlog
! $ECHO "Log check data initialized...\n"
! exit $STATE_OK
fi
***************
*** 184,193 ****
# The temporary file that the script should use while
# processing the log file.
! if [-x /bin/mktemp]; then
! tempdiff="/bin/mktemp /tmp/check_log.XXXXXXXXXX"
else
! tempdiff="/tmp/check_log.`/bin/date '+%H%M%S'`"
! /bin/touch $tempdiff
! chmod 600 $tempdiff
fi
--- 184,194 ----
# The temporary file that the script should use while
# processing the log file.
! if [ -x /bin/mktemp ]; then
! tempdiff=`/bin/mktemp /tmp/check_log.XXXXXXXXXX`
else
! tempdiff=`/bin/date '+%H%M%S'`
! tempdiff="/tmp/check_log.${tempdiff}"
! /bin/touch $tempdiff
! chmod 600 $tempdiff
fi
***************
*** 204,214 ****
if [ "$count" = "0" ]; then # no matches, exit with no error
! $ECHO "Log check ok - 0 pattern matches found\n"
! exitstatus=0
else # Print total matche count and the last entry we found
! $ECHO "($count) $lastentry"
fi
! exit exitstatus
!
!
--- 205,214 ----
if [ "$count" = "0" ]; then # no matches, exit with no error
! $ECHO "Log check ok - 0 pattern matches found\n"
! exitstatus=$STATE_OK
else # Print total matche count and the last entry we found
! $ECHO "($count) $lastentry"
! exitstatus=$STATE_CRITICAL
fi
! exit $exitstatus
More information about the Commits
mailing list