Module: check_mk
Branch: master
Commit: d4544ed0145954ba8f29aba4f078fcdf1833be5b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d4544ed0145954…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Nov 12 14:21:21 2011 +0100
FIX: do not create precomiled checks for host without Check_MK services
---
ChangeLog | 1 +
modules/check_mk.py | 12 ++++++++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 30763fe..f0304ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -44,6 +44,7 @@
1.1.12p2:
Core, Setup, etc.:
* FIX: fix handling of empty suboids
+ * FIX: do not create precomiled checks for host without Check_MK services
Checks & Agents:
* FIX: mem.win: Default levels now works, check not always OK
diff --git a/modules/check_mk.py b/modules/check_mk.py
index b03f8aa..8eaf1f6 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -2298,14 +2298,20 @@ def precompile_hostcheck(hostname):
if opt_verbose:
sys.stderr.write("%s%s%-16s%s:" % (tty_bold, tty_blue, hostname,
tty_normal))
+ compiled_filename = precompiled_hostchecks_dir + "/" + hostname
+ source_filename = compiled_filename + ".py"
try:
os.remove(compiled_filename)
os.remove(source_filename)
except:
pass
- compiled_filename = precompiled_hostchecks_dir + "/" + hostname
- source_filename = compiled_filename + ".py"
+ # check table, enriched with addition precompiled information.
+ check_table = get_precompiled_check_table(hostname)
+ if len(check_table) == 0:
+ if opt_verbose:
+ sys.stderr.write("(no Check_MK checks)\n")
+ return
output = file(source_filename + ".new", "w")
output.write("#!/usr/bin/python\n")
@@ -2349,8 +2355,6 @@ no_inventory_possible = None
]:
output.write("%s = %r\n" % (var, globals()[var]))
- # check table, enriched with addition precompiled information.
- check_table = get_precompiled_check_table(hostname)
output.write("\n# Checks for %s\n\n" % hostname)
output.write("def get_sorted_check_table(hostname):\n return %r\n\n" %
check_table)