Module: check_mk
Branch: master
Commit: 5d36c3f27303c916ebbbfb682e5dae25449d91c0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5d36c3f27303c9…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Feb 16 08:53:22 2016 +0100
#3211 FIX logwatch: Fixed broken error messages in case of failed filesystem operations
---
.werks/3211 | 10 ++++++++++
ChangeLog | 1 +
checks/logwatch | 11 ++++++++---
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/.werks/3211 b/.werks/3211
new file mode 100644
index 0000000..ebfb973
--- /dev/null
+++ b/.werks/3211
@@ -0,0 +1,10 @@
+Title: logwatch: Fixed broken error messages in case of failed filesystem operations
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1455609175
+
+
diff --git a/ChangeLog b/ChangeLog
index 6111cd3..af1b2cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@
* 3206 FIX: esx_vsphere_hostsystem.mem_usage_cluster: Fixed broken check
* 3209 FIX: esx_vsphere_datastores: Added missing uncommitted and overprovisioned
graphs
* 3210 FIX: oracle_asm_diskgroup: Fixed exception when using required mirror free
space parameter
+ * 3211 FIX: logwatch: Fixed broken error messages in case of failed filesystem
operations
Multisite:
* 3059 FIX: Fixed highlighting of availability timeline time slices
diff --git a/checks/logwatch b/checks/logwatch
index f33881e..3967175 100644
--- a/checks/logwatch
+++ b/checks/logwatch
@@ -348,6 +348,11 @@ def truncate_by_line(filename, offset):
f.close()
+def logwatch_username():
+ import getpass
+ return getpass.getuser()
+
+
def check_logwatch_generic(item, params, loglines, found, groups=False):
# Create directories, if neccessary
try:
@@ -368,13 +373,13 @@ def check_logwatch_generic(item, params, loglines, found,
groups=False):
os.rmdir(logdir)
raise MKGeneralException(("User %s cannot chown directory to
group id %d: %s. Please make sure "+
"that %s is a member of that
group.") %
- (username(), www_group, e, username()))
+ (logwatch_username(), www_group, e,
logwatch_username()))
except MKGeneralException:
raise
except Exception, e:
raise MKGeneralException("User %s cannot create logwatch directory: %s"
% \
- (username(), e) )
+ (logwatch_username(), e))
logfile = logdir + "/" + item.replace("/", "\\")
@@ -461,7 +466,7 @@ def check_logwatch_generic(item, params, loglines, found,
groups=False):
else:
logwatch_file = open(logfile, 'w')
except Exception, e:
- raise MKGeneralException("User %s cannot open file for writing: %s" %
(username(), e))
+ raise MKGeneralException("User %s cannot open file for writing: %s" %
(logwatch_username(), e))
pattern_hash = hash(tuple(patterns))