Module: check_mk
Branch: master
Commit: afd036f5d79f1000ac3edf9b1b1f7a3080d9213f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=afd036f5d79f10…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri May 29 17:18:48 2015 +0200
#2304 notification bulking: now able to configure the notification sort order in emails
With this update you can now configure, which notification should get shown
at the top of the email. Per default the oldest notification was displayed at the top.
You can configure the new option <i>Notification sort order for bulk notifications</i>
in the WATO rules <i>Parameters for HTML Email</i> and <i>Parameters for ASCII Email</i> or
specifically in a notification rule.
---
.werks/2304 | 14 ++++++++++++++
ChangeLog | 1 +
modules/notify.py | 15 +++++++++++++--
web/plugins/wato/notifications.py | 24 ++++++++++++++++++++++++
4 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/.werks/2304 b/.werks/2304
new file mode 100644
index 0000000..98ea31c
--- /dev/null
+++ b/.werks/2304
@@ -0,0 +1,14 @@
+Title: notification bulking: now able to configure the notification sort order in emails
+Level: 1
+Component: notifications
+Compatible: compat
+Version: 1.2.7i1
+Date: 1432912433
+Class: feature
+
+With this update you can now configure, which notification should get shown
+at the top of the email. Per default the oldest notification was displayed at the top.
+
+You can configure the new option <i>Notification sort order for bulk notifications</i>
+in the WATO rules <i>Parameters for HTML Email</i> and <i>Parameters for ASCII Email</i> or
+specifically in a notification rule.
diff --git a/ChangeLog b/ChangeLog
index 403ea87..1b55da4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -536,6 +536,7 @@
* 1235 Added notification plugin for Braintower SMS Gateways...
* 2188 Rule based notification now allow match for notification comment...
* 2195 New condition "Match Contacts" in rule based notifications...
+ * 2304 notification bulking: now able to configure the notification sort order in emails...
* 1661 FIX: mknotifyd: improved performance when receiving forwarded notifications
* 1664 FIX: mknotifyd: further performance improvements for notification forwarding
* 1205 FIX: RBN: Fixed match contactgroup condition...
diff --git a/modules/notify.py b/modules/notify.py
index 26bb7b7..f7642ae 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -1690,9 +1690,11 @@ def notify_bulk(dirname, uuids):
unhandled_uuids.append((mtime, uuid))
continue
- bulk_context.append("\n")
+ part_block = []
+ part_block.append("\n")
for varname, value in context.items():
- bulk_context.append("%s=%s\n" % (varname, value.replace("\r", "").replace("\n", "\1")))
+ part_block.append("%s=%s\n" % (varname, value.replace("\r", "").replace("\n", "\1")))
+ bulk_context.append(part_block)
# Do not forget to add this to the monitoring log. We create
# a single entry for each notification contained in the bulk.
@@ -1701,6 +1703,15 @@ def notify_bulk(dirname, uuids):
core_notification_log(plugin_name, context)
if bulk_context: # otherwise: only corrupted files
+ # Per default the uuids are sorted chronologically from oldest to newest
+ # Therefore the notification plugin also shows the oldest entry first
+ # The following configuration option allows to reverse the sorting
+ if old_params.get("bulk_sort_order") == "newest_first":
+ bulk_context.reverse()
+
+ # Converts bulk context from [[1,2],[3,4]] to [1,2,3,4]
+ bulk_context = [x for y in bulk_context for x in y]
+
parameter_context = create_bulk_parameter_context(old_params)
context_text = "".join(parameter_context + bulk_context)
call_bulk_notification_script(plugin, context_text)
diff --git a/web/plugins/wato/notifications.py b/web/plugins/wato/notifications.py
index 5b5ac87..b4e9a4c 100644
--- a/web/plugins/wato/notifications.py
+++ b/web/plugins/wato/notifications.py
@@ -103,6 +103,18 @@ register_notification_parameters(
"other."),
)
),
+ ('bulk_sort_order',
+ DropdownChoice(
+ choices = [
+ ('oldest_first', _('Oldest first')),
+ ('newest_first', _('Newest first')),
+ ],
+ help = _("With this option you can specify, whether the oldest (default) or "
+ "the newest notification should get shown at the top of the notification mail."),
+ title = _("Notification sort order for bulk notifications"),
+ default = "oldest_first"
+ )
+ )
]
)
)
@@ -185,6 +197,18 @@ $LONGSERVICEOUTPUT$
""",
)
),
+ ('bulk_sort_order',
+ DropdownChoice(
+ choices = [
+ ('oldest_first', _('Oldest first')),
+ ('newest_first', _('Newest first')),
+ ],
+ help = _("With this option you can specify, whether the oldest (default) or "
+ "the newest notification should get shown at the top of the notification mail."),
+ title = _("Notification sort order for bulk notifications"),
+ default = "oldest_first"
+ )
+ )
]
)
)
Module: check_mk
Branch: master
Commit: 3787b3edd961f3342f0711c479f4059569473bd7
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3787b3edd961f3…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Fri May 29 15:28:36 2015 +0200
Improved wording
---
web/htdocs/pagetypes.py | 2 +-
web/htdocs/visuals.py | 2 +-
web/plugins/views/commands.py | 2 +-
web/plugins/wato/check_parameters.py | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/web/htdocs/pagetypes.py b/web/htdocs/pagetypes.py
index 23e5fdc..c6fad15 100644
--- a/web/htdocs/pagetypes.py
+++ b/web/htdocs/pagetypes.py
@@ -330,7 +330,7 @@ class Overridable:
if clazz.has_overriding_permission("publish"):
return [( _("General Properties"), [
( 2.2, 'public', Checkbox(
- title = _("Visbility"),
+ title = _("Visibility"),
label = _('Make available for all users')
)),
])]
diff --git a/web/htdocs/visuals.py b/web/htdocs/visuals.py
index 39026a8..f925efa 100644
--- a/web/htdocs/visuals.py
+++ b/web/htdocs/visuals.py
@@ -744,7 +744,7 @@ def page_edit_visual(what, all_visuals, custom_field_handler = None,
html.hidden_field("load_user", html.var("load_user", "")) # safe old name in case user changes it
html.hidden_field("load_name", oldname) # safe old name in case user changes it
- # FIXME: Hier werden die Flags aus visbility nicht korrekt geladen. Wäre es nicht besser,
+ # FIXME: Hier werden die Flags aus visibility nicht korrekt geladen. Wäre es nicht besser,
# diese in einem Unter-Dict zu lassen, anstatt diese extra umzukopieren?
visib = []
for key, title in visibility_choices:
diff --git a/web/plugins/views/commands.py b/web/plugins/views/commands.py
index 9568e29..de3aa45 100644
--- a/web/plugins/views/commands.py
+++ b/web/plugins/views/commands.py
@@ -564,7 +564,7 @@ def paint_downtime_buttons(what):
html.checkbox("_include_childs_recurse", False, label=_('Do this recursively'))
elif what == "service":
html.write("<hr>")
- html.checkbox("_on_hosts", False, label=_('Schedule downtimes on the affected <b>hosts</b> instead of their services'))
+ html.checkbox("_on_hosts", False, label=_('Schedule downtimes on the affected <b>hosts</b> instead of on the individual services'))
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 8c422f4..f033168 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -309,7 +309,7 @@ register_check_parameters(
( "average",
Integer(
title = _("Averaging"),
- help = _("When this option is activated then the CPU utilization is being "
+ help = _("When this option is activated then the block rate is being "
"averaged <b>before</b> the levels are being applied."),
unit = _("min"),
default_value = 15,
Module: check_mk
Branch: master
Commit: 8c77cf30582627cd1f839f26e3e9691608a15c19
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8c77cf30582627…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri May 29 14:28:52 2015 +0200
#2282 FIX mkeventd: fixed exception in notification if the application field of the event was not set
Events without an properly set <i>application</i> field were not processed correctly
by the Check_MK notification module. By nature, all events from the event console
are always considered as service events. If the <i>application</i> field is empty
the event was processed as host event, which lead to an exception.
---
.werks/2282 | 13 +++++++++++++
ChangeLog | 1 +
mkeventd/bin/mkeventd | 2 +-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/.werks/2282 b/.werks/2282
new file mode 100644
index 0000000..0462a12
--- /dev/null
+++ b/.werks/2282
@@ -0,0 +1,13 @@
+Title: mkeventd: fixed exception in notification if the application field of the event was not set
+Level: 2
+Component: ec
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1432902248
+
+Events without an properly set <i>application</i> field were not processed correctly
+by the Check_MK notification module. By nature, all events from the event console
+are always considered as service events. If the <i>application</i> field is empty
+the event was processed as host event, which lead to an exception.
diff --git a/ChangeLog b/ChangeLog
index c806a6b..403ea87 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -582,6 +582,7 @@
* 2139 FIX: Fix exception in Event Console when archiving events with match groups and non ASCII characters
* 2151 FIX: Fixed wrong time in events when forwarding logwatch to EC between timezones...
* 2281 FIX: mkeventd: fix: now able to create notifications with events containing umlauts...
+ * 2282 FIX: mkeventd: fixed exception in notification if the application field of the event was not set...
Livestatus:
* 2229 Do not fail on non-existing Livestatus columns any longer, output None or null instead...
diff --git a/mkeventd/bin/mkeventd b/mkeventd/bin/mkeventd
index b2bd1be..f6766e3 100755
--- a/mkeventd/bin/mkeventd
+++ b/mkeventd/bin/mkeventd
@@ -3262,7 +3262,7 @@ def do_notify(event, username, is_cancelling):
"SERVICEACKCOMMENT": "",
"SERVICEATTEMPT": "1",
"SERVICECHECKCOMMAND": "ec-rule-" + event["rule_id"],
- "SERVICEDESC": event["application"],
+ "SERVICEDESC": event["application"] or "Unset",
"SERVICENOTIFICATIONNUMBER": "1",
"SERVICEOUTPUT": event["text"],
"SERVICEPERFDATA": "",
Module: check_mk
Branch: master
Commit: 9c194c87b0fdb5c055d1c71854a1522b5b7c2521
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9c194c87b0fdb5…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Fri May 29 10:09:09 2015 +0200
Fixed typo
---
web/htdocs/metrics.py | 2 +-
web/plugins/wato/active_checks.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index 26ff2cf..1e7882d 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -355,7 +355,7 @@ def operator_minmax(a, b, func):
v = func(a[0], b[0])
# Use unit and color of the winner. If the winner
# has none (e.g. it is a scalar like 0), then take
- # unit and color of the looser.
+ # unit and color of the loser.
if v == a[0]:
winner = a
loser = b
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index db7189b..9488a31 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -1452,7 +1452,7 @@ register_rule(group,
),
Password(
title = _("Password / Secret"),
- help = _("Valid automation secret or password for the user, depending on the choosen "
+ help = _("Valid automation secret or password for the user, depending on the chosen "
"authentication mode."),
allow_empty = False
),
Module: check_mk
Branch: master
Commit: 2cb7f9a1d54645e25461970907a471172b32ab92
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2cb7f9a1d54645…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri May 29 09:18:33 2015 +0200
Fix CSV export of new matrix layout when uniform rows are omitted
---
web/htdocs/views.py | 47 +++++++++++++++++++++---------------------
web/plugins/views/layouts.py | 1 +
2 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index c966f2e..6181f53 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -1057,28 +1057,6 @@ def show_view(view, show_heading = False, show_buttons = True,
colset.remove("site")
columns = list(colset)
- # The layout of the view: it can be overridden by several specifying
- # an output format (like json or python). Note: the layout is not
- # always needed. In case of an embedded view in the reporting this
- # field is simply missing, because the rendering is done by the
- # report itself.
- # TODO: CSV export should be handled by the layouts. It cannot
- # be done generic in most cases
- if html.output_format == "html":
- if "layout" in view:
- layout = multisite_layouts[view["layout"]]
- else:
- layout = None
- else:
- if "layout" in view and "csv_export" in multisite_layouts[view["layout"]]:
- multisite_layouts[view["layout"]]["csv_export"](rows, view, group_painters, painters)
- return
- else:
- # Generic layout of export
- layout = multisite_layouts.get(html.output_format)
- if not layout:
- layout = multisite_layouts["json"]
-
# Get list of painter options we need to display (such as PNP time range
# or the format being used for timestamp display)
painter_options = []
@@ -1089,7 +1067,8 @@ def show_view(view, show_heading = False, show_buttons = True,
need_inventory_data = True
# Also layouts can register painter options
- painter_options += layout.get("options", [])
+ if "layout" in view:
+ painter_options += multisite_layouts[view["layout"]].get("options", [])
painter_options = list(set(painter_options))
painter_options.sort()
@@ -1136,6 +1115,28 @@ def show_view(view, show_heading = False, show_buttons = True,
html.del_var(varname)
return len(rows)
+ # The layout of the view: it can be overridden by several specifying
+ # an output format (like json or python). Note: the layout is not
+ # always needed. In case of an embedded view in the reporting this
+ # field is simply missing, because the rendering is done by the
+ # report itself.
+ # TODO: CSV export should be handled by the layouts. It cannot
+ # be done generic in most cases
+ if html.output_format == "html":
+ if "layout" in view:
+ layout = multisite_layouts[view["layout"]]
+ else:
+ layout = None
+ else:
+ if "layout" in view and "csv_export" in multisite_layouts[view["layout"]]:
+ multisite_layouts[view["layout"]]["csv_export"](rows, view, group_painters, painters)
+ return
+ else:
+ # Generic layout of export
+ layout = multisite_layouts.get(html.output_format)
+ if not layout:
+ layout = multisite_layouts["json"]
+
# Set browser reload
if browser_reload and 'R' in display_options and not only_count:
html.set_browser_reload(browser_reload)
diff --git a/web/plugins/views/layouts.py b/web/plugins/views/layouts.py
index 67c8b3a..567ca53 100644
--- a/web/plugins/views/layouts.py
+++ b/web/plugins/views/layouts.py
@@ -591,6 +591,7 @@ def csv_export_matrix(rows, view, group_painters, painters):
output_csv_headers(view)
groups, unique_row_ids, matrix_cells = list(create_matrices(rows, group_painters, painters, num_columns=None))[0]
+ value_counts, row_majorities = matrix_find_majorities(rows, painters, False)
table.begin(output_format="csv")
for painter_nr, painter in enumerate(group_painters):
Module: check_mk
Branch: master
Commit: d8395acef820fd50fd80d4d52518470cfb0f1ed0
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d8395acef820fd…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu May 28 14:30:42 2015 +0200
#2301 Availability now allows just showing rows with outage times above certain levels
In the availability options you can now define percentage levels for WARN,
CRIT and non-OK. Only objects that exceed these levels will be displayed
then. This allows you to make a report of just those object that had some
problem during the queried time range.
---
.werks/2301 | 12 +++++++++++
ChangeLog | 1 +
web/htdocs/availability.py | 47 +++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 59 insertions(+), 1 deletion(-)
diff --git a/.werks/2301 b/.werks/2301
new file mode 100644
index 0000000..699dd03
--- /dev/null
+++ b/.werks/2301
@@ -0,0 +1,12 @@
+Title: Availability now allows just showing rows with outage times above certain levels
+Level: 2
+Component: reporting
+Compatible: compat
+Version: 1.2.7i1
+Date: 1432816134
+Class: feature
+
+In the availability options you can now define percentage levels for WARN,
+CRIT and non-OK. Only objects that exceed these levels will be displayed
+then. This allows you to make a report of just those object that had some
+problem during the queried time range.
diff --git a/ChangeLog b/ChangeLog
index d20d8fa..4c4938d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -555,6 +555,7 @@
* 2073 FIX: BI aggregation: fixed exception when showing clusters in BI boxes
Reporting & Availability:
+ * 2301 Availability now allows just showing rows with outage times above certain levels...
* 1990 FIX: Fix two exceptions in PDF exports of host group views
* 2189 FIX: Allow changing graph number from 1 to "all" when editing PNP graph in report...
* 2206 FIX: Add missing option "Show timeline of each object directly in table" for reports...
diff --git a/web/htdocs/availability.py b/web/htdocs/availability.py
index fb0d34e..72b9ef0 100644
--- a/web/htdocs/availability.py
+++ b/web/htdocs/availability.py
@@ -258,6 +258,22 @@ avoption_entries = [
)
),
+ # Filter rows according to actual availability
+ ( "av_filter_outages",
+ "double",
+ True,
+ Dictionary(
+ title = _("Only show objects with outages"),
+ columns = 2,
+ elements = [
+ ( "warn", Percentage(title = _("Show only rows with WARN of at least"), default_value = 0.0)),
+ ( "crit", Percentage(title = _("Show only rows with CRIT of at least"), default_value = 0.0)),
+ ( "non-ok", Percentage(title = _("Show only rows with non-OK of at least"), default_value = 0.0)),
+ ],
+ optional_keys = False,
+ )
+ ),
+
# Show colummns for min, max, avg duration and count
( "outage_statistics",
@@ -462,6 +478,7 @@ def get_default_avoptions():
"host_down" : "host_down",
},
"av_levels" : None,
+ "av_filter_outages" : { "warn" : 0.0, "crit" : 0.0, "non-ok" : 0.0 },
"outage_statistics" : ([],[]),
"av_mode" : False,
"service_period" : "honor",
@@ -693,7 +710,35 @@ def compute_availability(what, av_rawdata, avoptions):
availability_table.append(availability_entry)
availability_table.sort(cmp = cmp_av_entry)
- return availability_table
+
+ # Apply filters
+ filtered_table = []
+ for row in availability_table:
+ if pass_availability_filter(row, avoptions):
+ filtered_table.append(row)
+ return filtered_table
+
+
+def pass_availability_filter(row, avoptions):
+ for key, level in avoptions["av_filter_outages"].items():
+ if level == 0.0:
+ continue
+ if key == "warn":
+ ref_value = row["states"].get("warn", 0)
+ elif key == "crit":
+ ref_value = row["states"].get("crit", row["states"].get("down", 0))
+ elif key == "non-ok":
+ ref_value = 0.0
+ for key, value in row["states"].items():
+ if key not in [ "ok", "up", "unmonitored" ]:
+ ref_value += value
+ else:
+ continue # undefined key. Should never happen
+ percentage = 100.0 * ref_value / row["considered_duration"]
+ if percentage < level:
+ return False
+
+ return True
# Compute a list of availability tables - one for each group.
# Each entry is a pair of group_name and availability_table.