Module: check_mk
Branch: master
Commit: 4718aa0ba52120c9719dd3c6fbcb1936ab0cecb8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4718aa0ba52120…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jun 4 11:30:11 2014 +0200
Availability: display phases of freqent state changes as "chaos"
This makes sure that phases with thousand state changes with in a
short time are being displayed as correctly as possible.
---
.werks/985 | 9 +++++++++
ChangeLog | 3 +++
web/htdocs/views.css | 4 ++++
web/plugins/views/availability.py | 34 +++++++++++++++++++++++++++++++---
4 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/.werks/985 b/.werks/985
new file mode 100644
index 0000000..dde292a
--- /dev/null
+++ b/.werks/985
@@ -0,0 +1,9 @@
+Title: Availability: display phases of freqent state changes as "chaos"
+Level: 1
+Component: reporting
+Version: 1.2.5i4
+Date: 1401874149
+Class: feature
+
+This makes sure that phases with thousand state changes with in a
+short time are being displayed as correctly as possible.
diff --git a/ChangeLog b/ChangeLog
index 154f620..0e66b5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,9 @@
WATO:
* 0813 FIX: LDAP: Improved slightly missleading logging of LDAP sync actions...
+ Reporting & Availability:
+ * 0985 Availability: display phases of freqent state changes as "chaos"...
+
1.2.5i3:
Core & Setup:
diff --git a/web/htdocs/views.css b/web/htdocs/views.css
index 1d07c68..2f5a724 100644
--- a/web/htdocs/views.css
+++ b/web/htdocs/views.css
@@ -586,6 +586,10 @@ table.timeline td {
border-style: none;
}
+table.timeline td.chaos {
+ background-color: #8844ff;
+}
+
table.timeline.standalone td {
border: 1px solid #444;
}
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index f8fa9a4..9d211c3 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -839,7 +839,7 @@ def render_timeline(timeline_rows, from_time, until_time,
considered_duration,
# Render graphical representation
# Make sure that each cell is visible, if possible
- min_percentage = min(100.0 / len(timeline_rows), style == "inline" and 0.1
or 0.5)
+ min_percentage = min(100.0 / len(timeline_rows), style == "inline" and 0.0
or 0.5)
rest_percentage = 100 - len(timeline_rows) * min_percentage
html.write('<div class="timelinerange %s">' % style)
if style == "standalone":
@@ -848,6 +848,19 @@ def render_timeline(timeline_rows, from_time, until_time,
considered_duration,
html.write('<table class="timeline %s">' % style)
html.write('<tr class=timeline>')
+ chaos_begin = None
+ chaos_end = None
+ chaos_count = 0
+ chaos_width = 0
+
+ def output_chaos_period(chaos_begin, chaos_end, chaos_count, chaos_width):
+ title = _("%d chaotic state changes from %s until %s (%s)") % (
+ chaos_count,
+ render_date(chaos_begin), render_date(chaos_end),
+ render_number(chaos_end - chaos_begin, considered_duration))
+ html.write('<td style="width: %.3f%%" title="%s"
class="chaos"></td>' % (
+ max(0.2, chaos_width), html.attrencode(title)))
+
for row_nr, (row, state_id) in enumerate(timeline_rows):
for sid, css, sname, help in availability_columns:
if sid == state_id:
@@ -857,9 +870,24 @@ def render_timeline(timeline_rows, from_time, until_time,
considered_duration,
help and help or sname)
if row["log_output"]:
title += " - " + row["log_output"]
- width = min_percentage + rest_percentage * row["duration"] /
considered_duration
+ width = rest_percentage * row["duration"] /
considered_duration
+ if style == "inline" and width < 0.05:
+ if not chaos_begin:
+ chaos_begin = row["from"]
+ chaos_width += width
+ chaos_count += 1
+ chaos_end = row["until"]
+ continue
+ elif chaos_begin and chaos_count > 1:
+ output_chaos_period(chaos_begin, chaos_end, chaos_count,
chaos_width)
+ chaos_begin = None
+ chaos_count = 0
+ chaos_width = 0
+ continue
+
+ width += min_percentage
html.write('<td onmouseover="timeline_hover(%d, 1);"
onmouseout="timeline_hover(%d, 0);" '
- 'style="width: %.1f%%" title="%s"
class="%s"></td>' % (
+ 'style="width: %.3f%%" title="%s"
class="%s"></td>' % (
row_nr, row_nr, width, html.attrencode(title), css))
html.write('</tr></table>')