Module: check_mk
Branch: master
Commit: 5421c247679f9b2b3c8e5e3d5748ba90782953cf
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5421c247679f9b…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Wed Jun 8 14:08:27 2016 +0200
messages from notification scripts are now passed through to the caller (see werk #8330)
---
modules/notify.py | 1 +
notifications/mail | 2 ++
2 files changed, 3 insertions(+)
diff --git a/modules/notify.py b/modules/notify.py
index 5353e1d..fbe7ffc 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -1185,6 +1185,7 @@ 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)
else:
break
# the stdout is closed but the return code may not be available just yet - wait for the
diff --git a/notifications/mail b/notifications/mail
index e282d7a..6ef6644 100755
--- a/notifications/mail
+++ b/notifications/mail
@@ -500,6 +500,8 @@ def send_mail_smtp_impl(message, target, host, from_address, context):
# evil hack: the smtplib doesn't allow access to the reply code/message
# in case of success. But we want it!
+ conn.last_code = 0
+ conn.last_repl = ""
conn.getreply = types.MethodType(getreply_wrapper, conn)
if encryption == "STARTTLS":
Module: check_mk
Branch: master
Commit: 3b389e2cd0562bc2f8d133392d54225e9072951c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3b389e2cd0562b…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Wed Jun 8 13:37:40 2016 +0200
support for nested structures when passing parameters from wato to context of notifcation plugins
---
modules/notify.py | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/modules/notify.py b/modules/notify.py
index 7ef1915..5353e1d 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -1075,6 +1075,26 @@ def notify_via_email(plugin_context):
# 1: Could not send now, please retry later
# 2: Cannot send, retry does not make sense
+
+# recursively turns a python object (with lists, dictionaries and pods) containing parameters
+# into a flat contextlist for use as environment variables in plugins
+#
+# this: { "LVL1": [{"VALUE": 42}, {"VALUE": 13}] }
+# would be added as:
+# PARAMETER_LVL1_1_VALUE = 42
+# PARAMETER_LVL1_2_VALUE = 13
+def add_to_context(plugin_context, prefix, param):
+ if isinstance(param, list):
+ plugin_context[prefix + "S"] = " ".join(param)
+ for nr, value in enumerate(param):
+ add_to_context(plugin_context, "%s_%d" % (prefix, nr + 1), value)
+ elif isinstance(param, dict):
+ for key, value in param.items():
+ add_to_context(plugin_context, "%s_%s" % (prefix, key.upper()), value)
+ else:
+ plugin_context[prefix] = plugin_param_to_string(param)
+
+
# Add the plugin parameters to the envinroment. We have two types of parameters:
# - list, the legacy style. This will lead to PARAMETERS_1, ...
# - dict, the new style for scripts with WATO rule. This will lead to
@@ -1083,13 +1103,8 @@ def create_plugin_context(raw_context, params):
plugin_context = {}
plugin_context.update(raw_context) # Make a real copy
- if type(params) == list:
- plugin_context["PARAMETERS"] = " ".join(params)
- for nr, param in enumerate(params):
- plugin_context["PARAMETER_%d" % (nr + 1)] = param
- else:
- for key, value in params.items():
- plugin_context["PARAMETER_" + key.upper()] = plugin_param_to_string(value)
+ add_to_context(plugin_context, "PARAMETER", params)
+
return plugin_context
Module: check_mk
Branch: master
Commit: 7ff4313434bb124a84c85e1a3a7f64adbe75c769
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7ff4313434bb12…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Tue Jun 7 16:39:55 2016 +0200
typos fixed
---
modules/events.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/events.py b/modules/events.py
index 8b38934..bfdbadf 100644
--- a/modules/events.py
+++ b/modules/events.py
@@ -438,7 +438,7 @@ def event_match_contactgroups(rule, context):
if required_groups != None:
if cgn == None:
notify_log("Warning: No information about contact groups in the context. " \
- "Seams that you don't use the Check_MK Microcore. ")
+ "Seems that you don't use the Check_MK Microcore. ")
return
if cgn:
contactgroups = cgn.split(",")
@@ -495,7 +495,7 @@ def event_match_services(rule, context):
servicelist = rule["match_services"]
service = context["SERVICEDESC"]
if not in_extraconf_servicelist(servicelist, service):
- return "The service's description '%s' dows not match by the list of " \
+ return "The service's description '%s' does not match by the list of " \
"allowed services (%s)" % (service, ", ".join(servicelist))
Module: check_mk
Branch: master
Commit: 3e6308b6363a7e5ae3ad0679260537c7e0c75778
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3e6308b6363a7e…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Tue Jun 7 15:32:39 2016 +0200
diskstat: Corrected manpage
---
checkman/diskstat | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/checkman/diskstat b/checkman/diskstat
index 292d5b3..dd5e6a6 100644
--- a/checkman/diskstat
+++ b/checkman/diskstat
@@ -7,7 +7,7 @@ description:
This check measures the throughput of block devices (disks) on Linux
hosts. You can either have a single check for every single disk
- (which is the default) or a summary check summing up the throughput
+ or a summary check (which is the default) summing up the throughput
of all disks.
For legacy reasons it is also possible (but not advisable) to have all disks