Module: check_mk
Branch: master
Commit: 43b657bf9bcc0317b723bd5dbae72b69377b9102
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=43b657bf9bcc03…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Apr 17 13:01:36 2019 +0200
7340 Add option to show long output in availability timeline
In addition to the "last known plugin output" it is now possible to show the
"last known long output" in the availability timeline as separate column.
This column is only populated for hosts / services that have been configured to
write their long output to the monitoring history. This can be done using the
new rulesets "Write long output of services to monitoring history" and "Write
long output of hosts to monitoring history".
Be aware: Enabling this option may increase the filesystem space consumption of
your monitoring history depending on the amount of data your hosts or services
put in the long output. You should only enable this for the objects you need it
for.
This feature can only be used with the Microcore.
Change-Id: I206723bd61394af3537a91a5735914b93cfe169d
---
.werks/7340 | 23 +++++++++++++++++++++++
cmk/gui/availability.py | 22 +++++++++++++++++++++-
cmk/gui/plugins/views/availability.py | 17 ++++++++++++++---
3 files changed, 58 insertions(+), 4 deletions(-)
diff --git a/.werks/7340 b/.werks/7340
new file mode 100644
index 0000000..7cfe7fe
--- /dev/null
+++ b/.werks/7340
@@ -0,0 +1,23 @@
+Title: Add option to show long output in availability timeline
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cee
+Version: 1.6.0i1
+Date: 1555497919
+Class: feature
+
+In addition to the "last known plugin output" it is now possible to show the
+"last known long output" in the availability timeline as separate column.
+
+This column is only populated for hosts / services that have been configured to
+write their long output to the monitoring history. This can be done using the
+new rulesets "Write long output of services to monitoring history" and "Write
+long output of hosts to monitoring history".
+
+Be aware: Enabling this option may increase the filesystem space consumption of
+your monitoring history depending on the amount of data your hosts or services
+put in the long output. You should only enable this for the objects you need it
+for.
+
+This feature can only be used with the Microcore.
diff --git a/cmk/gui/availability.py b/cmk/gui/availability.py
index da057d1..3360235 100644
--- a/cmk/gui/availability.py
+++ b/cmk/gui/availability.py
@@ -151,6 +151,23 @@ def get_av_display_options(what):
("service_groups", _("By Service group")),
]
+ if not cmk.is_raw_edition():
+ ruleset_search_url = html.makeuri_contextless(
+ [
+ ("filled_in", "search"),
+ ("search", "long_output"),
+ ("mode", "rulesets"),
+ ],
+ filename="wato.py",
+ )
+ long_output_labelling = [
+ ("timeline_long_output",
+ _("Display long output in timeline (<a href=\"%s\">Enable via WATO</a>)") %
+ ruleset_search_url)
+ ]
+ else:
+ long_output_labelling = []
+
return [
# Time range selection
("rangespec", "double", False, Timerange(
@@ -169,6 +186,7 @@ def get_av_display_options(what):
("use_display_name", _("Use alternative display name for services")),
("omit_buttons", _("Do not display icons for history and timeline")),
("omit_timeline_plugin_output", _("Do not display plugin output in timeline")),
+ ] + long_output_labelling + [
("display_timeline_legend", _("Display legend for timeline")),
("omit_av_levels", _("Do not display legend for availability levels")),
])),
@@ -605,7 +623,7 @@ def get_outage_statistic_options(avoptions):
# a specific host or service has one specific state.
# what is either "host" or "service" or "bi".
def get_availability_rawdata(what, context, filterheaders, only_sites, av_object, include_output,
- avoptions):
+ include_long_output, avoptions):
if what == "bi":
return get_bi_availability_rawdata(filterheaders, only_sites, av_object, include_output,
avoptions)
@@ -647,6 +665,8 @@ def get_availability_rawdata(what, context, filterheaders, only_sites, av_object
]
if include_output:
columns.append("log_output")
+ if include_long_output:
+ columns.append("long_log_output")
if "use_display_name" in avoptions["labelling"]:
columns.append("service_display_name")
if "show_alias" in avoptions["labelling"]:
diff --git a/cmk/gui/plugins/views/availability.py b/cmk/gui/plugins/views/availability.py
index 6a91620..d4d50f8 100644
--- a/cmk/gui/plugins/views/availability.py
+++ b/cmk/gui/plugins/views/availability.py
@@ -219,9 +219,17 @@ def render_availability_page(view, context, filterheaders):
# Now compute all data, we need this also for CSV export
if not html.has_user_errors():
- av_rawdata, has_reached_logrow_limit = \
- availability.get_availability_rawdata(what, context, filterheaders, view.only_sites,
- av_object, av_mode == "timeline", avoptions)
+ include_long_output = av_mode == "timeline" \
+ and "timeline_long_output" in avoptions["labelling"]
+ av_rawdata, has_reached_logrow_limit = availability.get_availability_rawdata(
+ what,
+ context,
+ filterheaders,
+ view.only_sites,
+ av_object=av_object,
+ include_output=av_mode == "timeline",
+ include_long_output=include_long_output,
+ avoptions=avoptions)
av_data = availability.compute_availability(what, av_rawdata, avoptions)
# Do CSV ouput
@@ -422,6 +430,9 @@ def render_availability_timeline(what, av_entry, avoptions):
if "omit_timeline_plugin_output" not in avoptions["labelling"]:
table.cell(_("Last Known Plugin Output"), row.get("log_output", ""))
+ if "timeline_long_output" in avoptions["labelling"]:
+ table.cell(_("Last Known Long Output"), row.get("long_log_output", ""))
+
# Legend for timeline
if "display_timeline_legend" in avoptions["labelling"]:
render_timeline_legend(what)