Module: check_mk
Branch: master
Commit: b84f943902df8fd916815254e70d3be55d760e77
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b84f943902df8f…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Fri Jul 15 11:56:12 2016 +0200
bugfix:output of notification scripts is now only sent to stdout if this is explicitly
requested
---
modules/check_mk.py | 6 +++++-
modules/notify.py | 3 ++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index b5cb4b9..3e745fe 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -4976,6 +4976,7 @@ load_checks()
opt_nowiki = False
opt_split_rrds = False
opt_delete_rrds = False
+opt_log_to_stdout = False
# Do option parsing and execute main function -
short_options = 'ASHVLCURODMmd:Ic:nhvpXPNBilf'
@@ -4990,7 +4991,8 @@ long_options = [ "help", "version",
"verbose", "compile", "debug", "interactive"
"man", "nowiki", "config-check",
"backup=", "restore=",
"check-inventory=", "check-discovery=",
"discover-marked-hosts", "paths",
"checks=", "inventory",
"inventory-as-check=", "hw-changes=", "sw-changes=",
"sw-missing=",
- "inv-fail-status=", "cmc-file=",
"browse-man", "list-man", "update-dns-cache",
"cap", "real-time-checks" ]
+ "inv-fail-status=", "cmc-file=",
"browse-man", "list-man", "update-dns-cache",
"cap", "real-time-checks",
+ "log-to-stdout"]
non_config_options = ['-L', '--list-checks', '-P',
'--package', '-M',
'--handle-alerts', '--notify',
'--real-time-checks',
@@ -5078,6 +5080,8 @@ for o,a in opts:
opt_inv_sw_missing = int(a)
elif o == "--inv-fail-status":
opt_inv_fail_status = int(a)
+ elif o == "--log-to-stdout":
+ opt_log_to_stdout = True
# Perform actions (major modes)
try:
diff --git a/modules/notify.py b/modules/notify.py
index 6003435..4107db0 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -1191,7 +1191,8 @@ def call_notification_script(plugin, plugin_context):
line = p.stdout.readline()
if line != '':
plugin_log("Output: %s" %
line.rstrip().decode('utf-8'))
- sys.stdout.write(line)
+ if opt_log_to_stdout:
+ sys.stdout.write(line)
else:
break
# the stdout is closed but the return code may not be available just yet - wait
for the