Module: check_mk
Branch: master
Commit: 137e277fedcc512d424fa64704b254a522468809
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=137e277fedcc51…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Dec 18 17:09:49 2014 +0100
#1791 FIX Fix problem where many bogus RRD files for Check_MK service would be created
The problem appeared when using CMC and during check execution some general problem
appeared like <tt>UNKNOWN - global name 'netsnmp' is not defined</tt>.
Then in the
<i>next</i> check done by the same helper this message would appear again
because
one variable was not cleared. That garbled the protocol with the microcore and the
later took the output of the passive checks as performance data. This has been
fixed.
---
.werks/1791 | 15 +++++++++++++++
ChangeLog | 1 +
modules/check_mk.py | 47 ++++++++++++++++++++++++-----------------------
3 files changed, 40 insertions(+), 23 deletions(-)
diff --git a/.werks/1791 b/.werks/1791
new file mode 100644
index 0000000..5aade28
--- /dev/null
+++ b/.werks/1791
@@ -0,0 +1,15 @@
+Title: Fix problem where many bogus RRD files for Check_MK service would be created
+Level: 2
+Component: core
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1418918877
+
+The problem appeared when using CMC and during check execution some general problem
+appeared like <tt>UNKNOWN - global name 'netsnmp' is not
defined</tt>. Then in the
+<i>next</i> check done by the same helper this message would appear again
because
+one variable was not cleared. That garbled the protocol with the microcore and the
+later took the output of the passive checks as performance data. This has been
+fixed.
diff --git a/ChangeLog b/ChangeLog
index df4a0db..fe95f51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
1.2.7i1:
Core & Setup:
* 1759 Packed RPM and DEB agent packages are now shipped with normal Check_MK
package...
+ * 1791 FIX: Fix problem where many bogus RRD files for Check_MK service would be
created...
Checks & Agents:
* 1665 agent_netapp: New special agent for NetApp monitoring via Web-API...
diff --git a/modules/check_mk.py b/modules/check_mk.py
index e13e6cf..a18450a 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -5604,33 +5604,32 @@ def do_check_keepalive():
(status, len(total_check_output), total_check_output))
total_check_output = ""
- # Flush file descriptors of stdout and stderr, so that diagnostic
- # messages arrive in time in cmc.log
- sys.stdout.flush()
- sys.stderr.flush()
-
- cleanup_globals()
-
- # Check if all global variables are clean, but only in debug mode
- if opt_debug:
- after = copy_globals()
- for varname, value in before.items():
- if value != after[varname]:
- sys.stderr.write("WARNING: global variable %s has changed:
%r ==> %s\n"
- % (varname, value, repr(after[varname])[:50]))
- new_vars = set(after.keys()).difference(set(before.keys()))
- if (new_vars):
- sys.stderr.write("WARNING: new variable appeared: %s\n" %
", ".join(new_vars))
- sys.stderr.flush()
-
except Exception, e:
signal.signal(signal.SIGALRM, signal.SIG_IGN) # Prevent ALRM from
CheckHelper.cc
signal.alarm(0)
if opt_debug:
raise
- total_check_output = "UNKNOWN - %s\n" % e
- os.write(keepalive_fd, "%03d\n%08d\n%s" %
- (3, len(total_check_output), total_check_output))
+ output = "UNKNOWN - %s\n" % e
+ os.write(keepalive_fd, "%03d\n%08d\n%s" % (3, len(output),
output))
+
+ # Flush file descriptors of stdout and stderr, so that diagnostic
+ # messages arrive in time in cmc.log
+ sys.stdout.flush()
+ sys.stderr.flush()
+
+ cleanup_globals() # Prepare for next check
+
+ # Check if all global variables are clean, but only in debug mode
+ if opt_debug:
+ after = copy_globals()
+ for varname, value in before.items():
+ if value != after[varname]:
+ sys.stderr.write("WARNING: global variable %s has changed: %r
==> %s\n"
+ % (varname, value, repr(after[varname])[:50]))
+ new_vars = set(after.keys()).difference(set(before.keys()))
+ if (new_vars):
+ sys.stderr.write("WARNING: new variable appeared: %s\n" %
", ".join(new_vars))
+ sys.stderr.flush()
keepalive_check_memory(num_checks, keepalive_fd)
# In case of profiling do just this one cycle and end afterwards
@@ -5638,6 +5637,8 @@ def do_check_keepalive():
output_profile()
sys.exit(0)
+ # end of while True:...
+
# Just one lines from stdin. But: make sure that
# nothing more is read - not even into some internal
@@ -5711,7 +5712,7 @@ def read_config_files(with_autochecks=True, with_conf_d=True):
# Initialize dictionary-type default levels variables
for check in check_info.values():
- def_var = check.get("default_levels_variable")
######################### HIRN
+ def_var = check.get("default_levels_variable")
if def_var:
globals()[def_var] = {}