Module: check_mk
Branch: master
Commit: 2a036ced5c63df141d0fbf0d53d8dc8db0d2fb91
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2a036ced5c63df…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Mar 21 10:26:52 2014 +0100
FIX Availability: fix exception when summary is on and some elements have never been OK
---
.werks/750 | 8 ++++++++
ChangeLog | 1 +
web/plugins/views/availability.py | 6 +++++-
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/.werks/750 b/.werks/750
new file mode 100644
index 0000000..ee3c3b6
--- /dev/null
+++ b/.werks/750
@@ -0,0 +1,8 @@
+Title: Availability: fix exception when summary is on and some elements have never been
OK
+Level: 1
+Component: reporting
+Version: 1.2.5i1
+Date: 1395393981
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 7d79fd1..56ced6a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -354,6 +354,7 @@
* 0405 Add CSV export to availability views...
* 0338 FIX: Introduce time limit on availability queries...
* 0681 FIX: Display correct year for availability range for last month in january
+ * 0750 FIX: Availability: fix exception when summary is on and some elements have
never been OK
Event Console:
* 0301 Handling messages of special syslog format correctly...
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index ce7efa9..907a460 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -1161,7 +1161,8 @@ def render_availability_group(group_title, range_title, group_id,
availability,
elif show_summary:
summary.setdefault(sid, 0.0)
if avoptions["timeformat"].startswith("percentage"):
- summary[sid] += float(number) / considered_duration
+ if considered_duration > 0:
+ summary[sid] += float(number) / considered_duration
else:
summary[sid] += number
@@ -1237,6 +1238,9 @@ def render_availability_group(group_title, range_title, group_id,
availability,
table.end()
def check_av_levels(number, av_levels, considered_duration):
+ if considered_duration == 0:
+ return 0
+
perc = 100 * float(number) / float(considered_duration)
warn, crit = av_levels
if perc < crit: