Module: check_mk
Branch: master
Commit: 690bf2ef1985114e0428c6006cddc7fed8e6d710
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=690bf2ef198511…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Oct 5 16:09:51 2011 +0200
Made profile output file configurable (Variable: g_profile_path)
---
ChangeLog | 1 +
modules/check_mk.py | 16 +++++++++-------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cb5b7f2..843154f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
1.1.12b1:
Core, Setup, etc.:
* FIX: fix cmk -D on cluster hosts
+ * Made profile output file configurable (Variable: g_profile_path)
Checks & Agents:
* FIX: j4p_performance: fix inventory functions
diff --git a/modules/check_mk.py b/modules/check_mk.py
index a6bb428..e69761c 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -34,7 +34,8 @@ check_mk_version = '(inofficial)'
# Some things have to be done before option parsing and might
# want to output some verbose messages.
-g_profile = None
+g_profile = None
+g_profile_path = 'profile.out'
if __name__ == "__main__":
opt_debug = '--debug' in sys.argv[1:]
@@ -3975,15 +3976,16 @@ def read_all_autochecks():
def output_profile():
if g_profile:
- g_profile.dump_stats("profile.out")
- file("show_profile.py", "w")\
+ g_profile.dump_stats(g_profile_path)
+ show_profile = os.path.join(os.path.dirname(g_profile_path),
'show_profile.py')
+ file(show_profile, "w")\
.write("#!/usr/bin/python\n"
"import pstats\n"
- "stats = pstats.Stats('profile.out')\n"
- "stats.sort_stats('time').print_stats()\n")
- os.chmod("show_profile.py", 0755)
+ "stats = pstats.Stats('%s')\n"
+ "stats.sort_stats('time').print_stats()\n" %
g_profile_path)
+ os.chmod(show_profile, 0755)
- sys.stderr.write("Profile 'profile.out' written. Please run
./show_profile.py.\n")
+ sys.stderr.write("Profile '%s' written. Please run %s.\n" %
(g_profile_path, show_profile))
# +----------------------------------------------------------------------+
# | __ __ _ |