Module: check_mk
Branch: master
Commit: d800516244f5b3384fcfe2c8e648271622f1f56e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d800516244f5b3…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Apr 4 15:57:12 2016 +0200
3022 FIX mk_logwatch (linux): now able to handle queries from multiple servers (no longer
loosing data)
In earlier versions mk_logwatch only had one statefile for all incoming queries.
Any newly found loglines were sent to one server - subsequent queries from other servers
got nothing.
With this version each IP address now has its own statefile.
So you can now monitor the same system from multiple servers without the risk of loosing
log
messages. Important: Multiple OMD sites running under the same server IP address still
steal
log messages from one another.
---
.werks/3022 | 15 +++++++++++++++
ChangeLog | 1 +
agents/plugins/mk_logwatch | 13 ++++++++++++-
3 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/.werks/3022 b/.werks/3022
new file mode 100644
index 0000000..f2b1b6d
--- /dev/null
+++ b/.werks/3022
@@ -0,0 +1,15 @@
+Title: mk_logwatch (linux): now able to handle queries from multiple servers (no longer
loosing data)
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.9i1
+Date: 1459777575
+Class: fix
+
+In earlier versions mk_logwatch only had one statefile for all incoming queries.
+Any newly found loglines were sent to one server - subsequent queries from other servers
got nothing.
+With this version each IP address now has its own statefile.
+So you can now monitor the same system from multiple servers without the risk of loosing
log
+messages. Important: Multiple OMD sites running under the same server IP address still
steal
+log messages from one another.
+
diff --git a/ChangeLog b/ChangeLog
index ec5c5cc..6869e0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -123,6 +123,7 @@
* 3019 FIX: netapp_api_volumes: fixed incorrect metrics (wrong scaling in graphs)
* 3111 FIX: citrix_status: fixed incorrect assignment of piggyback data to host
running the plugin...
* 3020 FIX: netapp_api_volumes: ignore volumes of cluster partner...
+ * 3022 FIX: mk_logwatch (linux): now able to handle queries from multiple servers (no
longer loosing data)...
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/agents/plugins/mk_logwatch b/agents/plugins/mk_logwatch
index e58d5d7..6697358 100755
--- a/agents/plugins/mk_logwatch
+++ b/agents/plugins/mk_logwatch
@@ -56,11 +56,22 @@ else:
mk_confdir = os.getenv("MK_CONFDIR") or "."
mk_vardir = os.getenv("MK_VARDIR") or "."
+remote_hostname = os.getenv("REMOTE", "")
+
print "<<<logwatch>>>"
config_filename = mk_confdir + "/logwatch.cfg"
config_dir = mk_confdir + "/logwatch.d/*.cfg"
-status_filename = mk_vardir + "/logwatch.state"
+
+if remote_hostname != "":
+ status_filename = "%s/mk_logwatch_%s.state" % (mk_vardir, remote_hostname)
+else:
+ status_filename = "%s/mk_logwatch.state" % mk_vardir
+
+# Copy the last known state from the logwatch.state when there is no status_filename
yet.
+if not os.path.exists(status_filename) and os.path.exists("%s/logwatch.state" %
mk_vardir):
+ import shutil
+ shutil.copy("%s/logwatch.state" % mk_vardir, status_filename)
def is_not_comment(line):
if line.lstrip().startswith('#') or \