Module: check_mk
Branch: master
Commit: cfccb0ecf035425fedd039f80692886858a54bef
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cfccb0ecf03542…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Wed Sep 26 15:32:13 2012 +0200
Added new setting to logwatch to change service output
---
checkman/logwatch | 4 ++++
checks/logwatch | 9 ++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/checkman/logwatch b/checkman/logwatch
index 066da97..da4d90c 100644
--- a/checkman/logwatch
+++ b/checkman/logwatch
@@ -86,3 +86,7 @@ logwatch_dir (string): Directory where log messages are
For each host a subdirectory is created. The name of the
files therein are the names of the logfiles with slashes
replaced by backslashes.
+
+logwatch_service_output (string): Change the output of the service to ony
+ print stats and not the last error message. Default is {default}, use {small} if
+ you only want to have the stats.
diff --git a/checks/logwatch b/checks/logwatch
index c98b65d..cf798b2 100644
--- a/checks/logwatch
+++ b/checks/logwatch
@@ -30,9 +30,10 @@ logwatch_dir = var_dir + '/logwatch'
logwatch_patterns = { }
logwatch_rules = []
logwatch_max_filesize = 500000 # do not save more than 500k of message (configurable)
+logwatch_service_output = "default"
# Variables embedded in precompiled checks
-check_config_variables += [ "logwatch_dir", "logwatch_max_filesize"
]
+check_config_variables += [ "logwatch_dir", "logwatch_max_filesize",
"logwatch_service_output" ]
def inventory_logwatch(info):
inventory = []
@@ -348,9 +349,11 @@ def check_logwatch(item, params, info):
count_txt = []
for level, num in state_counts.iteritems():
count_txt.append('%d %s' % (num, logwatch_level_name(level)))
-
- return (worst, state + " - %s messages (Last worst: \"%s\")"
%
+ if logwatch_service_output == 'default':
+ return (worst, state + " - %s messages (Last worst:
\"%s\")" %
(', '.join(count_txt),
last_worst_line))
+ else:
+ return (worst, state + " - %s messages" % ',
'.join(count_txt))
check_info['logwatch'] = {