Module: check_mk
Branch: master
Commit: 7f25de14d9033617416211dd489f760eab9162e8
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7f25de14d90336…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Sep 29 09:15:33 2014 +0200
#1408 FIX mknotifyd now really reads all configuration files below mknotifyd.d
Previously the notification spooler daemon <tt>mknotifyd</tt> just read the
single file <tt>etc/check_mk/mknotifyd.d/wato/global.mk</tt>. Now it reads
all files below <tt>etc/check_mk/mknotifyd.d</tt> - just as one would
expect. Note: there is still no <tt>etc/check_mk/mknotifyd.mk</tt> file.
---
.werks/1408 | 12 ++++++++++++
ChangeLog | 1 +
doc/treasures/mknotifyd | 26 ++++++++++++++++++++++++--
3 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/.werks/1408 b/.werks/1408
new file mode 100644
index 0000000..fa7fc02
--- /dev/null
+++ b/.werks/1408
@@ -0,0 +1,12 @@
+Title: mknotifyd now really reads all configuration files below mknotifyd.d
+Level: 2
+Component: notifications
+Compatible: compat
+Version: 1.2.5i6
+Date: 1411974839
+Class: fix
+
+Previously the notification spooler daemon <tt>mknotifyd</tt> just read the
+single file <tt>etc/check_mk/mknotifyd.d/wato/global.mk</tt>. Now it reads
+all files below <tt>etc/check_mk/mknotifyd.d</tt> - just as one would
+expect. Note: there is still no <tt>etc/check_mk/mknotifyd.mk</tt> file.
diff --git a/ChangeLog b/ChangeLog
index 1ab5d69..4795829 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -136,6 +136,7 @@
* 1156 FIX: Graphs in HTML mails are now sent again where they where missing...
* 1157 FIX: Fixed SMS plugin on at least debian (distrs which have no sendsms/smssend)...
* 1407 FIX: Fix exception in rule based notification on non-Ascii characters in log message
+ * 1408 FIX: mknotifyd now really reads all configuration files below mknotifyd.d...
BI:
* 1406 Assume PEND in count_ok aggregations if all nodes are PEND...
diff --git a/doc/treasures/mknotifyd b/doc/treasures/mknotifyd
index 44cca4c..0a793d8 100755
--- a/doc/treasures/mknotifyd
+++ b/doc/treasures/mknotifyd
@@ -352,9 +352,16 @@ def daemonize(user=0, group=0):
def load_configuration():
global g_config, g_config_changed
last_config = g_config.copy()
- config_file = "%s/mknotifyd.d/wato/global.mk" % g_config_dir
+ config_dir = "%s/mknotifyd.d" % g_config_dir
+
try:
- execfile(config_file, {}, g_config)
+ list_of_files = reduce(lambda a,b: a+b,
+ [ [ "%s/%s" % (d, f) for f in fs if f.endswith(".mk")]
+ for d, sb, fs in os.walk(config_dir) ], [])
+ list_of_files.sort(cmp = cmp_config_paths)
+ for path in list_of_files:
+ verbose("Reading configuration file %s" % path)
+ execfile(path, {}, g_config)
except:
g_config = last_config
@@ -362,6 +369,21 @@ def load_configuration():
log("Configuration has changed")
g_config_changed = True
+# This function has been stolen from check_mk.py.
+# Helper function that determines the sort order of the
+# configuration files. The following two rules are implemented:
+# 1. *.mk files in the same directory will be read
+# according to their lexical order.
+# 2. subdirectories in the same directory will be
+# scanned according to their lexical order.
+# 3. subdirectories of a directory will always be read *after*
+# the *.mk files in that directory.
+def cmp_config_paths(a, b):
+ pa = a.split('/')
+ pb = b.split('/')
+ return cmp(pa[:-1], pb[:-1]) or \
+ cmp(len(pa), len(pb)) or \
+ cmp(pa, pb)
def usage():
sys.stdout.write("""Usage: mknotifyd [OPTIONS]
Module: check_mk
Branch: master
Commit: e1570af4e0e82cdcefb4c7356c62f09527baab57
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e1570af4e0e82c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Sep 26 12:23:56 2014 +0200
#1407 FIX Fix exception in rule based notification on non-Ascii characters in log message
---
.werks/1407 | 9 +++++++++
ChangeLog | 1 +
modules/notify.py | 4 ++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/.werks/1407 b/.werks/1407
new file mode 100644
index 0000000..90bf678
--- /dev/null
+++ b/.werks/1407
@@ -0,0 +1,9 @@
+Title: Fix exception in rule based notification on non-Ascii characters in log message
+Level: 2
+Component: notifications
+Compatible: compat
+Version: 1.2.5i6
+Date: 1411727016
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index ebf9490..1ab5d69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -135,6 +135,7 @@
* 1400 Added example notification script for Pushover to doc/treasures/notifications...
* 1156 FIX: Graphs in HTML mails are now sent again where they where missing...
* 1157 FIX: Fixed SMS plugin on at least debian (distrs which have no sendsms/smssend)...
+ * 1407 FIX: Fix exception in rule based notification on non-Ascii characters in log message
BI:
* 1406 Assume PEND in count_ok aggregations if all nodes are PEND...
diff --git a/modules/notify.py b/modules/notify.py
index 24e4c35..57b90d9 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -1874,12 +1874,12 @@ def core_notification_log(plugin, plugin_context):
log_message = "%s NOTIFICATION: %s;%s;%s;%s;%s" % (
what, contact, spec, state, plugin or "plain email", output)
if monitoring_core == "cmc":
- livestatus_send_command("LOG;" + log_message)
+ livestatus_send_command("LOG;" + log_message.encode("utf-8"))
else:
# Nagios and friends do not support logging via an
# external command. We write the files into a help file
# in var/check_mk/notify. If the users likes he can
# replace that file with a symbolic link to the nagios
# log file. But note: Nagios logging might not atomic.
- file(notification_core_log, "a").write("[%d] %s\n" % (time.time(), log_message))
+ file(notification_core_log, "a").write("[%d] %s\n" % (time.time(), log_message.encode("utf-8")))
Module: check_mk
Branch: master
Commit: 32ed15a3cc2237bde6fb7cbcc203890e76e8aa0a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=32ed15a3cc2237…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Sep 26 11:04:30 2014 +0200
#1406 Assume PEND in count_ok aggregations if all nodes are PEND
If you are using the BI aggregation function <tt>count_ok</tt> then nodes
with the state <tt>PEND</tt> (which essentially means unmonitored or not
present) are handled differently from now.
If <b>all</b> nodes are pending then the total state will also be pending.
If just some of the nodes are pending then they will not taken into account.
This is especially imported when doing availability computations on
BI aggregates.
---
.werks/1406 | 16 ++++++++++++++++
ChangeLog | 3 +++
web/htdocs/bi.py | 29 +++++++++++++++++++++++------
3 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/.werks/1406 b/.werks/1406
new file mode 100644
index 0000000..b645eb0
--- /dev/null
+++ b/.werks/1406
@@ -0,0 +1,16 @@
+Title: Assume PEND in count_ok aggregations if all nodes are PEND
+Level: 2
+Component: bi
+Compatible: compat
+Version: 1.2.5i6
+Date: 1411721844
+Class: feature
+
+If you are using the BI aggregation function <tt>count_ok</tt> then nodes
+with the state <tt>PEND</tt> (which essentially means unmonitored or not
+present) are handled differently from now.
+
+If <b>all</b> nodes are pending then the total state will also be pending.
+If just some of the nodes are pending then they will not taken into account.
+This is especially imported when doing availability computations on
+BI aggregates.
diff --git a/ChangeLog b/ChangeLog
index e7fe90d..ebf9490 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -136,6 +136,9 @@
* 1156 FIX: Graphs in HTML mails are now sent again where they where missing...
* 1157 FIX: Fixed SMS plugin on at least debian (distrs which have no sendsms/smssend)...
+ BI:
+ * 1406 Assume PEND in count_ok aggregations if all nodes are PEND...
+
Event Console:
* 1148 Allow execution of actions when cancelling events...
* 1395 Event Console can now create notifications via Check_MK RBN...
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index a133aaf..9fcbac7 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -1301,16 +1301,33 @@ def aggr_countok_convert(num, count):
def aggr_countok(nodes, needed_for_ok=2, needed_for_warn=1):
states = [ i[0]["state"] for i in nodes ]
- num_ok = len([s for s in states if s == 0 ])
+ num_ok = len([s for s in states if s == 0 ])
+ num_nonok = len([s for s in states if s > 0 ])
+ num_pending = len(states) - num_ok - num_nonok
+ num_nodes = num_ok + num_nonok
+
+ # We need to handle the special case "PENDING" separately.
+ # Example: count is set to 50%. You have 10 nodes, all of
+ # which are PENDING, then the outcome must be PENDING, not
+ # CRIT.
+ if num_nodes == 0: # All are pending
+ return { "state": -1, "output": "" }
# counts can be specified as integer (e.g. '2') or
# as percentages (e.g. '70%').
- if num_ok >= aggr_countok_convert(needed_for_ok, len(states)):
- return { "state" : 0, "output" : "" }
- elif num_ok >= aggr_countok_convert(needed_for_warn, len(states)):
- return { "state" : 1, "output" : "" }
+ ok_count = aggr_countok_convert(needed_for_ok, num_nodes)
+ warn_count = aggr_countok_convert(needed_for_warn, num_nodes)
+
+ # Enough nodes are OK -> state is OK
+ if num_ok >= ok_count:
+ return { "state": 0, "output": "" }
+
+ # Enough nodes OK in order to trigger warn level -> WARN
+ elif num_ok >= warn_count:
+ return { "state": 1, "output": "" }
+
else:
- return { "state" : 2, "output" : "" }
+ return { "state": 2, "output": "" }
config.aggregation_functions["count_ok"] = aggr_countok
Module: check_mk
Branch: master
Commit: f9e4d3e63cbc356f377761b8d3045a06cbfb7645
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f9e4d3e63cbc35…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Sep 25 16:21:29 2014 +0200
Updated bug entries #2184
---
.bugs/2184 | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/.bugs/2184 b/.bugs/2184
new file mode 100644
index 0000000..9f39b7c
--- /dev/null
+++ b/.bugs/2184
@@ -0,0 +1,12 @@
+Title: SNMP Community in host properties not shown on IE?
+Component: wato
+State: open
+Date: 2014-09-25 16:13:09
+Targetversion: future
+Class: bug
+
+A host that is tagged as SNMP host is opened in WATO. Nevertheless
+the attribute SNMP Community is not visible. In Firefox it is
+visible. Looks like some JS problem with IE...
+
+Switching back and forth the tag seems not help.
Module: check_mk
Branch: master
Commit: ec5872b98ca1711c250785649c9076c3aed1f213
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ec5872b98ca171…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Sep 25 12:13:54 2014 +0200
#1119 FIX WATO create rule: No longer raises an incorrect permission warning when creating a new rule
A normal monitoring user which had only permissions to a given subfolder
could not create a new rule when the rule formular was created with the
main directory as rule path.<br><br>
For example, if the user pressed "Create in folder: 'Main directory'" and
switched the actual rule folder to his subfolder afterwards.<br>
This resulted in a permission warning stating that the user has no permission to
write into the 'Main directory'.
---
.werks/1119 | 16 ++++++++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 3 ++-
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/.werks/1119 b/.werks/1119
new file mode 100644
index 0000000..8b76c4b
--- /dev/null
+++ b/.werks/1119
@@ -0,0 +1,16 @@
+Title: WATO create rule: No longer raises an incorrect permission warning when creating a new rule
+Level: 1
+Component: wato
+Compatible: compat
+Version: 1.2.5i6
+Date: 1411639616
+Class: fix
+
+A normal monitoring user which had only permissions to a given subfolder
+could not create a new rule when the rule formular was created with the
+main directory as rule path.<br><br>
+
+For example, if the user pressed "Create in folder: 'Main directory'" and
+switched the actual rule folder to his subfolder afterwards.<br>
+This resulted in a permission warning stating that the user has no permission to
+write into the 'Main directory'.
diff --git a/ChangeLog b/ChangeLog
index 49e9399..e7fe90d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -127,6 +127,7 @@
* 1101 FIX: WATO check parameter: renamed 'Nominal Voltages' to 'Voltage Levels..'
* 1396 FIX: Fix default setting of Enable sounds in views...
* 1109 FIX: WATO active checks: passwords no longer shown as plain text....
+ * 1119 FIX: WATO create rule: No longer raises an incorrect permission warning when creating a new rule...
Notifications:
* 1151 Add variables (HOST/SERVICE)ACK(AUTHOR/COMMENT) to notification context...
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index afab772..12088e8 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -14291,7 +14291,8 @@ def mode_edit_rule(phase, new = False):
new_rule_folder = g_folders[html.var("new_rule_folder")]
# Check permissions on folders
- check_folder_permissions(folder, "write", True)
+ if not new:
+ check_folder_permissions(folder, "write", True)
check_folder_permissions(new_rule_folder, "write", True)
# VALUE
Module: check_mk
Branch: master
Commit: 0fa1ffedc2f919c9cda1719f96d962f90edc6ab2
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0fa1ffedc2f919…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Sep 24 17:58:38 2014 +0200
#1405 Checkbox for settings downtimes on the hosts of the selected services
In the Multisite command box for setting downtimes on services there is now
a new checkbox called <i>Schedule downtimes on the affected hosts instead
of their services</i>. When you check this then the scheduled downtimes
are set on the hosts of the selected services rather then on the services
themselves. Note: When a host is in scheduled downtime then all its services
are considered to be in a scheduled downtime, as well. There is no need to
set a downtime on these.
---
.werks/1405 | 16 ++++++++++++++++
ChangeLog | 1 +
web/htdocs/views.py | 11 +++++++----
web/plugins/views/commands.py | 16 +++++++++++++++-
4 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/.werks/1405 b/.werks/1405
new file mode 100644
index 0000000..6709ad5
--- /dev/null
+++ b/.werks/1405
@@ -0,0 +1,16 @@
+Title: Checkbox for settings downtimes on the hosts of the selected services
+Level: 2
+Component: multisite
+Compatible: compat
+Version: 1.2.5i6
+Date: 1411574194
+Class: feature
+
+In the Multisite command box for setting downtimes on services there is now
+a new checkbox called <i>Schedule downtimes on the affected hosts instead
+of their services</i>. When you check this then the scheduled downtimes
+are set on the hosts of the selected services rather then on the services
+themselves. Note: When a host is in scheduled downtime then all its services
+are considered to be in a scheduled downtime, as well. There is no need to
+set a downtime on these.
+
diff --git a/ChangeLog b/ChangeLog
index 75f6489..49e9399 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -105,6 +105,7 @@
* 1066 Implemented Dashboard Designer...
* 1392 WATO Folder filter: show only the paths a user is allowed to see
* 1398 Allow to spread times of next check when rescheduling...
+ * 1405 Checkbox for settings downtimes on the hosts of the selected services...
* 1067 FIX: Fixed login problem in LDAP connector when no user filter specified...
* 1094 FIX: sidebar snaping 'Tree of folders': fixed exception
* 1154 FIX: Availability: Fixed unwanted redirect to edit annotation page after editing availability options...
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index d264da8..e3717ed 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -2007,13 +2007,16 @@ def do_actions(view, what, action_rows, backurl):
return False
count = 0
+ already_executed = set([])
for nr, row in enumerate(action_rows):
core_commands, title, executor = core_command(what, row, nr, len(action_rows))
for command in core_commands:
- if type(command) == unicode:
- command = command.encode("utf-8")
- executor(command, row["site"])
- count += 1
+ if command not in already_executed:
+ if type(command) == unicode:
+ command = command.encode("utf-8")
+ executor(command, row["site"])
+ already_executed.add(command)
+ count += 1
message = None
if command:
diff --git a/web/plugins/views/commands.py b/web/plugins/views/commands.py
index b92a10d..3439e96 100644
--- a/web/plugins/views/commands.py
+++ b/web/plugins/views/commands.py
@@ -365,10 +365,12 @@ def command_downtime(cmdtag, spec, row):
down_to = time.time() + minutes * 60
title = _("<b>schedule an immediate downtime for the next %d minutes</b> on" % minutes)
+
elif html.var("_down_adhoc"):
minutes = config.adhoc_downtime.get("duration",0)
down_to = time.time() + minutes * 60
title = _("<b>schedule an immediate downtime for the next %d minutes</b> on" % minutes)
+
elif html.var("_down_custom"):
down_from = html.get_datetime_input("_down_from")
down_to = html.get_datetime_input("_down_to")
@@ -381,6 +383,9 @@ def command_downtime(cmdtag, spec, row):
time.asctime(time.localtime(down_to)))
elif html.var("_down_remove"):
+ if html.var("_on_hosts"):
+ raise MKUserError("_on_hosts", _("The checkbox for setting host downtimes does not work when removing downtimes."))
+
downtime_ids = []
if cmdtag == "HOST":
prefix = "host_"
@@ -412,6 +417,10 @@ def command_downtime(cmdtag, spec, row):
if html.var("_include_childs"): # only for hosts
specs = [ spec ] + get_child_hosts(row["site"], [spec], recurse = not not html.var("_include_childs_recurse"))
+ elif html.var("_on_hosts"): # set on hosts instead of services
+ specs = [ spec.split(";")[0] ]
+ title += " the hosts of"
+ cmdtag = "HOST"
else:
specs = [ spec ]
@@ -420,6 +429,7 @@ def command_downtime(cmdtag, spec, row):
+ comment) for spec in specs]
return commands, title
+
def get_child_hosts(site, hosts, recurse):
hosts = set(hosts)
html.live.set_only_sites([site])
@@ -437,6 +447,7 @@ def get_child_hosts(site, hosts, recurse):
new_childs.update(rec_childs)
return list(new_childs)
+
def paint_downtime_buttons(what):
html.write(_('Downtime Comment')+": ")
@@ -472,11 +483,14 @@ def paint_downtime_buttons(what):
html.checkbox("_down_flexible", False, label=_('flexible with max. duration')+" ")
html.time_input("_down_duration", 2, 0)
html.write(" "+_('(HH:MM)'))
+ html.write("<hr>")
if what == "host":
- html.write("<hr>")
html.checkbox("_include_childs", False, label=_('Also set downtime on child hosts'))
html.write(" ")
html.checkbox("_include_childs_recurse", False, label=_('Do this recursively'))
+ else:
+ html.checkbox("_on_hosts", False, label=_('Schedule downtimes on the affected <b>hosts</b> instead of their services'))
+
multisite_commands.append({