aboutsummaryrefslogtreecommitdiff
path: root/plugins-scripts/check_log.sh
diff options
context:
space:
mode:
authorGravatar Holger Weiss <holger@zedat.fu-berlin.de> 2014-01-13 22:55:43 +0100
committerGravatar Holger Weiss <holger@zedat.fu-berlin.de> 2014-01-13 22:55:43 +0100
commit9db763963f3993f923619a2147e4313b09f12134 (patch)
tree7de03645f44f5b5ec42bb8894b0c5b3165196e25 /plugins-scripts/check_log.sh
parent20b598da6ee238a608c17524c4483fea1b14a4fa (diff)
downloadmonitoring-plugins-9db763963f3993f923619a2147e4313b09f12134.tar.gz
utils.sh: Don't define $ECHO
In utils.sh, $ECHO was set to printf(1) or echo(1), depending on whether printf(1) is available in /usr/bin. This resulted in various bugs, as printf(1) cannot be used in the same way as echo(1). Thanks to Trevor Hemsley for reporting one of those bugs: If $ECHO was set to printf(1), check_log stumbled when reporting a log line with a "%" character.
Diffstat (limited to 'plugins-scripts/check_log.sh')
-rwxr-xr-xplugins-scripts/check_log.sh11
1 files changed, 5 insertions, 6 deletions
diff --git a/plugins-scripts/check_log.sh b/plugins-scripts/check_log.sh
index a1bfb486..ca5810ab 100755
--- a/plugins-scripts/check_log.sh
+++ b/plugins-scripts/check_log.sh
@@ -60,7 +60,6 @@
# TV: removed PATH restriction. Need to think more about what this means overall
#PATH=""
-ECHO="/bin/echo"
GREP="/bin/egrep"
DIFF="/bin/diff"
TAIL="/bin/tail"
@@ -167,10 +166,10 @@ done
# If the source log file doesn't exist, exit
if [ ! -e $logfile ]; then
- $ECHO "Log check error: Log file $logfile does not exist!\n"
+ echo "Log check error: Log file $logfile does not exist!"
exit $STATE_UNKNOWN
elif [ ! -r $logfile ] ; then
- $ECHO "Log check error: Log file $logfile is not readable!\n"
+ echo "Log check error: Log file $logfile is not readable!"
exit $STATE_UNKNOWN
fi
@@ -180,7 +179,7 @@ fi
if [ ! -e $oldlog ]; then
$CAT $logfile > $oldlog
- $ECHO "Log check data initialized...\n"
+ echo "Log check data initialized..."
exit $STATE_OK
fi
@@ -209,10 +208,10 @@ $RM -f $tempdiff
$CAT $logfile > $oldlog
if [ "$count" = "0" ]; then # no matches, exit with no error
- $ECHO "Log check ok - 0 pattern matches found\n"
+ echo "Log check ok - 0 pattern matches found"
exitstatus=$STATE_OK
else # Print total matche count and the last entry we found
- $ECHO "($count) $lastentry"
+ echo "($count) $lastentry"
exitstatus=$STATE_CRITICAL
fi