diff options
author | Lorenz <12514511+RincewindsHat@users.noreply.github.com> | 2021-12-20 15:57:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-20 15:57:11 +0100 |
commit | ebf5cd2afef33aa4e6b680a88deb804d104c68f5 (patch) | |
tree | 65b9e32bcca9086c792be43e05d47badf37178b6 /plugins-scripts | |
parent | 78801192cf55ed01f284c93caa3eb0ba6842827c (diff) | |
parent | c1bf69c3a6a52c714e27107219e402bbecd7c000 (diff) | |
download | monitoring-plugins-ebf5cd2afef33aa4e6b680a88deb804d104c68f5.tar.gz |
Merge pull request #1732 from RincewindsHat/check_log_missing_oldlog_abort
Missing oldlog now aborts check_log
Diffstat (limited to 'plugins-scripts')
-rwxr-xr-x | plugins-scripts/check_log.sh | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins-scripts/check_log.sh b/plugins-scripts/check_log.sh index 61131236..fdb57416 100755 --- a/plugins-scripts/check_log.sh +++ b/plugins-scripts/check_log.sh @@ -43,6 +43,10 @@ # check the same <log_file> for pattern matches. This is necessary # because of the way the script operates. # +# 4. This plugin does NOT have an understanding of logrotation or similar +# mechanisms. Therefore bad timing could lead to missing events +# +# # Examples: # # Check for login failures in the syslog... @@ -207,6 +211,11 @@ elif [ ! -r "$logfile" ] ; then echo "Log check error: Log file $logfile is not readable!" exit "$STATE_UNKNOWN" fi +# If no oldlog was given this can not work properly, abort then +if [ -z "$oldlog" ]; then + echo "Oldlog parameter is needed" + exit $STATE_UNKNOWN +fi # If the old log file doesn't exist, this must be the first time # we're running this test, so copy the original log file over to @@ -256,7 +265,7 @@ cat "$logfile" > "$oldlog" if [ "$count" = "0" ]; then # no matches, exit with no error echo "Log check ok - 0 pattern matches found" exitstatus=$STATE_OK -else # Print total matche count and the last entry we found +else # Print total match count and the last entry we found echo "($count) $entry" exitstatus=$STATE_CRITICAL fi |